9255{
9257 {
9258 return true;
9259 }
9260};
9261
9263{
9264
9265};
9266
9267
9268
9270{
9274
9276
9279
9280
9281
9282
9283
9292
9298
9303
9308
9329 protected bool m_IsResultOfSplit
9330
9332
9337
9338
9339
9341
9345
9346
9347
9349
9352
9353
9354
9360
9361
9369
9372
9373
9375
9376
9378
9379
9384
9385
9390
9392
9393
9395
9396
9398 {
9403
9404 if (!
g_Game.IsDedicatedServer())
9405 {
9407 {
9409
9411 {
9413 }
9414 }
9415
9418 }
9419
9420 m_OldLocation = null;
9421
9423 {
9425 }
9426
9427 if (ConfigIsExisting("headSelectionsToHide"))
9428 {
9431 }
9432
9434 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9435 {
9437 }
9438
9440
9441 m_IsResultOfSplit = false;
9442
9444 }
9445
9447 {
9448 super.InitItemVariables();
9449
9455 m_Count = ConfigGetInt(
"count");
9456
9459
9464
9467
9472
9484
9488
9489
9492 if (ConfigIsExisting("canBeSplit"))
9493 {
9496 }
9497
9499 if (ConfigIsExisting("itemBehaviour"))
9501
9502
9505 RegisterNetSyncVariableInt("m_VarLiquidType");
9506 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9507
9508 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9509 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9510 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9511
9512 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9513 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9514 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9515 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9516
9517 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9518 RegisterNetSyncVariableBool("m_IsTakeable");
9519 RegisterNetSyncVariableBool("m_IsHologram");
9520
9523 {
9526 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9527 }
9528
9530
9532 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9534
9536 }
9537
9539 {
9541 }
9542
9544 {
9547 {
9552 }
9553 }
9554
9555 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9556 {
9558 {
9561 }
9562
9564 }
9565
9567 {
9573 }
9574
9576
9578 {
9580
9581 if (!action)
9582 {
9583 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9584 return;
9585 }
9586
9588 if (!ai)
9589 {
9591 return;
9592 }
9593
9595 if (!action_array)
9596 {
9597 action_array = new array<ActionBase_Basic>;
9599 }
9600 if (LogManager.IsActionLogEnable())
9601 {
9602 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9603 }
9604
9605 if (action_array.Find(action) != -1)
9606 {
9607 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9608 }
9609 else
9610 {
9611 action_array.Insert(action);
9612 }
9613 }
9614
9616 {
9617 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9618 ActionBase action = player.GetActionManager().GetAction(actionName);
9621
9622 if (action_array)
9623 {
9624 action_array.RemoveItem(action);
9625 }
9626 }
9627
9628
9629
9631 {
9632 ActionOverrideData overrideData = new ActionOverrideData();
9636
9638 if (!actionMap)
9639 {
9642 }
9643
9644 actionMap.Insert(this.
Type(), overrideData);
9645
9646 }
9647
9649
9651
9652
9654 {
9657
9660
9661 string config_to_search = "CfgVehicles";
9662 string muzzle_owner_config;
9663
9665 {
9666 if (IsInherited(Weapon))
9667 config_to_search = "CfgWeapons";
9668
9669 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9670
9671 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9672
9673 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9674
9675 if (config_OnFire_subclass_count > 0)
9676 {
9677 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9678
9679 for (int i = 0; i < config_OnFire_subclass_count; i++)
9680 {
9681 string particle_class = "";
9682 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9683 string config_OnFire_entry = config_OnFire_class + particle_class;
9684 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9685 WPOF_array.Insert(WPOF);
9686 }
9687
9688
9690 }
9691 }
9692
9694 {
9695 config_to_search = "CfgWeapons";
9696 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9697
9698 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9699
9700 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9701
9702 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9703 {
9704 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9705
9706 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9707 {
9708 string particle_class2 = "";
9709 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9710 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9711 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9712 WPOBE_array.Insert(WPOBE);
9713 }
9714
9715
9717 }
9718 }
9719 }
9720
9721
9723 {
9726
9728 {
9729 string config_to_search = "CfgVehicles";
9730
9731 if (IsInherited(Weapon))
9732 config_to_search = "CfgWeapons";
9733
9734 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9735 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9736
9737 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9738 {
9739
9741
9743 {
9745 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9747 return;
9748 }
9749
9752
9753
9754
9755 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9756 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9757
9758 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9759 {
9760 string particle_class = "";
9761 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9762 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9763 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9764
9765 if (entry_type == CT_CLASS)
9766 {
9767 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9768 WPOOH_array.Insert(WPOF);
9769 }
9770 }
9771
9772
9774 }
9775 }
9776 }
9777
9779 {
9781 }
9782
9784 {
9786 {
9788
9791
9794
9795 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9796 }
9797 }
9798
9800 {
9802 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9803
9805 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9806
9808 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9809
9811 {
9813 }
9814 }
9815
9817 {
9819 }
9820
9822 {
9825 else
9827
9829 {
9832 }
9833 else
9834 {
9837
9840 }
9841
9843 }
9844
9846 {
9848 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9849 }
9850
9852 {
9854 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9856 }
9857
9859 {
9861 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9862 }
9863
9865 {
9868
9869 OverheatingParticle OP = new OverheatingParticle();
9874
9876 }
9877
9879 {
9882
9883 return -1;
9884 }
9885
9887 {
9889 {
9892
9893 for (int i = count; i > 0; --i)
9894 {
9895 int id = i - 1;
9898
9901
9902 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9903 {
9904 if (p)
9905 {
9908 }
9909 }
9910 }
9911 }
9912 }
9913
9915 {
9917 {
9919 {
9920 int id = i - 1;
9922
9923 if (OP)
9924 {
9926
9927 if (p)
9928 {
9930 }
9931
9932 delete OP;
9933 }
9934 }
9935
9938 }
9939 }
9940
9943 {
9944 return 0.0;
9945 }
9946
9947
9949 {
9950 return 250;
9951 }
9952
9954 {
9955 return 0;
9956 }
9957
9960 {
9962 return true;
9963
9964 return false;
9965 }
9966
9969 {
9972
9974 {
9976 }
9977 else
9978 {
9979
9981 }
9982
9984 }
9985
9992 {
9993 return -1;
9994 }
9995
9996
9997
9998
10000 {
10002 {
10003 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10004 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10005
10006 if (r_index >= 0)
10007 {
10008 InventoryLocation r_il = new InventoryLocation;
10009 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10010
10011 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10014 {
10015 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10016 }
10018 {
10019 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10020 }
10021
10022 }
10023
10024 player.GetHumanInventory().ClearUserReservedLocation(this);
10025 }
10026
10029 }
10030
10031
10032
10033
10035 {
10036 return ItemBase.m_DebugActionsMask;
10037 }
10038
10040 {
10041 return ItemBase.m_DebugActionsMask & mask;
10042 }
10043
10045 {
10046 ItemBase.m_DebugActionsMask = mask;
10047 }
10048
10050 {
10051 ItemBase.m_DebugActionsMask |= mask;
10052 }
10053
10055 {
10056 ItemBase.m_DebugActionsMask &= ~mask;
10057 }
10058
10060 {
10062 {
10064 }
10065 else
10066 {
10068 }
10069 }
10070
10071
10073 {
10074 if (GetEconomyProfile())
10075 {
10076 float q_max = GetEconomyProfile().GetQuantityMax();
10077 if (q_max > 0)
10078 {
10079 float q_min = GetEconomyProfile().GetQuantityMin();
10080 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10081
10083 {
10084 ComponentEnergyManager comp = GetCompEM();
10086 {
10088 }
10089 }
10091 {
10093
10094 }
10095
10096 }
10097 }
10098 }
10099
10102 {
10103 EntityAI parent = GetHierarchyParent();
10104
10105 if (parent)
10106 {
10107 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10108 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10109 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10110 }
10111 }
10112
10115 {
10116 EntityAI parent = GetHierarchyParent();
10117
10118 if (parent)
10119 {
10120 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10121 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10122 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10123 }
10124 }
10125
10127 {
10128
10129
10130
10131
10133
10135 {
10136 if (ScriptInputUserData.CanStoreInputUserData())
10137 {
10138 ScriptInputUserData ctx = new ScriptInputUserData;
10144 ctx.
Write(use_stack_max);
10147
10149 {
10150 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10151 }
10152 }
10153 }
10154 else if (!
g_Game.IsMultiplayer())
10155 {
10157 }
10158 }
10159
10161 {
10163 }
10164
10166 {
10168 }
10169
10171 {
10173 }
10174
10176 {
10177
10178 return false;
10179 }
10180
10182 {
10183 return false;
10184 }
10185
10189 {
10190 return false;
10191 }
10192
10194 {
10195 return "";
10196 }
10197
10199
10201 {
10202 return false;
10203 }
10204
10206 {
10207 return true;
10208 }
10209
10210
10211
10213 {
10214 return true;
10215 }
10216
10218 {
10219 return true;
10220 }
10221
10223 {
10224 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10226 }
10227
10229 {
10231 }
10232
10234 {
10236 if (!is_being_placed)
10238 SetSynchDirty();
10239 }
10240
10241
10243
10245 {
10247 }
10248
10250 {
10252 }
10253
10255 {
10256 return 1;
10257 }
10258
10260 {
10261 return false;
10262 }
10263
10265 {
10267 SetSynchDirty();
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
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10305 {
10306 super.OnMovedInsideCargo(container);
10307
10308 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10309 }
10310
10311 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10312 {
10313 super.EEItemLocationChanged(oldLoc, newLoc);
10314
10315 PlayerBase newPlayer = null;
10316 PlayerBase oldPlayer = null;
10317
10318 if (newLoc.GetParent())
10319 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10320
10321 if (oldLoc.GetParent())
10322 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10323
10325 {
10326 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10327
10328 if (rIndex >= 0)
10329 {
10330 InventoryLocation rIl = new InventoryLocation;
10331 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10332
10333 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10336 {
10337 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10338 }
10340 {
10342 }
10343
10344 }
10345 }
10346
10348 {
10349 if (newPlayer)
10350 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10351
10352 if (newPlayer == oldPlayer)
10353 {
10354 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10355 {
10357 {
10358 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10359 {
10360 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10361 }
10362 }
10363 else
10364 {
10365 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10366 }
10367 }
10368
10369 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10370 {
10371 int type = oldLoc.GetType();
10373 {
10374 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10375 }
10377 {
10378 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10379 }
10380 }
10381 if (!m_OldLocation)
10382 {
10383 m_OldLocation = new InventoryLocation;
10384 }
10385 m_OldLocation.Copy(oldLoc);
10386 }
10387 else
10388 {
10389 if (m_OldLocation)
10390 {
10391 m_OldLocation.Reset();
10392 }
10393 }
10394
10395 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10396 }
10397 else
10398 {
10399 if (newPlayer)
10400 {
10401 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10402 if (resIndex >= 0)
10403 {
10404 InventoryLocation il = new InventoryLocation;
10405 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10407 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10410 {
10411 il.
GetParent().GetOnReleaseLock().Invoke(it);
10412 }
10414 {
10416 }
10417
10418 }
10419 }
10421 {
10422
10424 }
10425
10426 if (m_OldLocation)
10427 {
10428 m_OldLocation.Reset();
10429 }
10430 }
10431
10433 {
10434 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10435 }
10436
10438 {
10439 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10440 }
10441 }
10442
10443 override void EOnContact(IEntity other, Contact extra)
10444 {
10446 {
10447 int liquidType = -1;
10449 if (impactSpeed > 0.0)
10450 {
10452 #ifndef SERVER
10454 #else
10456 SetSynchDirty();
10457 #endif
10459 }
10460 }
10461
10462 #ifdef SERVER
10463 if (GetCompEM() && GetCompEM().IsPlugged())
10464 {
10465 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10466 GetCompEM().UnplugThis();
10467 }
10468 #endif
10469 }
10470
10472
10474 {
10476 }
10477
10479 {
10480
10481 }
10482
10484 {
10485 super.OnItemLocationChanged(old_owner, new_owner);
10486
10487 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10488 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10489
10490 if (!relatedPlayer && playerNew)
10491 relatedPlayer = playerNew;
10492
10493 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10494 {
10496 if (actionMgr)
10497 {
10498 ActionBase currentAction = actionMgr.GetRunningAction();
10499 if (currentAction)
10501 }
10502 }
10503
10504 Man ownerPlayerOld = null;
10505 Man ownerPlayerNew = null;
10506
10507 if (old_owner)
10508 {
10509 if (old_owner.
IsMan())
10510 {
10511 ownerPlayerOld = Man.Cast(old_owner);
10512 }
10513 else
10514 {
10515 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10516 }
10517 }
10518 else
10519 {
10521 {
10523
10524 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10525 {
10526 GetCompEM().UnplugThis();
10527 }
10528 }
10529 }
10530
10531 if (new_owner)
10532 {
10533 if (new_owner.
IsMan())
10534 {
10535 ownerPlayerNew = Man.Cast(new_owner);
10536 }
10537 else
10538 {
10539 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10540 }
10541 }
10542
10543 if (ownerPlayerOld != ownerPlayerNew)
10544 {
10545 if (ownerPlayerOld)
10546 {
10547 array<EntityAI> subItemsExit = new array<EntityAI>;
10549 for (int i = 0; i < subItemsExit.Count(); i++)
10550 {
10553 }
10554 }
10555
10556 if (ownerPlayerNew)
10557 {
10558 array<EntityAI> subItemsEnter = new array<EntityAI>;
10560 for (int j = 0; j < subItemsEnter.Count(); j++)
10561 {
10564 }
10565 }
10566 }
10567 else if (ownerPlayerNew != null)
10568 {
10569 PlayerBase nplayer;
10570 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10571 {
10572 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10574 for (int k = 0; k < subItemsUpdate.Count(); k++)
10575 {
10577 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10578 }
10579 }
10580 }
10581
10582 if (old_owner)
10583 old_owner.OnChildItemRemoved(this);
10584 if (new_owner)
10585 new_owner.OnChildItemReceived(this);
10586 }
10587
10588
10590 {
10591 super.EEDelete(parent);
10592 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10593 if (player)
10594 {
10596
10597 if (player.IsAlive())
10598 {
10599 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10600 if (r_index >= 0)
10601 {
10602 InventoryLocation r_il = new InventoryLocation;
10603 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10604
10605 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10608 {
10609 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10610 }
10612 {
10613 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10614 }
10615
10616 }
10617
10618 player.RemoveQuickBarEntityShortcut(this);
10619 }
10620 }
10621 }
10622
10624 {
10625 super.EEKilled(killer);
10626
10629 {
10630 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10631 {
10632 if (IsMagazine())
10633 {
10634 if (Magazine.Cast(this).GetAmmoCount() > 0)
10635 {
10637 }
10638 }
10639 else
10640 {
10642 }
10643 }
10644 }
10645 }
10646
10648 {
10649 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10650
10651 super.OnWasAttached(parent, slot_id);
10652
10655
10658 }
10659
10661 {
10662 super.OnWasDetached(parent, slot_id);
10663
10666
10669 }
10670
10672 {
10673 int idx;
10676
10677 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10678 if (inventory_slots.Count() < 1)
10679 {
10680 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10681 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10682 }
10683 else
10684 {
10685 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10686 }
10687
10688 idx = inventory_slots.Find(slot);
10689 if (idx < 0)
10690 return "";
10691
10692 return attach_types.Get(idx);
10693 }
10694
10696 {
10697 int idx = -1;
10698 string slot;
10699
10702
10703 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10704 if (inventory_slots.Count() < 1)
10705 {
10706 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10707 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10708 }
10709 else
10710 {
10711 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10712 if (detach_types.Count() < 1)
10713 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10714 }
10715
10716 for (int i = 0; i < inventory_slots.Count(); i++)
10717 {
10718 slot = inventory_slots.Get(i);
10719 }
10720
10721 if (slot != "")
10722 {
10723 if (detach_types.Count() == 1)
10724 idx = 0;
10725 else
10726 idx = inventory_slots.Find(slot);
10727 }
10728 if (idx < 0)
10729 return "";
10730
10731 return detach_types.Get(idx);
10732 }
10733
10735 {
10736
10738
10739
10740 float min_time = 1;
10741 float max_time = 3;
10742 float delay = Math.RandomFloat(min_time, max_time);
10743
10744 explode_timer.Run(delay, this, "DoAmmoExplosion");
10745 }
10746
10748 {
10749 Magazine magazine = Magazine.Cast(this);
10750 int pop_sounds_count = 6;
10751 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10752
10753
10754 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10755 string sound_name = pop_sounds[ sound_idx ];
10756 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10757
10758
10759 magazine.ServerAddAmmoCount(-1);
10760
10761
10762 float min_temp_to_explode = 100;
10763
10764 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10765 {
10767 }
10768 }
10769
10770
10771 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10772 {
10773 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10774
10775 const int CHANCE_DAMAGE_CARGO = 4;
10776 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10777 const int CHANCE_DAMAGE_NOTHING = 2;
10778
10780 {
10781 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10782 int chances;
10783 int rnd;
10784
10785 if (GetInventory().GetCargo())
10786 {
10787 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10788 rnd = Math.RandomInt(0,chances);
10789
10790 if (rnd < CHANCE_DAMAGE_CARGO)
10791 {
10793 }
10794 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10795 {
10797 }
10798 }
10799 else
10800 {
10801 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10802 rnd = Math.RandomInt(0,chances);
10803
10804 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10805 {
10807 }
10808 }
10809 }
10810 }
10811
10813 {
10814 CargoBase cargo = GetInventory().GetCargo();
10815 if (cargo)
10816 {
10818 if (item_count > 0)
10819 {
10820 int random_pick = Math.RandomInt(0, item_count);
10822 if (!item.IsExplosive())
10823 {
10824 item.AddHealth("","",damage);
10825 return true;
10826 }
10827 }
10828 }
10829 return false;
10830 }
10831
10833 {
10834 GameInventory inventory = GetInventory();
10836 if (attachment_count > 0)
10837 {
10838 int random_pick = Math.RandomInt(0, attachment_count);
10840 if (!attachment.IsExplosive())
10841 {
10842 attachment.AddHealth("","",damage);
10843 return true;
10844 }
10845 }
10846 return false;
10847 }
10848
10850 {
10852 }
10853
10855 {
10857 return GetInventory().CanRemoveEntity();
10858
10859 return false;
10860 }
10861
10863 {
10864
10866 return false;
10867
10868
10870 return false;
10871
10872
10873
10875 if (delta == 0)
10876 return false;
10877
10878
10879 return true;
10880 }
10881
10883 {
10885 {
10886 if (ScriptInputUserData.CanStoreInputUserData())
10887 {
10888 ScriptInputUserData ctx = new ScriptInputUserData;
10893 ctx.
Write(destination_entity);
10895 ctx.
Write(slot_id);
10897 }
10898 }
10899 else if (!
g_Game.IsMultiplayer())
10900 {
10902 }
10903 }
10904
10906 {
10907 float split_quantity_new;
10911 InventoryLocation loc = new InventoryLocation;
10912
10913 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10914 {
10916 split_quantity_new = stack_max;
10917 else
10919
10921 {
10922 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10923 if (new_item)
10924 {
10925 new_item.SetResultOfSplit(true);
10926 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10928 new_item.
SetQuantity(split_quantity_new,
false,
true);
10929 }
10930 }
10931 }
10932 else if (destination_entity && slot_id == -1)
10933 {
10934 if (quantity > stack_max)
10935 split_quantity_new = stack_max;
10936 else
10937 split_quantity_new = quantity;
10938
10940 {
10941 GameInventory destinationInventory = destination_entity.GetInventory();
10943 {
10946 }
10947
10948 if (new_item)
10949 {
10950 new_item.SetResultOfSplit(true);
10951 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10953 new_item.
SetQuantity(split_quantity_new,
false,
true);
10954 }
10955 }
10956 }
10957 else
10958 {
10959 if (stack_max != 0)
10960 {
10962 {
10964 }
10965
10966 if (split_quantity_new == 0)
10967 {
10968 if (!
g_Game.IsMultiplayer())
10969 player.PhysicalPredictiveDropItem(this);
10970 else
10971 player.ServerDropEntity(this);
10972 return;
10973 }
10974
10976 {
10978
10979 if (new_item)
10980 {
10981 new_item.SetResultOfSplit(true);
10982 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10985 new_item.PlaceOnSurface();
10986 }
10987 }
10988 }
10989 }
10990 }
10991
10993 {
10994 float split_quantity_new;
10998 InventoryLocation loc = new InventoryLocation;
10999
11000 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11001 {
11003 split_quantity_new = stack_max;
11004 else
11006
11008 {
11009 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11010 if (new_item)
11011 {
11012 new_item.SetResultOfSplit(true);
11013 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11015 new_item.
SetQuantity(split_quantity_new,
false,
true);
11016 }
11017 }
11018 }
11019 else if (destination_entity && slot_id == -1)
11020 {
11021 if (quantity > stack_max)
11022 split_quantity_new = stack_max;
11023 else
11024 split_quantity_new = quantity;
11025
11027 {
11028 GameInventory destinationInventory = destination_entity.GetInventory();
11030 {
11033 }
11034
11035 if (new_item)
11036 {
11037 new_item.SetResultOfSplit(true);
11038 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11040 new_item.
SetQuantity(split_quantity_new,
false,
true);
11041 }
11042 }
11043 }
11044 else
11045 {
11046 if (stack_max != 0)
11047 {
11049 {
11051 }
11052
11054 {
11056
11057 if (new_item)
11058 {
11059 new_item.SetResultOfSplit(true);
11060 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11063 new_item.PlaceOnSurface();
11064 }
11065 }
11066 }
11067 }
11068 }
11069
11071 {
11073 {
11074 if (ScriptInputUserData.CanStoreInputUserData())
11075 {
11076 ScriptInputUserData ctx = new ScriptInputUserData;
11081 dst.WriteToContext(ctx);
11083 }
11084 }
11085 else if (!
g_Game.IsMultiplayer())
11086 {
11088 }
11089 }
11090
11092 {
11094 {
11095 if (ScriptInputUserData.CanStoreInputUserData())
11096 {
11097 ScriptInputUserData ctx = new ScriptInputUserData;
11102 ctx.
Write(destination_entity);
11108 }
11109 }
11110 else if (!
g_Game.IsMultiplayer())
11111 {
11113 }
11114 }
11115
11117 {
11119 }
11120
11122 {
11124 float split_quantity_new;
11126 if (dst.IsValid())
11127 {
11128 int slot_id = dst.GetSlot();
11130
11131 if (quantity > stack_max)
11132 split_quantity_new = stack_max;
11133 else
11134 split_quantity_new = quantity;
11135
11137 {
11139
11140 if (new_item)
11141 {
11142 new_item.SetResultOfSplit(true);
11143 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11145 new_item.
SetQuantity(split_quantity_new,
false,
true);
11146 }
11147
11148 return new_item;
11149 }
11150 }
11151
11152 return null;
11153 }
11154
11156 {
11158 float split_quantity_new;
11160 if (destination_entity)
11161 {
11163 if (quantity > stackable)
11164 split_quantity_new = stackable;
11165 else
11166 split_quantity_new = quantity;
11167
11169 {
11170 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11171 if (new_item)
11172 {
11173 new_item.SetResultOfSplit(true);
11174 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11176 new_item.
SetQuantity(split_quantity_new,
false,
true);
11177 }
11178 }
11179 }
11180 }
11181
11183 {
11185 {
11186 if (ScriptInputUserData.CanStoreInputUserData())
11187 {
11188 ScriptInputUserData ctx = new ScriptInputUserData;
11193 ItemBase destination_entity =
this;
11194 ctx.
Write(destination_entity);
11198 }
11199 }
11200 else if (!
g_Game.IsMultiplayer())
11201 {
11203 }
11204 }
11205
11207 {
11209 float split_quantity_new;
11211 if (player)
11212 {
11214 if (quantity > stackable)
11215 split_quantity_new = stackable;
11216 else
11217 split_quantity_new = quantity;
11218
11220 {
11221 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11222 new_item =
ItemBase.Cast(in_hands);
11223 if (new_item)
11224 {
11225 new_item.SetResultOfSplit(true);
11226 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11228 new_item.SetQuantity(split_quantity_new, false, true);
11229 }
11230 }
11231 }
11232 }
11233
11235 {
11237 float split_quantity_new = Math.Floor(quantity * 0.5);
11238
11240 return;
11241
11243
11244 if (new_item)
11245 {
11246 if (new_item.GetQuantityMax() < split_quantity_new)
11247 {
11248 split_quantity_new = new_item.GetQuantityMax();
11249 }
11250
11251 new_item.SetResultOfSplit(true);
11252 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11253
11255 {
11258 }
11259 else
11260 {
11262 new_item.
SetQuantity(split_quantity_new,
false,
true);
11263 }
11264 }
11265 }
11266
11268 {
11270 float split_quantity_new = Math.Floor(quantity / 2);
11271
11273 return;
11274
11275 InventoryLocation invloc = new InventoryLocation;
11277
11279 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11280
11281 if (new_item)
11282 {
11283 if (new_item.GetQuantityMax() < split_quantity_new)
11284 {
11285 split_quantity_new = new_item.GetQuantityMax();
11286 }
11288 {
11291 }
11292 else if (split_quantity_new > 1)
11293 {
11295 new_item.
SetQuantity(split_quantity_new,
false,
true);
11296 }
11297 }
11298 }
11299
11302 {
11303 SetWeightDirty();
11305
11306 if (parent)
11307 parent.OnAttachmentQuantityChangedEx(this, delta);
11308
11310 {
11312 {
11314 }
11316 {
11317 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11319 }
11320 }
11321 }
11322
11325 {
11326
11327 }
11328
11331 {
11333 }
11334
11336 {
11337 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11338
11340 {
11341 if (newLevel == GameConstants.STATE_RUINED)
11342 {
11344 EntityAI parent = GetHierarchyParent();
11345 if (parent && parent.IsFireplace())
11346 {
11347 CargoBase cargo = GetInventory().GetCargo();
11348 if (cargo)
11349 {
11351 {
11353 }
11354 }
11355 }
11356 }
11357
11359 {
11360
11362 return;
11363 }
11364
11365 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11366 {
11368 }
11369 }
11370 }
11371
11372
11374 {
11375 super.OnRightClick();
11376
11378 {
11380 {
11381 if (ScriptInputUserData.CanStoreInputUserData())
11382 {
11383 EntityAI root = GetHierarchyRoot();
11384 Man playerOwner = GetHierarchyRootPlayer();
11385 InventoryLocation dst = new InventoryLocation;
11386
11387
11388 if (!playerOwner && root && root == this)
11389 {
11391 }
11392 else
11393 {
11394
11395 GetInventory().GetCurrentInventoryLocation(dst);
11397 {
11398 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11400 {
11402 }
11403 else
11404 {
11406
11407
11408 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11409 {
11411 }
11412 else
11413 {
11414 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11415 }
11416 }
11417 }
11418 }
11419
11420 ScriptInputUserData ctx = new ScriptInputUserData;
11428 }
11429 }
11430 else if (!
g_Game.IsMultiplayer())
11431 {
11433 }
11434 }
11435 }
11436
11438 {
11439 if (root)
11440 {
11441 vector m4[4];
11442 root.GetTransform(m4);
11443 dst.SetGround(this, m4);
11444 }
11445 else
11446 {
11447 GetInventory().GetCurrentInventoryLocation(dst);
11448 }
11449 }
11450
11451 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11452 {
11453
11454 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11455 return false;
11456
11457 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11458 return false;
11459
11460
11462 return false;
11463
11464
11465 Magazine mag = Magazine.Cast(this);
11466 if (mag)
11467 {
11468 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11469 return false;
11470
11471 if (stack_max_limit)
11472 {
11473 Magazine other_mag = Magazine.Cast(other_item);
11474 if (other_item)
11475 {
11476 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11477 return false;
11478 }
11479
11480 }
11481 }
11482 else
11483 {
11484
11486 return false;
11487
11489 return false;
11490 }
11491
11492 PlayerBase player = null;
11493 if (CastTo(player, GetHierarchyRootPlayer()))
11494 {
11495 if (player.GetInventory().HasAttachment(this))
11496 return false;
11497
11498 if (player.IsItemsToDelete())
11499 return false;
11500 }
11501
11502 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11503 return false;
11504
11505 int slotID;
11507 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11508 return false;
11509
11510 return true;
11511 }
11512
11514 {
11516 }
11517
11519 {
11520 return m_IsResultOfSplit;
11521 }
11522
11524 {
11525 m_IsResultOfSplit = value;
11526 }
11527
11529 {
11531 }
11532
11534 {
11535 float other_item_quantity = other_item.GetQuantity();
11536 float this_free_space;
11537
11539
11541
11542 if (other_item_quantity > this_free_space)
11543 {
11544 return this_free_space;
11545 }
11546 else
11547 {
11548 return other_item_quantity;
11549 }
11550 }
11551
11553 {
11555 }
11556
11558 {
11560 return;
11561
11562 if (!IsMagazine() && other_item)
11563 {
11565 if (quantity_used != 0)
11566 {
11567 float hp1 = GetHealth01("","");
11568 float hp2 = other_item.GetHealth01("","");
11569 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11570 hpResult = hpResult / (
GetQuantity() + quantity_used);
11571
11572 hpResult *= GetMaxHealth();
11573 Math.Round(hpResult);
11574 SetHealth("", "Health", hpResult);
11575
11577 other_item.AddQuantity(-quantity_used);
11578 }
11579 }
11581 }
11582
11584 {
11585 #ifdef SERVER
11586 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11587 GetHierarchyParent().IncreaseLifetimeUp();
11588 #endif
11589 };
11590
11592 {
11593 PlayerBase p = PlayerBase.Cast(player);
11594
11595 array<int> recipesIds = p.m_Recipes;
11596 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11597 if (moduleRecipesManager)
11598 {
11599 EntityAI itemInHands = player.GetEntityInHands();
11600 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11601 }
11602
11603 for (int i = 0;i < recipesIds.Count(); i++)
11604 {
11605 int key = recipesIds.Get(i);
11606 string recipeName = moduleRecipesManager.GetRecipeName(key);
11608 }
11609 }
11610
11611
11612 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11613 {
11614 super.GetDebugActions(outputList);
11615
11616
11622
11623
11628
11633
11634
11638
11639
11641 {
11645 }
11646
11649
11650
11654
11656
11657 InventoryLocation loc = new InventoryLocation();
11658 GetInventory().GetCurrentInventoryLocation(loc);
11660 {
11661 if (Gizmo_IsSupported())
11664 }
11665
11667 }
11668
11669
11670
11671
11673 {
11674 super.OnAction(action_id, player, ctx);
11675
11677 {
11678 switch (action_id)
11679 {
11683 return true;
11687 return true;
11688 }
11689 }
11690
11692 {
11693 switch (action_id)
11694 {
11696 Delete();
11697 return true;
11698 }
11699 }
11700
11701 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11702 {
11703 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11704 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11705 PlayerBase p = PlayerBase.Cast(player);
11706 if (
EActions.RECIPES_RANGE_START < 1000)
11707 {
11708 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11709 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11710 }
11711 }
11712 #ifndef SERVER
11713 else if (action_id ==
EActions.WATCH_PLAYER)
11714 {
11715 PluginDeveloper.SetDeveloperItemClientEx(player);
11716 }
11717 #endif
11719 {
11720 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11721 {
11722 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11723 OnDebugButtonPressServer(id + 1);
11724 }
11725
11726 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11727 {
11728 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11730 }
11731
11732 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11733 {
11734 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11736 }
11737
11738 else if (action_id ==
EActions.ADD_QUANTITY)
11739 {
11740 if (IsMagazine())
11741 {
11742 Magazine mag = Magazine.Cast(this);
11743 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11744 }
11745 else
11746 {
11748 }
11749
11750 if (m_EM)
11751 {
11752 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11753 }
11754
11755 }
11756
11757 else if (action_id ==
EActions.REMOVE_QUANTITY)
11758 {
11759 if (IsMagazine())
11760 {
11761 Magazine mag2 = Magazine.Cast(this);
11762 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11763 }
11764 else
11765 {
11767 }
11768 if (m_EM)
11769 {
11770 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11771 }
11772
11773 }
11774
11775 else if (action_id ==
EActions.SET_QUANTITY_0)
11776 {
11778
11779 if (m_EM)
11780 {
11781 m_EM.SetEnergy(0);
11782 }
11783 }
11784
11785 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11786 {
11788
11789 if (m_EM)
11790 {
11791 m_EM.SetEnergy(m_EM.GetEnergyMax());
11792 }
11793 }
11794
11795 else if (action_id ==
EActions.ADD_HEALTH)
11796 {
11797 AddHealth("","",GetMaxHealth("","Health")/5);
11798 }
11799 else if (action_id ==
EActions.REMOVE_HEALTH)
11800 {
11801 AddHealth("","",-GetMaxHealth("","Health")/5);
11802 }
11803 else if (action_id ==
EActions.DESTROY_HEALTH)
11804 {
11805 SetHealth01("","",0);
11806 }
11807 else if (action_id ==
EActions.WATCH_ITEM)
11808 {
11810 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11811 #ifdef DEVELOPER
11812 SetDebugDeveloper_item(this);
11813 #endif
11814 }
11815
11816 else if (action_id ==
EActions.ADD_TEMPERATURE)
11817 {
11818 AddTemperature(20);
11819
11820 }
11821
11822 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11823 {
11824 AddTemperature(-20);
11825
11826 }
11827
11828 else if (action_id ==
EActions.FLIP_FROZEN)
11829 {
11830 SetFrozen(!GetIsFrozen());
11831
11832 }
11833
11834 else if (action_id ==
EActions.ADD_WETNESS)
11835 {
11837
11838 }
11839
11840 else if (action_id ==
EActions.REMOVE_WETNESS)
11841 {
11843
11844 }
11845
11846 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11847 {
11850
11851
11852 }
11853
11854 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11855 {
11858 }
11859
11860 else if (action_id ==
EActions.MAKE_SPECIAL)
11861 {
11862 auto debugParams = DebugSpawnParams.WithPlayer(player);
11863 OnDebugSpawnEx(debugParams);
11864 }
11865
11866 }
11867
11868
11869 return false;
11870 }
11871
11872
11873
11874
11878
11881
11882
11883
11885 {
11886 return false;
11887 }
11888
11889
11891 {
11892 return true;
11893 }
11894
11895
11897 {
11898 return true;
11899 }
11900
11901
11902
11904 {
11905 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11906 return g_Game.ConfigIsExisting(config_path);
11907 }
11908
11911 {
11912 return null;
11913 }
11914
11916 {
11917 return false;
11918 }
11919
11921 {
11922 return false;
11923 }
11924
11928
11929
11931 {
11932 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11933 return module_repairing.CanRepair(this, item_repair_kit);
11934 }
11935
11936
11937 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11938 {
11939 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11940 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11941 }
11942
11943
11945 {
11946
11947
11948
11949
11950
11951
11952
11953
11954 return 1;
11955 }
11956
11957
11958
11960 {
11962 }
11963
11964
11965
11967 {
11969 }
11970
11971
11980 {
11981 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11982
11983 if (player)
11984 {
11985 player.MessageStatus(text);
11986 }
11987 }
11988
11989
11998 {
11999 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12000
12001 if (player)
12002 {
12003 player.MessageAction(text);
12004 }
12005 }
12006
12007
12016 {
12017 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12018
12019 if (player)
12020 {
12021 player.MessageFriendly(text);
12022 }
12023 }
12024
12025
12034 {
12035 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12036
12037 if (player)
12038 {
12039 player.MessageImportant(text);
12040 }
12041 }
12042
12044 {
12045 return true;
12046 }
12047
12048
12049 override bool KindOf(
string tag)
12050 {
12051 bool found = false;
12052 string item_name = this.
GetType();
12054 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12055
12056 int array_size = item_tag_array.Count();
12057 for (int i = 0; i < array_size; i++)
12058 {
12059 if (item_tag_array.Get(i) == tag)
12060 {
12061 found = true;
12062 break;
12063 }
12064 }
12065 return found;
12066 }
12067
12068
12070 {
12071
12072 super.OnRPC(sender, rpc_type,ctx);
12073
12074
12075 switch (rpc_type)
12076 {
12077 #ifndef SERVER
12078 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12079 Param2<bool, string> p = new Param2<bool, string>(false, "");
12080
12082 return;
12083
12084 bool play = p.param1;
12085 string soundSet = p.param2;
12086
12087 if (play)
12088 {
12090 {
12092 {
12094 }
12095 }
12096 else
12097 {
12099 }
12100 }
12101 else
12102 {
12104 }
12105
12106 break;
12107 #endif
12108
12109 }
12110
12112 {
12114 }
12115 }
12116
12117
12118
12119
12121 {
12122 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12123 return plugin.GetID(
name);
12124 }
12125
12127 {
12128 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12129 return plugin.GetName(id);
12130 }
12131
12134 {
12135
12136
12137 int varFlags;
12138 if (!ctx.
Read(varFlags))
12139 return;
12140
12141 if (varFlags & ItemVariableFlags.FLOAT)
12142 {
12144 }
12145 }
12146
12148 {
12149
12150 super.SerializeNumericalVars(floats_out);
12151
12152
12153
12155 {
12157 }
12158
12160 {
12162 }
12163
12165 {
12167 }
12168
12170 {
12175 }
12176
12178 {
12180 }
12181 }
12182
12184 {
12185
12186 super.DeSerializeNumericalVars(floats);
12187
12188
12189 int index = 0;
12190 int mask = Math.Round(floats.Get(index));
12191
12192 index++;
12193
12195 {
12197 {
12199 }
12200 else
12201 {
12202 float quantity = floats.Get(index);
12203 SetQuantity(quantity,
true,
false,
false,
false);
12204 }
12205 index++;
12206 }
12207
12209 {
12210 float wet = floats.Get(index);
12212 index++;
12213 }
12214
12216 {
12217 int liquidtype = Math.Round(floats.Get(index));
12219 index++;
12220 }
12221
12223 {
12225 index++;
12227 index++;
12229 index++;
12231 index++;
12232 }
12233
12235 {
12236 int cleanness = Math.Round(floats.Get(index));
12238 index++;
12239 }
12240 }
12241
12243 {
12244 super.WriteVarsToCTX(ctx);
12245
12246
12248 {
12250 }
12251
12253 {
12255 }
12256
12258 {
12260 }
12261
12263 {
12264 int r,g,b,a;
12270 }
12271
12273 {
12275 }
12276 }
12277
12279 {
12280 if (!super.ReadVarsFromCTX(ctx,version))
12281 return false;
12282
12283 int intValue;
12284 float value;
12285
12286 if (version < 140)
12287 {
12288 if (!ctx.
Read(intValue))
12289 return false;
12290
12291 m_VariablesMask = intValue;
12292 }
12293
12295 {
12296 if (!ctx.
Read(value))
12297 return false;
12298
12300 {
12302 }
12303 else
12304 {
12306 }
12307 }
12308
12309 if (version < 140)
12310 {
12312 {
12313 if (!ctx.
Read(value))
12314 return false;
12315 SetTemperatureDirect(value);
12316 }
12317 }
12318
12320 {
12321 if (!ctx.
Read(value))
12322 return false;
12324 }
12325
12327 {
12328 if (!ctx.
Read(intValue))
12329 return false;
12331 }
12332
12334 {
12335 int r,g,b,a;
12337 return false;
12339 return false;
12341 return false;
12343 return false;
12344
12346 }
12347
12349 {
12350 if (!ctx.
Read(intValue))
12351 return false;
12353 }
12354
12355 if (version >= 138 && version < 140)
12356 {
12358 {
12359 if (!ctx.
Read(intValue))
12360 return false;
12361 SetFrozen(intValue);
12362 }
12363 }
12364
12365 return true;
12366 }
12367
12368
12370 {
12373 {
12375 }
12376
12377 if (!super.OnStoreLoad(ctx, version))
12378 {
12380 return false;
12381 }
12382
12383 if (version >= 114)
12384 {
12385 bool hasQuickBarIndexSaved;
12386
12387 if (!ctx.
Read(hasQuickBarIndexSaved))
12388 {
12390 return false;
12391 }
12392
12393 if (hasQuickBarIndexSaved)
12394 {
12395 int itmQBIndex;
12396
12397
12398 if (!ctx.
Read(itmQBIndex))
12399 {
12401 return false;
12402 }
12403
12404 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12405 if (itmQBIndex != -1 && parentPlayer)
12406 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12407 }
12408 }
12409 else
12410 {
12411
12412 PlayerBase player;
12413 int itemQBIndex;
12414 if (version ==
int.
MAX)
12415 {
12416 if (!ctx.
Read(itemQBIndex))
12417 {
12419 return false;
12420 }
12421 }
12422 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12423 {
12424
12425 if (!ctx.
Read(itemQBIndex))
12426 {
12428 return false;
12429 }
12430 if (itemQBIndex != -1 && player)
12431 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12432 }
12433 }
12434
12435 if (version < 140)
12436 {
12437
12438 if (!LoadVariables(ctx, version))
12439 {
12441 return false;
12442 }
12443 }
12444
12445
12447 {
12449 return false;
12450 }
12451 if (version >= 132)
12452 {
12454 if (raib)
12455 {
12457 {
12459 return false;
12460 }
12461 }
12462 }
12463
12465 return true;
12466 }
12467
12468
12469
12471 {
12472 super.OnStoreSave(ctx);
12473
12474 PlayerBase player;
12475 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12476 {
12478
12479 int itemQBIndex = -1;
12480 itemQBIndex = player.FindQuickBarEntityIndex(this);
12481 ctx.
Write(itemQBIndex);
12482 }
12483 else
12484 {
12486 }
12487
12489
12491 if (raib)
12492 {
12494 }
12495 }
12496
12497
12499 {
12500 super.AfterStoreLoad();
12501
12503 {
12505 }
12506
12508 {
12511 }
12512 }
12513
12515 {
12516 super.EEOnAfterLoad();
12517
12519 {
12521 }
12522
12525 }
12526
12528 {
12529 return false;
12530 }
12531
12532
12533
12535 {
12537 {
12538 #ifdef PLATFORM_CONSOLE
12539
12541 {
12543 if (menu)
12544 {
12546 }
12547 }
12548 #endif
12549 }
12550
12552 {
12555 }
12556
12558 {
12559 SetWeightDirty();
12561 }
12563 {
12566 }
12567
12569 {
12572
12575 }
12577 {
12581 }
12582
12583 super.OnVariablesSynchronized();
12584 }
12585
12586
12587
12589 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12590 {
12591 if (!IsServerCheck(allow_client))
12592 return false;
12593
12595 return false;
12596
12599
12600 if (value <= (min + 0.001))
12601 value = min;
12602
12603 if (value == min)
12604 {
12605 if (destroy_config)
12606 {
12607 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12608 if (dstr)
12609 {
12611 this.Delete();
12612 return true;
12613 }
12614 }
12615 else if (destroy_forced)
12616 {
12618 this.Delete();
12619 return true;
12620 }
12621
12623 }
12624
12627
12629 {
12630 EntityAI parent = GetHierarchyRoot();
12631 InventoryLocation iLoc = new InventoryLocation();
12632 GetInventory().GetCurrentInventoryLocation(iLoc);
12634 {
12635 int iLocSlot = iLoc.
GetSlot();
12637 {
12639 }
12641 {
12643 }
12644 }
12645 }
12646
12648 {
12650
12651 if (delta)
12653 }
12654
12656
12657 return false;
12658 }
12659
12660
12662 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12663 {
12665 }
12666
12668 {
12671 }
12672
12674 {
12677 }
12678
12680 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12681 {
12682 float value_clamped = Math.Clamp(value, 0, 1);
12684 SetQuantity(result, destroy_config, destroy_forced);
12685 }
12686
12687
12690 {
12692 }
12693
12695 {
12697 }
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12709 {
12710 int slot = -1;
12711 GameInventory inventory = GetInventory();
12712 if (inventory)
12713 {
12714 InventoryLocation il = new InventoryLocation;
12717 }
12718
12720 }
12721
12723 {
12724 float quantity_max = 0;
12725
12727 {
12728 if (attSlotID != -1)
12729 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12730
12731 if (quantity_max <= 0)
12733 }
12734
12735 if (quantity_max <= 0)
12737
12738 return quantity_max;
12739 }
12740
12742 {
12744 }
12745
12747 {
12749 }
12750
12751
12753 {
12755 }
12756
12758 {
12760 }
12761
12763 {
12765 }
12766
12767
12769 {
12770
12771 float weightEx = GetWeightEx();
12772 float special = GetInventoryAndCargoWeight();
12773 return weightEx - special;
12774 }
12775
12776
12778 {
12780 }
12781
12783 {
12785 {
12786 #ifdef DEVELOPER
12787 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12788 {
12789 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12791 }
12792 #endif
12793
12794 return GetQuantity() * GetConfigWeightModified();
12795 }
12796 else if (HasEnergyManager())
12797 {
12798 #ifdef DEVELOPER
12799 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12800 {
12801 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12802 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12803 }
12804 #endif
12805 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12806 }
12807 else
12808 {
12809 #ifdef DEVELOPER
12810 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12811 {
12812 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12813 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12814 }
12815 #endif
12816 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12817 }
12818 }
12819
12822 {
12823 int item_count = 0;
12825
12826 GameInventory inventory = GetInventory();
12827 CargoBase cargo = inventory.
GetCargo();
12828 if (cargo != NULL)
12829 {
12831 }
12832
12834 for (int i = 0; i < nAttachments; ++i)
12835 {
12837 if (item)
12838 item_count += item.GetNumberOfItems();
12839 }
12840 return item_count;
12841 }
12842
12845 {
12846 float weight = 0;
12847 float wetness = 1;
12848 if (include_wetness)
12851 {
12852 weight = wetness * m_ConfigWeight;
12853 }
12855 {
12856 weight = 1;
12857 }
12858 return weight;
12859 }
12860
12861
12862
12864 {
12865 GameInventory inventory = GetInventory();
12866 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12867 {
12868 array<EntityAI> items = new array<EntityAI>;
12870 for (int i = 0; i < items.Count(); ++i)
12871 {
12873 if (item)
12874 {
12875 g_Game.ObjectDelete(item);
12876 }
12877 }
12878 }
12879 }
12880
12881
12882
12883
12885 {
12886 float energy = 0;
12887 if (HasEnergyManager())
12888 {
12889 energy = GetCompEM().GetEnergy();
12890 }
12891 return energy;
12892 }
12893
12894
12896 {
12897 super.OnEnergyConsumed();
12898
12900 }
12901
12903 {
12904 super.OnEnergyAdded();
12905
12907 }
12908
12909
12911 {
12912 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12913 {
12915 {
12916 float energy_0to1 = GetCompEM().GetEnergy0To1();
12918 }
12919 }
12920 }
12921
12922
12924 {
12925 return ConfigGetFloat("heatIsolation");
12926 }
12927
12929 {
12931 }
12932
12934 {
12935 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12936 if (
g_Game.ConfigIsExisting(paramPath))
12937 return g_Game.ConfigGetFloat(paramPath);
12938
12939 return 0.0;
12940 }
12941
12943 {
12944 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12945 if (
g_Game.ConfigIsExisting(paramPath))
12946 return g_Game.ConfigGetFloat(paramPath);
12947
12948 return 0.0;
12949 }
12950
12951 override void SetWet(
float value,
bool allow_client =
false)
12952 {
12953 if (!IsServerCheck(allow_client))
12954 return;
12955
12958
12960
12961 m_VarWet = Math.Clamp(value, min, max);
12962
12964 {
12967 }
12968 }
12969
12970 override void AddWet(
float value)
12971 {
12973 }
12974
12976 {
12978 }
12979
12981 {
12983 }
12984
12986 {
12988 }
12989
12991 {
12993 }
12994
12996 {
12998 }
12999
13000 override void OnWetChanged(
float newVal,
float oldVal)
13001 {
13004 if (newLevel != oldLevel)
13005 {
13007 }
13008 }
13009
13011 {
13012 SetWeightDirty();
13013 }
13014
13016 {
13017 return GetWetLevelInternal(
m_VarWet);
13018 }
13019
13020
13021
13023 {
13025 }
13026
13028 {
13030 }
13031
13033 {
13035 }
13036
13038 {
13040 }
13041
13042
13043
13045 {
13046 if (ConfigIsExisting("itemModelLength"))
13047 {
13048 return ConfigGetFloat("itemModelLength");
13049 }
13050 return 0;
13051 }
13052
13054 {
13055 if (ConfigIsExisting("itemAttachOffset"))
13056 {
13057 return ConfigGetFloat("itemAttachOffset");
13058 }
13059 return 0;
13060 }
13061
13062 override void SetCleanness(
int value,
bool allow_client =
false)
13063 {
13064 if (!IsServerCheck(allow_client))
13065 return;
13066
13068
13070
13073 }
13074
13076 {
13078 }
13079
13081 {
13082 return true;
13083 }
13084
13085
13086
13087
13089 {
13091 }
13092
13094 {
13096 }
13097
13098
13099
13100
13101 override void SetColor(
int r,
int g,
int b,
int a)
13102 {
13108 }
13110 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13111 {
13116 }
13117
13119 {
13121 }
13122
13125 {
13126 int r,g,b,a;
13128 r = r/255;
13129 g = g/255;
13130 b = b/255;
13131 a = a/255;
13132 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13133 }
13134
13135
13136
13137 override void SetLiquidType(
int value,
bool allow_client =
false)
13138 {
13139 if (!IsServerCheck(allow_client))
13140 return;
13141
13146 }
13147
13149 {
13150 return ConfigGetInt("varLiquidTypeInit");
13151 }
13152
13154 {
13156 }
13157
13159 {
13161 SetFrozen(false);
13162 }
13163
13166 {
13167 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13168 }
13169
13170
13173 {
13174 PlayerBase nplayer;
13175 if (PlayerBase.CastTo(nplayer, player))
13176 {
13178 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13179 }
13180 }
13181
13182
13185 {
13186 PlayerBase nplayer;
13187 if (PlayerBase.CastTo(nplayer,player))
13188 {
13189 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13190 }
13191
13192 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13193
13194 if (HasEnergyManager())
13195 {
13196 GetCompEM().UpdatePlugState();
13197 }
13198 }
13199
13200
13202 {
13203 super.OnPlacementStarted(player);
13204
13206 }
13207
13208 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13209 {
13211 {
13212 m_AdminLog.OnPlacementComplete(player,
this);
13213 }
13214
13215 super.OnPlacementComplete(player, position, orientation);
13216 }
13217
13218
13219
13220
13221
13223 {
13225 {
13226 return true;
13227 }
13228 else
13229 {
13230 return false;
13231 }
13232 }
13233
13234
13236 {
13238 {
13240 }
13241 }
13242
13243
13245 {
13247 }
13248
13250 {
13252 }
13253
13254 override void InsertAgent(
int agent,
float count = 1)
13255 {
13256 if (count < 1)
13257 return;
13258
13260 }
13261
13264 {
13266 }
13267
13268
13270 {
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
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13316 {
13318 return false;
13319 return true;
13320 }
13321
13323 {
13324
13326 }
13327
13328
13331 {
13332 super.CheckForRoofLimited(timeTresholdMS);
13333
13334 float time =
g_Game.GetTime();
13335 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13336 {
13337 m_PreviousRoofTestTime = time;
13338 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13339 }
13340 }
13341
13342
13344 {
13346 {
13347 return 0;
13348 }
13349
13350 if (GetInventory().GetAttachmentSlotsCount() != 0)
13351 {
13352 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13353 if (filter)
13354 return filter.GetProtectionLevel(type, false, system);
13355 else
13356 return 0;
13357 }
13358
13359 string subclassPath, entryName;
13360
13361 switch (type)
13362 {
13364 entryName = "biological";
13365 break;
13367 entryName = "chemical";
13368 break;
13369 default:
13370 entryName = "biological";
13371 break;
13372 }
13373
13374 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13375
13376 return g_Game.ConfigGetFloat(subclassPath + entryName);
13377 }
13378
13379
13380
13383 {
13384 if (!IsMagazine())
13386
13388 }
13389
13390
13391
13392
13393
13398 {
13399 return true;
13400 }
13401
13403 {
13405 }
13406
13407
13408
13409
13410
13412 {
13413 if (parent)
13414 {
13415 if (parent.IsInherited(DayZInfected))
13416 return true;
13417
13418 if (!parent.IsRuined())
13419 return true;
13420 }
13421
13422 return true;
13423 }
13424
13426 {
13427 if (!super.CanPutAsAttachment(parent))
13428 {
13429 return false;
13430 }
13431
13432 if (!IsRuined() && !parent.IsRuined())
13433 {
13434 return true;
13435 }
13436
13437 return false;
13438 }
13439
13441 {
13442
13443
13444
13445
13446 return super.CanReceiveItemIntoCargo(item);
13447 }
13448
13450 {
13451
13452
13453
13454
13455 GameInventory attachmentInv = attachment.GetInventory();
13457 {
13458 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13459 return false;
13460 }
13461
13462 InventoryLocation loc = new InventoryLocation();
13463 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13464 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13465 return false;
13466
13467 return super.CanReceiveAttachment(attachment, slotId);
13468 }
13469
13471 {
13472 if (!super.CanReleaseAttachment(attachment))
13473 return false;
13474
13475 return GetInventory().AreChildrenAccessible();
13476 }
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13499 {
13500 int id = muzzle_owner.GetMuzzleID();
13501 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13502
13503 if (WPOF_array)
13504 {
13505 for (int i = 0; i < WPOF_array.Count(); i++)
13506 {
13507 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13508
13509 if (WPOF)
13510 {
13511 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13512 }
13513 }
13514 }
13515 }
13516
13517
13519 {
13520 int id = muzzle_owner.GetMuzzleID();
13522
13523 if (WPOBE_array)
13524 {
13525 for (int i = 0; i < WPOBE_array.Count(); i++)
13526 {
13527 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13528
13529 if (WPOBE)
13530 {
13531 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13532 }
13533 }
13534 }
13535 }
13536
13537
13539 {
13540 int id = muzzle_owner.GetMuzzleID();
13541 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13542
13543 if (WPOOH_array)
13544 {
13545 for (int i = 0; i < WPOOH_array.Count(); i++)
13546 {
13547 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13548
13549 if (WPOOH)
13550 {
13551 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13552 }
13553 }
13554 }
13555 }
13556
13557
13559 {
13560 int id = muzzle_owner.GetMuzzleID();
13561 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13562
13563 if (WPOOH_array)
13564 {
13565 for (int i = 0; i < WPOOH_array.Count(); i++)
13566 {
13567 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13568
13569 if (WPOOH)
13570 {
13571 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13572 }
13573 }
13574 }
13575 }
13576
13577
13579 {
13580 int id = muzzle_owner.GetMuzzleID();
13581 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13582
13583 if (WPOOH_array)
13584 {
13585 for (int i = 0; i < WPOOH_array.Count(); i++)
13586 {
13587 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13588
13589 if (WPOOH)
13590 {
13591 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13592 }
13593 }
13594 }
13595 }
13596
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 {
13622 {
13623 return true;
13624 }
13625
13626 return false;
13627 }
13628
13630 {
13631 return false;
13632 }
13633
13636 {
13637 return UATimeSpent.DEFAULT_DEPLOY;
13638 }
13639
13640
13641
13642
13644 {
13646 SetSynchDirty();
13647 }
13648
13650 {
13652 }
13653
13654
13656 {
13657 return false;
13658 }
13659
13662 {
13663 string att_type = "None";
13664
13665 if (ConfigIsExisting("soundAttType"))
13666 {
13667 att_type = ConfigGetString("soundAttType");
13668 }
13669
13671 }
13672
13674 {
13676 }
13677
13678
13679
13680
13681
13687
13689 {
13692
13694 }
13695
13696
13698 {
13700 return;
13701
13703
13706
13709
13710 SoundParameters params = new SoundParameters();
13714 }
13715
13716
13718 {
13720 {
13723
13724 SetSynchDirty();
13725
13728 }
13729 }
13730
13732 {
13734 }
13735
13736
13738 {
13740 return;
13741
13743 SetSynchDirty();
13744
13747 }
13748
13750 {
13753 }
13754
13756 {
13758 }
13759
13760 void OnApply(PlayerBase player);
13761
13763 {
13764 return 1.0;
13765 };
13766
13768 {
13770 }
13771
13773 {
13775 }
13776
13778
13780 {
13781 SetDynamicPhysicsLifeTime(0.01);
13783 }
13784
13786 {
13787 array<string> zone_names = new array<string>;
13788 GetDamageZones(zone_names);
13789 for (int i = 0; i < zone_names.Count(); i++)
13790 {
13791 SetHealthMax(zone_names.Get(i),"Health");
13792 }
13793 SetHealthMax("","Health");
13794 }
13795
13798 {
13799 float global_health = GetHealth01("","Health");
13800 array<string> zones = new array<string>;
13801 GetDamageZones(zones);
13802
13803 for (int i = 0; i < zones.Count(); i++)
13804 {
13805 SetHealth01(zones.Get(i),"Health",global_health);
13806 }
13807 }
13808
13811 {
13812 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13813 }
13814
13816 {
13817 if (!hasRootAsPlayer)
13818 {
13819 if (refParentIB)
13820 {
13821
13822 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13823 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13824
13825 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13826 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13827
13830 }
13831 else
13832 {
13833
13836 }
13837 }
13838 }
13839
13841 {
13843 {
13844 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13845 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13846 {
13847 float heatPermCoef = 1.0;
13849 while (ent)
13850 {
13851 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13852 ent = ent.GetHierarchyParent();
13853 }
13854
13855 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13856 }
13857 }
13858 }
13859
13861 {
13862
13863 EntityAI parent = GetHierarchyParent();
13864 if (!parent)
13865 {
13866 hasParent = false;
13867 hasRootAsPlayer = false;
13868 }
13869 else
13870 {
13871 hasParent = true;
13872 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13873 refParentIB =
ItemBase.Cast(parent);
13874 }
13875 }
13876
13877 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13878 {
13879
13880 }
13881
13883 {
13884
13885 return false;
13886 }
13887
13889 {
13890
13891
13892 return false;
13893 }
13894
13896 {
13897
13898 return false;
13899 }
13900
13903 {
13904 return !GetIsFrozen() &&
IsOpen();
13905 }
13906
13908 {
13909 bool hasParent = false, hasRootAsPlayer = false;
13911
13912 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13913 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13914
13915 if (wwtu || foodDecay)
13916 {
13920
13921 if (processWetness || processTemperature || processDecay)
13922 {
13924
13925 if (processWetness)
13926 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13927
13928 if (processTemperature)
13930
13931 if (processDecay)
13932 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13933 }
13934 }
13935 }
13936
13939 {
13941 }
13942
13944 {
13947
13948 return super.GetTemperatureFreezeThreshold();
13949 }
13950
13952 {
13955
13956 return super.GetTemperatureThawThreshold();
13957 }
13958
13960 {
13963
13964 return super.GetItemOverheatThreshold();
13965 }
13966
13968 {
13970 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13971
13972 return super.GetTemperatureFreezeTime();
13973 }
13974
13976 {
13978 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13979
13980 return super.GetTemperatureThawTime();
13981 }
13982
13987
13989 {
13990 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13991 }
13992
13994 {
13995 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13996 }
13997
14000 {
14002 }
14003
14005 {
14007 }
14008
14010 {
14012 }
14013
14016 {
14017 return null;
14018 }
14019
14022 {
14023 return false;
14024 }
14025
14027 {
14029 {
14032 if (!trg)
14033 {
14035 explosive = this;
14036 }
14037
14038 explosive.PairRemote(trg);
14040
14041 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14042 trg.SetPersistentPairID(persistentID);
14043 explosive.SetPersistentPairID(persistentID);
14044
14045 return true;
14046 }
14047 return false;
14048 }
14049
14052 {
14053 float ret = 1.0;
14056 ret *= GetHealth01();
14057
14058 return ret;
14059 }
14060
14061 #ifdef DEVELOPER
14062 override void SetDebugItem()
14063 {
14064 super.SetDebugItem();
14065 _itemBase = this;
14066 }
14067
14069 {
14070 string text = super.GetDebugText();
14071
14073 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14074
14075 return text;
14076 }
14077 #endif
14078
14080 {
14081 return true;
14082 }
14083
14085
14087
14089 {
14092 }
14093
14094
14102
14118
14119 [
Obsolete(
"Use ItemSoundHandler instead")]
14122 {
14123 if (!
g_Game.IsDedicatedServer())
14124 {
14125 if (ConfigIsExisting("attachSoundSet"))
14126 {
14127 string cfg_path = "";
14128 string soundset = "";
14129 string type_name =
GetType();
14130
14133 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14134 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14135
14136 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14137 {
14138 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14139 {
14140 if (cfg_slot_array[i] == slot_type)
14141 {
14142 soundset = cfg_soundset_array[i];
14143 break;
14144 }
14145 }
14146 }
14147
14148 if (soundset != "")
14149 {
14150 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14152 }
14153 }
14154 }
14155 }
14156
14158}
14159
14161{
14163 if (entity)
14164 {
14165 bool is_item = entity.IsInherited(
ItemBase);
14166 if (is_item && full_quantity)
14167 {
14170 }
14171 }
14172 else
14173 {
14175 return NULL;
14176 }
14177 return entity;
14178}
14179
14181{
14182 if (item)
14183 {
14184 if (health > 0)
14185 item.SetHealth("", "", health);
14186
14187 if (item.CanHaveTemperature())
14188 {
14190 if (item.CanFreeze())
14191 item.SetFrozen(false);
14192 }
14193
14194 if (item.HasEnergyManager())
14195 {
14196 if (quantity >= 0)
14197 {
14198 item.GetCompEM().SetEnergy0To1(quantity);
14199 }
14200 else
14201 {
14203 }
14204 }
14205 else if (item.IsMagazine())
14206 {
14207 Magazine mag = Magazine.Cast(item);
14208 if (quantity >= 0)
14209 {
14210 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14211 }
14212 else
14213 {
14215 }
14216
14217 }
14218 else
14219 {
14220 if (quantity >= 0)
14221 {
14222 item.SetQuantityNormalized(quantity, false);
14223 }
14224 else
14225 {
14227 }
14228
14229 }
14230 }
14231}
14232
14233#ifdef DEVELOPER
14235#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.