Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
8818{
8820 {
8821 return true;
8822 }
8823};
8824
8826{
8827
8828};
8829
8830
8831
8833{
8837
8839
8842
8843
8844
8845
8846
8855
8861
8866
8871
8892 protected bool m_IsResultOfSplit
8893
8895
8900
8901
8902
8904
8908
8909
8910
8912
8915
8916
8917
8923
8924
8932
8935
8936
8938
8939
8941
8942
8947
8948
8953
8955
8956
8958
8959
8961 {
8966
8967 if (!
g_Game.IsDedicatedServer())
8968 {
8970 {
8972
8974 {
8976 }
8977 }
8978
8981 }
8982
8983 m_OldLocation = null;
8984
8986 {
8988 }
8989
8990 if (ConfigIsExisting("headSelectionsToHide"))
8991 {
8994 }
8995
8997 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8998 {
9000 }
9001
9003
9004 m_IsResultOfSplit = false;
9005
9007 }
9008
9010 {
9011 super.InitItemVariables();
9012
9018 m_Count = ConfigGetInt(
"count");
9019
9022
9027
9030
9035
9047
9051
9052
9055 if (ConfigIsExisting("canBeSplit"))
9056 {
9059 }
9060
9062 if (ConfigIsExisting("itemBehaviour"))
9064
9065
9068 RegisterNetSyncVariableInt("m_VarLiquidType");
9069 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9070
9071 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9072 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9073 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9074
9075 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9076 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9077 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9078 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9079
9080 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9081 RegisterNetSyncVariableBool("m_IsTakeable");
9082 RegisterNetSyncVariableBool("m_IsHologram");
9083
9086 {
9089 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9090 }
9091
9093
9095 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9097
9099 }
9100
9102 {
9104 }
9105
9107 {
9110 {
9115 }
9116 }
9117
9118 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9119 {
9121 {
9124 }
9125
9127 }
9128
9130 {
9136 }
9137
9139
9141 {
9143
9144 if (!action)
9145 {
9146 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9147 return;
9148 }
9149
9151 if (!ai)
9152 {
9154 return;
9155 }
9156
9158 if (!action_array)
9159 {
9160 action_array = new array<ActionBase_Basic>;
9162 }
9163 if (LogManager.IsActionLogEnable())
9164 {
9165 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9166 }
9167
9168 if (action_array.Find(action) != -1)
9169 {
9170 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9171 }
9172 else
9173 {
9174 action_array.Insert(action);
9175 }
9176 }
9177
9179 {
9180 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9181 ActionBase action = player.GetActionManager().GetAction(actionName);
9184
9185 if (action_array)
9186 {
9187 action_array.RemoveItem(action);
9188 }
9189 }
9190
9191
9192
9194 {
9195 ActionOverrideData overrideData = new ActionOverrideData();
9199
9201 if (!actionMap)
9202 {
9205 }
9206
9207 actionMap.Insert(this.
Type(), overrideData);
9208
9209 }
9210
9212
9214
9215
9217 {
9220
9223
9224 string config_to_search = "CfgVehicles";
9225 string muzzle_owner_config;
9226
9228 {
9229 if (IsInherited(Weapon))
9230 config_to_search = "CfgWeapons";
9231
9232 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9233
9234 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9235
9236 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9237
9238 if (config_OnFire_subclass_count > 0)
9239 {
9240 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9241
9242 for (int i = 0; i < config_OnFire_subclass_count; i++)
9243 {
9244 string particle_class = "";
9245 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9246 string config_OnFire_entry = config_OnFire_class + particle_class;
9247 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9248 WPOF_array.Insert(WPOF);
9249 }
9250
9251
9253 }
9254 }
9255
9257 {
9258 config_to_search = "CfgWeapons";
9259 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9260
9261 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9262
9263 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9264
9265 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9266 {
9267 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9268
9269 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9270 {
9271 string particle_class2 = "";
9272 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9273 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9274 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9275 WPOBE_array.Insert(WPOBE);
9276 }
9277
9278
9280 }
9281 }
9282 }
9283
9284
9286 {
9289
9291 {
9292 string config_to_search = "CfgVehicles";
9293
9294 if (IsInherited(Weapon))
9295 config_to_search = "CfgWeapons";
9296
9297 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9298 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9299
9300 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9301 {
9302
9304
9306 {
9308 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9310 return;
9311 }
9312
9315
9316
9317
9318 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9319 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9320
9321 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9322 {
9323 string particle_class = "";
9324 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9325 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9326 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9327
9328 if (entry_type == CT_CLASS)
9329 {
9330 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9331 WPOOH_array.Insert(WPOF);
9332 }
9333 }
9334
9335
9337 }
9338 }
9339 }
9340
9342 {
9344 }
9345
9347 {
9349 {
9351
9354
9357
9358 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9359 }
9360 }
9361
9363 {
9365 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9366
9368 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9369
9371 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9372
9374 {
9376 }
9377 }
9378
9380 {
9382 }
9383
9385 {
9388 else
9390
9392 {
9395 }
9396 else
9397 {
9400
9403 }
9404
9406 }
9407
9409 {
9411 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9412 }
9413
9415 {
9417 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9419 }
9420
9422 {
9424 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9425 }
9426
9428 {
9431
9432 OverheatingParticle OP = new OverheatingParticle();
9437
9439 }
9440
9442 {
9445
9446 return -1;
9447 }
9448
9450 {
9452 {
9455
9456 for (int i = count; i > 0; --i)
9457 {
9458 int id = i - 1;
9461
9464
9465 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9466 {
9467 if (p)
9468 {
9471 }
9472 }
9473 }
9474 }
9475 }
9476
9478 {
9480 {
9482 {
9483 int id = i - 1;
9485
9486 if (OP)
9487 {
9489
9490 if (p)
9491 {
9493 }
9494
9495 delete OP;
9496 }
9497 }
9498
9501 }
9502 }
9503
9506 {
9507 return 0.0;
9508 }
9509
9510
9512 {
9513 return 250;
9514 }
9515
9517 {
9518 return 0;
9519 }
9520
9523 {
9525 return true;
9526
9527 return false;
9528 }
9529
9532 {
9535
9537 {
9539 }
9540 else
9541 {
9542
9544 }
9545
9547 }
9548
9555 {
9556 return -1;
9557 }
9558
9559
9560
9561
9563 {
9565 {
9566 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9567 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9568
9569 if (r_index >= 0)
9570 {
9571 InventoryLocation r_il = new InventoryLocation;
9572 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9573
9574 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9577 {
9578 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9579 }
9581 {
9582 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9583 }
9584
9585 }
9586
9587 player.GetHumanInventory().ClearUserReservedLocation(this);
9588 }
9589
9592 }
9593
9594
9595
9596
9598 {
9599 return ItemBase.m_DebugActionsMask;
9600 }
9601
9603 {
9604 return ItemBase.m_DebugActionsMask & mask;
9605 }
9606
9608 {
9609 ItemBase.m_DebugActionsMask = mask;
9610 }
9611
9613 {
9614 ItemBase.m_DebugActionsMask |= mask;
9615 }
9616
9618 {
9619 ItemBase.m_DebugActionsMask &= ~mask;
9620 }
9621
9623 {
9625 {
9627 }
9628 else
9629 {
9631 }
9632 }
9633
9634
9636 {
9637 if (GetEconomyProfile())
9638 {
9639 float q_max = GetEconomyProfile().GetQuantityMax();
9640 if (q_max > 0)
9641 {
9642 float q_min = GetEconomyProfile().GetQuantityMin();
9643 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9644
9646 {
9647 ComponentEnergyManager comp = GetCompEM();
9649 {
9651 }
9652 }
9654 {
9656
9657 }
9658
9659 }
9660 }
9661 }
9662
9665 {
9666 EntityAI parent = GetHierarchyParent();
9667
9668 if (parent)
9669 {
9670 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9671 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9672 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9673 }
9674 }
9675
9678 {
9679 EntityAI parent = GetHierarchyParent();
9680
9681 if (parent)
9682 {
9683 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9684 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9685 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9686 }
9687 }
9688
9690 {
9691
9692
9693
9694
9696
9698 {
9699 if (ScriptInputUserData.CanStoreInputUserData())
9700 {
9701 ScriptInputUserData ctx = new ScriptInputUserData;
9707 ctx.
Write(use_stack_max);
9710
9712 {
9713 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9714 }
9715 }
9716 }
9717 else if (!
g_Game.IsMultiplayer())
9718 {
9720 }
9721 }
9722
9724 {
9726 }
9727
9729 {
9731 }
9732
9734 {
9736 }
9737
9739 {
9740
9741 return false;
9742 }
9743
9745 {
9746 return false;
9747 }
9748
9752 {
9753 return false;
9754 }
9755
9757 {
9758 return "";
9759 }
9760
9762
9764 {
9765 return false;
9766 }
9767
9769 {
9770 return true;
9771 }
9772
9773
9774
9776 {
9777 return true;
9778 }
9779
9781 {
9782 return true;
9783 }
9784
9786 {
9787 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9789 }
9790
9792 {
9794 }
9795
9797 {
9799 if (!is_being_placed)
9801 SetSynchDirty();
9802 }
9803
9804
9806
9808 {
9810 }
9811
9813 {
9815 }
9816
9818 {
9819 return 1;
9820 }
9821
9823 {
9824 return false;
9825 }
9826
9828 {
9830 SetSynchDirty();
9831 }
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9868 {
9869 super.OnMovedInsideCargo(container);
9870
9871 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9872 }
9873
9874 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9875 {
9876 super.EEItemLocationChanged(oldLoc, newLoc);
9877
9878 PlayerBase newPlayer = null;
9879 PlayerBase oldPlayer = null;
9880
9881 if (newLoc.GetParent())
9882 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9883
9884 if (oldLoc.GetParent())
9885 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9886
9888 {
9889 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9890
9891 if (rIndex >= 0)
9892 {
9893 InventoryLocation rIl = new InventoryLocation;
9894 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9895
9896 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9899 {
9900 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9901 }
9903 {
9905 }
9906
9907 }
9908 }
9909
9911 {
9912 if (newPlayer)
9913 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9914
9915 if (newPlayer == oldPlayer)
9916 {
9917 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9918 {
9920 {
9921 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9922 {
9923 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9924 }
9925 }
9926 else
9927 {
9928 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9929 }
9930 }
9931
9932 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9933 {
9934 int type = oldLoc.GetType();
9936 {
9937 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9938 }
9940 {
9941 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9942 }
9943 }
9944 if (!m_OldLocation)
9945 {
9946 m_OldLocation = new InventoryLocation;
9947 }
9948 m_OldLocation.Copy(oldLoc);
9949 }
9950 else
9951 {
9952 if (m_OldLocation)
9953 {
9954 m_OldLocation.Reset();
9955 }
9956 }
9957
9958 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9959 }
9960 else
9961 {
9962 if (newPlayer)
9963 {
9964 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9965 if (resIndex >= 0)
9966 {
9967 InventoryLocation il = new InventoryLocation;
9968 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9970 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9973 {
9974 il.
GetParent().GetOnReleaseLock().Invoke(it);
9975 }
9977 {
9979 }
9980
9981 }
9982 }
9984 {
9985
9987 }
9988
9989 if (m_OldLocation)
9990 {
9991 m_OldLocation.Reset();
9992 }
9993 }
9994
9996 {
9997 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9998 }
9999
10001 {
10002 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10003 }
10004 }
10005
10006 override void EOnContact(IEntity other, Contact extra)
10007 {
10009 {
10010 int liquidType = -1;
10012 if (impactSpeed > 0.0)
10013 {
10015 #ifndef SERVER
10017 #else
10019 SetSynchDirty();
10020 #endif
10022 }
10023 }
10024
10025 #ifdef SERVER
10026 if (GetCompEM() && GetCompEM().IsPlugged())
10027 {
10028 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10029 GetCompEM().UnplugThis();
10030 }
10031 #endif
10032 }
10033
10035
10037 {
10039 }
10040
10042 {
10043
10044 }
10045
10047 {
10048 super.OnItemLocationChanged(old_owner, new_owner);
10049
10050 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10051 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10052
10053 if (!relatedPlayer && playerNew)
10054 relatedPlayer = playerNew;
10055
10056 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10057 {
10059 if (actionMgr)
10060 {
10061 ActionBase currentAction = actionMgr.GetRunningAction();
10062 if (currentAction)
10064 }
10065 }
10066
10067 Man ownerPlayerOld = null;
10068 Man ownerPlayerNew = null;
10069
10070 if (old_owner)
10071 {
10072 if (old_owner.
IsMan())
10073 {
10074 ownerPlayerOld = Man.Cast(old_owner);
10075 }
10076 else
10077 {
10078 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10079 }
10080 }
10081 else
10082 {
10084 {
10086
10087 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10088 {
10089 GetCompEM().UnplugThis();
10090 }
10091 }
10092 }
10093
10094 if (new_owner)
10095 {
10096 if (new_owner.
IsMan())
10097 {
10098 ownerPlayerNew = Man.Cast(new_owner);
10099 }
10100 else
10101 {
10102 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10103 }
10104 }
10105
10106 if (ownerPlayerOld != ownerPlayerNew)
10107 {
10108 if (ownerPlayerOld)
10109 {
10110 array<EntityAI> subItemsExit = new array<EntityAI>;
10112 for (int i = 0; i < subItemsExit.Count(); i++)
10113 {
10116 }
10117 }
10118
10119 if (ownerPlayerNew)
10120 {
10121 array<EntityAI> subItemsEnter = new array<EntityAI>;
10123 for (int j = 0; j < subItemsEnter.Count(); j++)
10124 {
10127 }
10128 }
10129 }
10130 else if (ownerPlayerNew != null)
10131 {
10132 PlayerBase nplayer;
10133 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10134 {
10135 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10137 for (int k = 0; k < subItemsUpdate.Count(); k++)
10138 {
10140 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10141 }
10142 }
10143 }
10144
10145 if (old_owner)
10146 old_owner.OnChildItemRemoved(this);
10147 if (new_owner)
10148 new_owner.OnChildItemReceived(this);
10149 }
10150
10151
10153 {
10154 super.EEDelete(parent);
10155 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10156 if (player)
10157 {
10159
10160 if (player.IsAlive())
10161 {
10162 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10163 if (r_index >= 0)
10164 {
10165 InventoryLocation r_il = new InventoryLocation;
10166 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10167
10168 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10171 {
10172 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10173 }
10175 {
10176 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10177 }
10178
10179 }
10180
10181 player.RemoveQuickBarEntityShortcut(this);
10182 }
10183 }
10184 }
10185
10187 {
10188 super.EEKilled(killer);
10189
10192 {
10193 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10194 {
10195 if (IsMagazine())
10196 {
10197 if (Magazine.Cast(this).GetAmmoCount() > 0)
10198 {
10200 }
10201 }
10202 else
10203 {
10205 }
10206 }
10207 }
10208 }
10209
10211 {
10212 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10213
10214 super.OnWasAttached(parent, slot_id);
10215
10218
10221 }
10222
10224 {
10225 super.OnWasDetached(parent, slot_id);
10226
10229
10232 }
10233
10235 {
10236 int idx;
10239
10240 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10241 if (inventory_slots.Count() < 1)
10242 {
10243 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10244 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10245 }
10246 else
10247 {
10248 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10249 }
10250
10251 idx = inventory_slots.Find(slot);
10252 if (idx < 0)
10253 return "";
10254
10255 return attach_types.Get(idx);
10256 }
10257
10259 {
10260 int idx = -1;
10261 string slot;
10262
10265
10266 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10267 if (inventory_slots.Count() < 1)
10268 {
10269 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10270 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10271 }
10272 else
10273 {
10274 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10275 if (detach_types.Count() < 1)
10276 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10277 }
10278
10279 for (int i = 0; i < inventory_slots.Count(); i++)
10280 {
10281 slot = inventory_slots.Get(i);
10282 }
10283
10284 if (slot != "")
10285 {
10286 if (detach_types.Count() == 1)
10287 idx = 0;
10288 else
10289 idx = inventory_slots.Find(slot);
10290 }
10291 if (idx < 0)
10292 return "";
10293
10294 return detach_types.Get(idx);
10295 }
10296
10298 {
10299
10301
10302
10303 float min_time = 1;
10304 float max_time = 3;
10305 float delay = Math.RandomFloat(min_time, max_time);
10306
10307 explode_timer.Run(delay, this, "DoAmmoExplosion");
10308 }
10309
10311 {
10312 Magazine magazine = Magazine.Cast(this);
10313 int pop_sounds_count = 6;
10314 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10315
10316
10317 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10318 string sound_name = pop_sounds[ sound_idx ];
10319 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10320
10321
10322 magazine.ServerAddAmmoCount(-1);
10323
10324
10325 float min_temp_to_explode = 100;
10326
10327 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10328 {
10330 }
10331 }
10332
10333
10334 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10335 {
10336 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10337
10338 const int CHANCE_DAMAGE_CARGO = 4;
10339 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10340 const int CHANCE_DAMAGE_NOTHING = 2;
10341
10343 {
10344 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10345 int chances;
10346 int rnd;
10347
10348 if (GetInventory().GetCargo())
10349 {
10350 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10351 rnd = Math.RandomInt(0,chances);
10352
10353 if (rnd < CHANCE_DAMAGE_CARGO)
10354 {
10356 }
10357 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10358 {
10360 }
10361 }
10362 else
10363 {
10364 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10365 rnd = Math.RandomInt(0,chances);
10366
10367 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10368 {
10370 }
10371 }
10372 }
10373 }
10374
10376 {
10377 CargoBase cargo = GetInventory().GetCargo();
10378 if (cargo)
10379 {
10381 if (item_count > 0)
10382 {
10383 int random_pick = Math.RandomInt(0, item_count);
10385 if (!item.IsExplosive())
10386 {
10387 item.AddHealth("","",damage);
10388 return true;
10389 }
10390 }
10391 }
10392 return false;
10393 }
10394
10396 {
10397 GameInventory inventory = GetInventory();
10399 if (attachment_count > 0)
10400 {
10401 int random_pick = Math.RandomInt(0, attachment_count);
10403 if (!attachment.IsExplosive())
10404 {
10405 attachment.AddHealth("","",damage);
10406 return true;
10407 }
10408 }
10409 return false;
10410 }
10411
10413 {
10415 }
10416
10418 {
10420 return GetInventory().CanRemoveEntity();
10421
10422 return false;
10423 }
10424
10426 {
10427
10429 return false;
10430
10431
10433 return false;
10434
10435
10436
10438 if (delta == 0)
10439 return false;
10440
10441
10442 return true;
10443 }
10444
10446 {
10448 {
10449 if (ScriptInputUserData.CanStoreInputUserData())
10450 {
10451 ScriptInputUserData ctx = new ScriptInputUserData;
10456 ctx.
Write(destination_entity);
10458 ctx.
Write(slot_id);
10460 }
10461 }
10462 else if (!
g_Game.IsMultiplayer())
10463 {
10465 }
10466 }
10467
10469 {
10470 float split_quantity_new;
10474 InventoryLocation loc = new InventoryLocation;
10475
10476 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10477 {
10479 split_quantity_new = stack_max;
10480 else
10482
10484 {
10485 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10486 if (new_item)
10487 {
10488 new_item.SetResultOfSplit(true);
10489 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10491 new_item.
SetQuantity(split_quantity_new,
false,
true);
10492 }
10493 }
10494 }
10495 else if (destination_entity && slot_id == -1)
10496 {
10497 if (quantity > stack_max)
10498 split_quantity_new = stack_max;
10499 else
10500 split_quantity_new = quantity;
10501
10503 {
10504 GameInventory destinationInventory = destination_entity.GetInventory();
10506 {
10509 }
10510
10511 if (new_item)
10512 {
10513 new_item.SetResultOfSplit(true);
10514 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10516 new_item.
SetQuantity(split_quantity_new,
false,
true);
10517 }
10518 }
10519 }
10520 else
10521 {
10522 if (stack_max != 0)
10523 {
10525 {
10527 }
10528
10529 if (split_quantity_new == 0)
10530 {
10531 if (!
g_Game.IsMultiplayer())
10532 player.PhysicalPredictiveDropItem(this);
10533 else
10534 player.ServerDropEntity(this);
10535 return;
10536 }
10537
10539 {
10541
10542 if (new_item)
10543 {
10544 new_item.SetResultOfSplit(true);
10545 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10548 new_item.PlaceOnSurface();
10549 }
10550 }
10551 }
10552 }
10553 }
10554
10556 {
10557 float split_quantity_new;
10561 InventoryLocation loc = new InventoryLocation;
10562
10563 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10564 {
10566 split_quantity_new = stack_max;
10567 else
10569
10571 {
10572 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10573 if (new_item)
10574 {
10575 new_item.SetResultOfSplit(true);
10576 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10578 new_item.
SetQuantity(split_quantity_new,
false,
true);
10579 }
10580 }
10581 }
10582 else if (destination_entity && slot_id == -1)
10583 {
10584 if (quantity > stack_max)
10585 split_quantity_new = stack_max;
10586 else
10587 split_quantity_new = quantity;
10588
10590 {
10591 GameInventory destinationInventory = destination_entity.GetInventory();
10593 {
10596 }
10597
10598 if (new_item)
10599 {
10600 new_item.SetResultOfSplit(true);
10601 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10603 new_item.
SetQuantity(split_quantity_new,
false,
true);
10604 }
10605 }
10606 }
10607 else
10608 {
10609 if (stack_max != 0)
10610 {
10612 {
10614 }
10615
10617 {
10619
10620 if (new_item)
10621 {
10622 new_item.SetResultOfSplit(true);
10623 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10626 new_item.PlaceOnSurface();
10627 }
10628 }
10629 }
10630 }
10631 }
10632
10634 {
10636 {
10637 if (ScriptInputUserData.CanStoreInputUserData())
10638 {
10639 ScriptInputUserData ctx = new ScriptInputUserData;
10644 dst.WriteToContext(ctx);
10646 }
10647 }
10648 else if (!
g_Game.IsMultiplayer())
10649 {
10651 }
10652 }
10653
10655 {
10657 {
10658 if (ScriptInputUserData.CanStoreInputUserData())
10659 {
10660 ScriptInputUserData ctx = new ScriptInputUserData;
10665 ctx.
Write(destination_entity);
10671 }
10672 }
10673 else if (!
g_Game.IsMultiplayer())
10674 {
10676 }
10677 }
10678
10680 {
10682 }
10683
10685 {
10687 float split_quantity_new;
10689 if (dst.IsValid())
10690 {
10691 int slot_id = dst.GetSlot();
10693
10694 if (quantity > stack_max)
10695 split_quantity_new = stack_max;
10696 else
10697 split_quantity_new = quantity;
10698
10700 {
10702
10703 if (new_item)
10704 {
10705 new_item.SetResultOfSplit(true);
10706 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10708 new_item.
SetQuantity(split_quantity_new,
false,
true);
10709 }
10710
10711 return new_item;
10712 }
10713 }
10714
10715 return null;
10716 }
10717
10719 {
10721 float split_quantity_new;
10723 if (destination_entity)
10724 {
10726 if (quantity > stackable)
10727 split_quantity_new = stackable;
10728 else
10729 split_quantity_new = quantity;
10730
10732 {
10733 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10734 if (new_item)
10735 {
10736 new_item.SetResultOfSplit(true);
10737 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10739 new_item.
SetQuantity(split_quantity_new,
false,
true);
10740 }
10741 }
10742 }
10743 }
10744
10746 {
10748 {
10749 if (ScriptInputUserData.CanStoreInputUserData())
10750 {
10751 ScriptInputUserData ctx = new ScriptInputUserData;
10756 ItemBase destination_entity =
this;
10757 ctx.
Write(destination_entity);
10761 }
10762 }
10763 else if (!
g_Game.IsMultiplayer())
10764 {
10766 }
10767 }
10768
10770 {
10772 float split_quantity_new;
10774 if (player)
10775 {
10777 if (quantity > stackable)
10778 split_quantity_new = stackable;
10779 else
10780 split_quantity_new = quantity;
10781
10783 {
10784 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10785 new_item =
ItemBase.Cast(in_hands);
10786 if (new_item)
10787 {
10788 new_item.SetResultOfSplit(true);
10789 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10791 new_item.SetQuantity(split_quantity_new, false, true);
10792 }
10793 }
10794 }
10795 }
10796
10798 {
10800 float split_quantity_new = Math.Floor(quantity * 0.5);
10801
10803 return;
10804
10806
10807 if (new_item)
10808 {
10809 if (new_item.GetQuantityMax() < split_quantity_new)
10810 {
10811 split_quantity_new = new_item.GetQuantityMax();
10812 }
10813
10814 new_item.SetResultOfSplit(true);
10815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10816
10818 {
10821 }
10822 else
10823 {
10825 new_item.
SetQuantity(split_quantity_new,
false,
true);
10826 }
10827 }
10828 }
10829
10831 {
10833 float split_quantity_new = Math.Floor(quantity / 2);
10834
10836 return;
10837
10838 InventoryLocation invloc = new InventoryLocation;
10840
10842 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10843
10844 if (new_item)
10845 {
10846 if (new_item.GetQuantityMax() < split_quantity_new)
10847 {
10848 split_quantity_new = new_item.GetQuantityMax();
10849 }
10851 {
10854 }
10855 else if (split_quantity_new > 1)
10856 {
10858 new_item.
SetQuantity(split_quantity_new,
false,
true);
10859 }
10860 }
10861 }
10862
10865 {
10866 SetWeightDirty();
10868
10869 if (parent)
10870 parent.OnAttachmentQuantityChangedEx(this, delta);
10871
10873 {
10875 {
10877 }
10879 {
10880 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10882 }
10883 }
10884 }
10885
10888 {
10889
10890 }
10891
10894 {
10896 }
10897
10899 {
10900 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10901
10903 {
10904 if (newLevel == GameConstants.STATE_RUINED)
10905 {
10907 EntityAI parent = GetHierarchyParent();
10908 if (parent && parent.IsFireplace())
10909 {
10910 CargoBase cargo = GetInventory().GetCargo();
10911 if (cargo)
10912 {
10914 {
10916 }
10917 }
10918 }
10919 }
10920
10922 {
10923
10925 return;
10926 }
10927
10928 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10929 {
10931 }
10932 }
10933 }
10934
10935
10937 {
10938 super.OnRightClick();
10939
10941 {
10943 {
10944 if (ScriptInputUserData.CanStoreInputUserData())
10945 {
10946 EntityAI root = GetHierarchyRoot();
10947 Man playerOwner = GetHierarchyRootPlayer();
10948 InventoryLocation dst = new InventoryLocation;
10949
10950
10951 if (!playerOwner && root && root == this)
10952 {
10954 }
10955 else
10956 {
10957
10958 GetInventory().GetCurrentInventoryLocation(dst);
10960 {
10961 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10963 {
10965 }
10966 else
10967 {
10969
10970
10971 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10972 {
10974 }
10975 else
10976 {
10977 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10978 }
10979 }
10980 }
10981 }
10982
10983 ScriptInputUserData ctx = new ScriptInputUserData;
10991 }
10992 }
10993 else if (!
g_Game.IsMultiplayer())
10994 {
10996 }
10997 }
10998 }
10999
11001 {
11002 if (root)
11003 {
11004 vector m4[4];
11005 root.GetTransform(m4);
11006 dst.SetGround(this, m4);
11007 }
11008 else
11009 {
11010 GetInventory().GetCurrentInventoryLocation(dst);
11011 }
11012 }
11013
11014 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11015 {
11016
11017 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11018 return false;
11019
11020 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11021 return false;
11022
11023
11025 return false;
11026
11027
11028 Magazine mag = Magazine.Cast(this);
11029 if (mag)
11030 {
11031 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11032 return false;
11033
11034 if (stack_max_limit)
11035 {
11036 Magazine other_mag = Magazine.Cast(other_item);
11037 if (other_item)
11038 {
11039 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11040 return false;
11041 }
11042
11043 }
11044 }
11045 else
11046 {
11047
11049 return false;
11050
11052 return false;
11053 }
11054
11055 PlayerBase player = null;
11056 if (CastTo(player, GetHierarchyRootPlayer()))
11057 {
11058 if (player.GetInventory().HasAttachment(this))
11059 return false;
11060
11061 if (player.IsItemsToDelete())
11062 return false;
11063 }
11064
11065 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11066 return false;
11067
11068 int slotID;
11070 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11071 return false;
11072
11073 return true;
11074 }
11075
11077 {
11079 }
11080
11082 {
11083 return m_IsResultOfSplit;
11084 }
11085
11087 {
11088 m_IsResultOfSplit = value;
11089 }
11090
11092 {
11094 }
11095
11097 {
11098 float other_item_quantity = other_item.GetQuantity();
11099 float this_free_space;
11100
11102
11104
11105 if (other_item_quantity > this_free_space)
11106 {
11107 return this_free_space;
11108 }
11109 else
11110 {
11111 return other_item_quantity;
11112 }
11113 }
11114
11116 {
11118 }
11119
11121 {
11123 return;
11124
11125 if (!IsMagazine() && other_item)
11126 {
11128 if (quantity_used != 0)
11129 {
11130 float hp1 = GetHealth01("","");
11131 float hp2 = other_item.GetHealth01("","");
11132 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11133 hpResult = hpResult / (
GetQuantity() + quantity_used);
11134
11135 hpResult *= GetMaxHealth();
11136 Math.Round(hpResult);
11137 SetHealth("", "Health", hpResult);
11138
11140 other_item.AddQuantity(-quantity_used);
11141 }
11142 }
11144 }
11145
11147 {
11148 #ifdef SERVER
11149 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11150 GetHierarchyParent().IncreaseLifetimeUp();
11151 #endif
11152 };
11153
11155 {
11156 PlayerBase p = PlayerBase.Cast(player);
11157
11158 array<int> recipesIds = p.m_Recipes;
11159 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11160 if (moduleRecipesManager)
11161 {
11162 EntityAI itemInHands = player.GetEntityInHands();
11163 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11164 }
11165
11166 for (int i = 0;i < recipesIds.Count(); i++)
11167 {
11168 int key = recipesIds.Get(i);
11169 string recipeName = moduleRecipesManager.GetRecipeName(key);
11171 }
11172 }
11173
11174
11175 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11176 {
11177 super.GetDebugActions(outputList);
11178
11179
11185
11186
11191
11196
11197
11201
11202
11204 {
11208 }
11209
11212
11213
11217
11219
11220 InventoryLocation loc = new InventoryLocation();
11221 GetInventory().GetCurrentInventoryLocation(loc);
11223 {
11224 if (Gizmo_IsSupported())
11227 }
11228
11230 }
11231
11232
11233
11234
11236 {
11237 super.OnAction(action_id, player, ctx);
11238
11240 {
11241 switch (action_id)
11242 {
11246 return true;
11250 return true;
11251 }
11252 }
11253
11255 {
11256 switch (action_id)
11257 {
11259 Delete();
11260 return true;
11261 }
11262 }
11263
11264 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11265 {
11266 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11267 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11268 PlayerBase p = PlayerBase.Cast(player);
11269 if (
EActions.RECIPES_RANGE_START < 1000)
11270 {
11271 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11272 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11273 }
11274 }
11275 #ifndef SERVER
11276 else if (action_id ==
EActions.WATCH_PLAYER)
11277 {
11278 PluginDeveloper.SetDeveloperItemClientEx(player);
11279 }
11280 #endif
11282 {
11283 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11284 {
11285 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11286 OnDebugButtonPressServer(id + 1);
11287 }
11288
11289 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11290 {
11291 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11293 }
11294
11295 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11296 {
11297 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11299 }
11300
11301 else if (action_id ==
EActions.ADD_QUANTITY)
11302 {
11303 if (IsMagazine())
11304 {
11305 Magazine mag = Magazine.Cast(this);
11306 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11307 }
11308 else
11309 {
11311 }
11312
11313 if (m_EM)
11314 {
11315 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11316 }
11317
11318 }
11319
11320 else if (action_id ==
EActions.REMOVE_QUANTITY)
11321 {
11322 if (IsMagazine())
11323 {
11324 Magazine mag2 = Magazine.Cast(this);
11325 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11326 }
11327 else
11328 {
11330 }
11331 if (m_EM)
11332 {
11333 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11334 }
11335
11336 }
11337
11338 else if (action_id ==
EActions.SET_QUANTITY_0)
11339 {
11341
11342 if (m_EM)
11343 {
11344 m_EM.SetEnergy(0);
11345 }
11346 }
11347
11348 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11349 {
11351
11352 if (m_EM)
11353 {
11354 m_EM.SetEnergy(m_EM.GetEnergyMax());
11355 }
11356 }
11357
11358 else if (action_id ==
EActions.ADD_HEALTH)
11359 {
11360 AddHealth("","",GetMaxHealth("","Health")/5);
11361 }
11362 else if (action_id ==
EActions.REMOVE_HEALTH)
11363 {
11364 AddHealth("","",-GetMaxHealth("","Health")/5);
11365 }
11366 else if (action_id ==
EActions.DESTROY_HEALTH)
11367 {
11368 SetHealth01("","",0);
11369 }
11370 else if (action_id ==
EActions.WATCH_ITEM)
11371 {
11373 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11374 #ifdef DEVELOPER
11375 SetDebugDeveloper_item(this);
11376 #endif
11377 }
11378
11379 else if (action_id ==
EActions.ADD_TEMPERATURE)
11380 {
11381 AddTemperature(20);
11382
11383 }
11384
11385 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11386 {
11387 AddTemperature(-20);
11388
11389 }
11390
11391 else if (action_id ==
EActions.FLIP_FROZEN)
11392 {
11393 SetFrozen(!GetIsFrozen());
11394
11395 }
11396
11397 else if (action_id ==
EActions.ADD_WETNESS)
11398 {
11400
11401 }
11402
11403 else if (action_id ==
EActions.REMOVE_WETNESS)
11404 {
11406
11407 }
11408
11409 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11410 {
11413
11414
11415 }
11416
11417 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11418 {
11421 }
11422
11423 else if (action_id ==
EActions.MAKE_SPECIAL)
11424 {
11425 auto debugParams = DebugSpawnParams.WithPlayer(player);
11426 OnDebugSpawnEx(debugParams);
11427 }
11428
11429 }
11430
11431
11432 return false;
11433 }
11434
11435
11436
11437
11441
11444
11445
11446
11448 {
11449 return false;
11450 }
11451
11452
11454 {
11455 return true;
11456 }
11457
11458
11460 {
11461 return true;
11462 }
11463
11464
11465
11467 {
11468 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11469 return g_Game.ConfigIsExisting(config_path);
11470 }
11471
11474 {
11475 return null;
11476 }
11477
11479 {
11480 return false;
11481 }
11482
11484 {
11485 return false;
11486 }
11487
11491
11492
11494 {
11495 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11496 return module_repairing.CanRepair(this, item_repair_kit);
11497 }
11498
11499
11500 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11501 {
11502 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11503 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11504 }
11505
11506
11508 {
11509
11510
11511
11512
11513
11514
11515
11516
11517 return 1;
11518 }
11519
11520
11521
11523 {
11525 }
11526
11527
11528
11530 {
11532 }
11533
11534
11543 {
11544 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11545
11546 if (player)
11547 {
11548 player.MessageStatus(text);
11549 }
11550 }
11551
11552
11561 {
11562 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11563
11564 if (player)
11565 {
11566 player.MessageAction(text);
11567 }
11568 }
11569
11570
11579 {
11580 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11581
11582 if (player)
11583 {
11584 player.MessageFriendly(text);
11585 }
11586 }
11587
11588
11597 {
11598 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11599
11600 if (player)
11601 {
11602 player.MessageImportant(text);
11603 }
11604 }
11605
11607 {
11608 return true;
11609 }
11610
11611
11612 override bool KindOf(
string tag)
11613 {
11614 bool found = false;
11615 string item_name = this.
GetType();
11617 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11618
11619 int array_size = item_tag_array.Count();
11620 for (int i = 0; i < array_size; i++)
11621 {
11622 if (item_tag_array.Get(i) == tag)
11623 {
11624 found = true;
11625 break;
11626 }
11627 }
11628 return found;
11629 }
11630
11631
11633 {
11634
11635 super.OnRPC(sender, rpc_type,ctx);
11636
11637
11638 switch (rpc_type)
11639 {
11640 #ifndef SERVER
11641 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11642 Param2<bool, string> p = new Param2<bool, string>(false, "");
11643
11645 return;
11646
11647 bool play = p.param1;
11648 string soundSet = p.param2;
11649
11650 if (play)
11651 {
11653 {
11655 {
11657 }
11658 }
11659 else
11660 {
11662 }
11663 }
11664 else
11665 {
11667 }
11668
11669 break;
11670 #endif
11671
11672 }
11673
11675 {
11677 }
11678 }
11679
11680
11681
11682
11684 {
11685 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11686 return plugin.GetID(
name);
11687 }
11688
11690 {
11691 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11692 return plugin.GetName(id);
11693 }
11694
11697 {
11698
11699
11700 int varFlags;
11701 if (!ctx.
Read(varFlags))
11702 return;
11703
11704 if (varFlags & ItemVariableFlags.FLOAT)
11705 {
11707 }
11708 }
11709
11711 {
11712
11713 super.SerializeNumericalVars(floats_out);
11714
11715
11716
11718 {
11720 }
11721
11723 {
11725 }
11726
11728 {
11730 }
11731
11733 {
11738 }
11739
11741 {
11743 }
11744 }
11745
11747 {
11748
11749 super.DeSerializeNumericalVars(floats);
11750
11751
11752 int index = 0;
11753 int mask = Math.Round(floats.Get(index));
11754
11755 index++;
11756
11758 {
11760 {
11762 }
11763 else
11764 {
11765 float quantity = floats.Get(index);
11766 SetQuantity(quantity,
true,
false,
false,
false);
11767 }
11768 index++;
11769 }
11770
11772 {
11773 float wet = floats.Get(index);
11775 index++;
11776 }
11777
11779 {
11780 int liquidtype = Math.Round(floats.Get(index));
11782 index++;
11783 }
11784
11786 {
11788 index++;
11790 index++;
11792 index++;
11794 index++;
11795 }
11796
11798 {
11799 int cleanness = Math.Round(floats.Get(index));
11801 index++;
11802 }
11803 }
11804
11806 {
11807 super.WriteVarsToCTX(ctx);
11808
11809
11811 {
11813 }
11814
11816 {
11818 }
11819
11821 {
11823 }
11824
11826 {
11827 int r,g,b,a;
11833 }
11834
11836 {
11838 }
11839 }
11840
11842 {
11843 if (!super.ReadVarsFromCTX(ctx,version))
11844 return false;
11845
11846 int intValue;
11847 float value;
11848
11849 if (version < 140)
11850 {
11851 if (!ctx.
Read(intValue))
11852 return false;
11853
11854 m_VariablesMask = intValue;
11855 }
11856
11858 {
11859 if (!ctx.
Read(value))
11860 return false;
11861
11863 {
11865 }
11866 else
11867 {
11869 }
11870 }
11871
11872 if (version < 140)
11873 {
11875 {
11876 if (!ctx.
Read(value))
11877 return false;
11878 SetTemperatureDirect(value);
11879 }
11880 }
11881
11883 {
11884 if (!ctx.
Read(value))
11885 return false;
11887 }
11888
11890 {
11891 if (!ctx.
Read(intValue))
11892 return false;
11894 }
11895
11897 {
11898 int r,g,b,a;
11900 return false;
11902 return false;
11904 return false;
11906 return false;
11907
11909 }
11910
11912 {
11913 if (!ctx.
Read(intValue))
11914 return false;
11916 }
11917
11918 if (version >= 138 && version < 140)
11919 {
11921 {
11922 if (!ctx.
Read(intValue))
11923 return false;
11924 SetFrozen(intValue);
11925 }
11926 }
11927
11928 return true;
11929 }
11930
11931
11933 {
11936 {
11938 }
11939
11940 if (!super.OnStoreLoad(ctx, version))
11941 {
11943 return false;
11944 }
11945
11946 if (version >= 114)
11947 {
11948 bool hasQuickBarIndexSaved;
11949
11950 if (!ctx.
Read(hasQuickBarIndexSaved))
11951 {
11953 return false;
11954 }
11955
11956 if (hasQuickBarIndexSaved)
11957 {
11958 int itmQBIndex;
11959
11960
11961 if (!ctx.
Read(itmQBIndex))
11962 {
11964 return false;
11965 }
11966
11967 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11968 if (itmQBIndex != -1 && parentPlayer)
11969 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11970 }
11971 }
11972 else
11973 {
11974
11975 PlayerBase player;
11976 int itemQBIndex;
11977 if (version ==
int.
MAX)
11978 {
11979 if (!ctx.
Read(itemQBIndex))
11980 {
11982 return false;
11983 }
11984 }
11985 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11986 {
11987
11988 if (!ctx.
Read(itemQBIndex))
11989 {
11991 return false;
11992 }
11993 if (itemQBIndex != -1 && player)
11994 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11995 }
11996 }
11997
11998 if (version < 140)
11999 {
12000
12001 if (!LoadVariables(ctx, version))
12002 {
12004 return false;
12005 }
12006 }
12007
12008
12010 {
12012 return false;
12013 }
12014 if (version >= 132)
12015 {
12017 if (raib)
12018 {
12020 {
12022 return false;
12023 }
12024 }
12025 }
12026
12028 return true;
12029 }
12030
12031
12032
12034 {
12035 super.OnStoreSave(ctx);
12036
12037 PlayerBase player;
12038 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12039 {
12041
12042 int itemQBIndex = -1;
12043 itemQBIndex = player.FindQuickBarEntityIndex(this);
12044 ctx.
Write(itemQBIndex);
12045 }
12046 else
12047 {
12049 }
12050
12052
12054 if (raib)
12055 {
12057 }
12058 }
12059
12060
12062 {
12063 super.AfterStoreLoad();
12064
12066 {
12068 }
12069
12071 {
12074 }
12075 }
12076
12078 {
12079 super.EEOnAfterLoad();
12080
12082 {
12084 }
12085
12088 }
12089
12091 {
12092 return false;
12093 }
12094
12095
12096
12098 {
12100 {
12101 #ifdef PLATFORM_CONSOLE
12102
12104 {
12106 if (menu)
12107 {
12109 }
12110 }
12111 #endif
12112 }
12113
12115 {
12118 }
12119
12121 {
12122 SetWeightDirty();
12124 }
12126 {
12129 }
12130
12132 {
12135
12138 }
12140 {
12144 }
12145
12146 super.OnVariablesSynchronized();
12147 }
12148
12149
12150
12152 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12153 {
12154 if (!IsServerCheck(allow_client))
12155 return false;
12156
12158 return false;
12159
12162
12163 if (value <= (min + 0.001))
12164 value = min;
12165
12166 if (value == min)
12167 {
12168 if (destroy_config)
12169 {
12170 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12171 if (dstr)
12172 {
12174 this.Delete();
12175 return true;
12176 }
12177 }
12178 else if (destroy_forced)
12179 {
12181 this.Delete();
12182 return true;
12183 }
12184
12186 }
12187
12190
12192 {
12193 EntityAI parent = GetHierarchyRoot();
12194 InventoryLocation iLoc = new InventoryLocation();
12195 GetInventory().GetCurrentInventoryLocation(iLoc);
12197 {
12198 int iLocSlot = iLoc.
GetSlot();
12200 {
12202 }
12204 {
12206 }
12207 }
12208 }
12209
12211 {
12213
12214 if (delta)
12216 }
12217
12219
12220 return false;
12221 }
12222
12223
12225 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12226 {
12228 }
12229
12231 {
12234 }
12235
12237 {
12240 }
12241
12243 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12244 {
12245 float value_clamped = Math.Clamp(value, 0, 1);
12247 SetQuantity(result, destroy_config, destroy_forced);
12248 }
12249
12250
12253 {
12255 }
12256
12258 {
12260 }
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12272 {
12273 int slot = -1;
12274 GameInventory inventory = GetInventory();
12275 if (inventory)
12276 {
12277 InventoryLocation il = new InventoryLocation;
12280 }
12281
12283 }
12284
12286 {
12287 float quantity_max = 0;
12288
12290 {
12291 if (attSlotID != -1)
12292 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12293
12294 if (quantity_max <= 0)
12296 }
12297
12298 if (quantity_max <= 0)
12300
12301 return quantity_max;
12302 }
12303
12305 {
12307 }
12308
12310 {
12312 }
12313
12314
12316 {
12318 }
12319
12321 {
12323 }
12324
12326 {
12328 }
12329
12330
12332 {
12333
12334 float weightEx = GetWeightEx();
12335 float special = GetInventoryAndCargoWeight();
12336 return weightEx - special;
12337 }
12338
12339
12341 {
12343 }
12344
12346 {
12348 {
12349 #ifdef DEVELOPER
12350 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12351 {
12352 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12354 }
12355 #endif
12356
12357 return GetQuantity() * GetConfigWeightModified();
12358 }
12359 else if (HasEnergyManager())
12360 {
12361 #ifdef DEVELOPER
12362 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12363 {
12364 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12365 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12366 }
12367 #endif
12368 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12369 }
12370 else
12371 {
12372 #ifdef DEVELOPER
12373 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12374 {
12375 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12376 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12377 }
12378 #endif
12379 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12380 }
12381 }
12382
12385 {
12386 int item_count = 0;
12388
12389 GameInventory inventory = GetInventory();
12390 CargoBase cargo = inventory.
GetCargo();
12391 if (cargo != NULL)
12392 {
12394 }
12395
12397 for (int i = 0; i < nAttachments; ++i)
12398 {
12400 if (item)
12401 item_count += item.GetNumberOfItems();
12402 }
12403 return item_count;
12404 }
12405
12408 {
12409 float weight = 0;
12410 float wetness = 1;
12411 if (include_wetness)
12414 {
12415 weight = wetness * m_ConfigWeight;
12416 }
12418 {
12419 weight = 1;
12420 }
12421 return weight;
12422 }
12423
12424
12425
12427 {
12428 GameInventory inventory = GetInventory();
12429 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12430 {
12431 array<EntityAI> items = new array<EntityAI>;
12433 for (int i = 0; i < items.Count(); ++i)
12434 {
12436 if (item)
12437 {
12438 g_Game.ObjectDelete(item);
12439 }
12440 }
12441 }
12442 }
12443
12444
12445
12446
12448 {
12449 float energy = 0;
12450 if (HasEnergyManager())
12451 {
12452 energy = GetCompEM().GetEnergy();
12453 }
12454 return energy;
12455 }
12456
12457
12459 {
12460 super.OnEnergyConsumed();
12461
12463 }
12464
12466 {
12467 super.OnEnergyAdded();
12468
12470 }
12471
12472
12474 {
12475 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12476 {
12478 {
12479 float energy_0to1 = GetCompEM().GetEnergy0To1();
12481 }
12482 }
12483 }
12484
12485
12487 {
12488 return ConfigGetFloat("heatIsolation");
12489 }
12490
12492 {
12494 }
12495
12497 {
12498 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12499 if (
g_Game.ConfigIsExisting(paramPath))
12500 return g_Game.ConfigGetFloat(paramPath);
12501
12502 return 0.0;
12503 }
12504
12506 {
12507 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12508 if (
g_Game.ConfigIsExisting(paramPath))
12509 return g_Game.ConfigGetFloat(paramPath);
12510
12511 return 0.0;
12512 }
12513
12514 override void SetWet(
float value,
bool allow_client =
false)
12515 {
12516 if (!IsServerCheck(allow_client))
12517 return;
12518
12521
12523
12524 m_VarWet = Math.Clamp(value, min, max);
12525
12527 {
12530 }
12531 }
12532
12533 override void AddWet(
float value)
12534 {
12536 }
12537
12539 {
12541 }
12542
12544 {
12546 }
12547
12549 {
12551 }
12552
12554 {
12556 }
12557
12559 {
12561 }
12562
12563 override void OnWetChanged(
float newVal,
float oldVal)
12564 {
12567 if (newLevel != oldLevel)
12568 {
12570 }
12571 }
12572
12574 {
12575 SetWeightDirty();
12576 }
12577
12579 {
12580 return GetWetLevelInternal(
m_VarWet);
12581 }
12582
12583
12584
12586 {
12588 }
12589
12591 {
12593 }
12594
12596 {
12598 }
12599
12601 {
12603 }
12604
12605
12606
12608 {
12609 if (ConfigIsExisting("itemModelLength"))
12610 {
12611 return ConfigGetFloat("itemModelLength");
12612 }
12613 return 0;
12614 }
12615
12617 {
12618 if (ConfigIsExisting("itemAttachOffset"))
12619 {
12620 return ConfigGetFloat("itemAttachOffset");
12621 }
12622 return 0;
12623 }
12624
12625 override void SetCleanness(
int value,
bool allow_client =
false)
12626 {
12627 if (!IsServerCheck(allow_client))
12628 return;
12629
12631
12633
12636 }
12637
12639 {
12641 }
12642
12644 {
12645 return true;
12646 }
12647
12648
12649
12650
12652 {
12654 }
12655
12657 {
12659 }
12660
12661
12662
12663
12664 override void SetColor(
int r,
int g,
int b,
int a)
12665 {
12671 }
12673 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12674 {
12679 }
12680
12682 {
12684 }
12685
12688 {
12689 int r,g,b,a;
12691 r = r/255;
12692 g = g/255;
12693 b = b/255;
12694 a = a/255;
12695 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12696 }
12697
12698
12699
12700 override void SetLiquidType(
int value,
bool allow_client =
false)
12701 {
12702 if (!IsServerCheck(allow_client))
12703 return;
12704
12709 }
12710
12712 {
12713 return ConfigGetInt("varLiquidTypeInit");
12714 }
12715
12717 {
12719 }
12720
12722 {
12724 SetFrozen(false);
12725 }
12726
12729 {
12730 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12731 }
12732
12733
12736 {
12737 PlayerBase nplayer;
12738 if (PlayerBase.CastTo(nplayer, player))
12739 {
12741 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12742 }
12743 }
12744
12745
12748 {
12749 PlayerBase nplayer;
12750 if (PlayerBase.CastTo(nplayer,player))
12751 {
12752 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12753 }
12754
12755 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12756
12757 if (HasEnergyManager())
12758 {
12759 GetCompEM().UpdatePlugState();
12760 }
12761 }
12762
12763
12765 {
12766 super.OnPlacementStarted(player);
12767
12769 }
12770
12771 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12772 {
12774 {
12775 m_AdminLog.OnPlacementComplete(player,
this);
12776 }
12777
12778 super.OnPlacementComplete(player, position, orientation);
12779 }
12780
12781
12782
12783
12784
12786 {
12788 {
12789 return true;
12790 }
12791 else
12792 {
12793 return false;
12794 }
12795 }
12796
12797
12799 {
12801 {
12803 }
12804 }
12805
12806
12808 {
12810 }
12811
12813 {
12815 }
12816
12817 override void InsertAgent(
int agent,
float count = 1)
12818 {
12819 if (count < 1)
12820 return;
12821
12823 }
12824
12827 {
12829 }
12830
12831
12833 {
12835 }
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12879 {
12881 return false;
12882 return true;
12883 }
12884
12886 {
12887
12889 }
12890
12891
12894 {
12895 super.CheckForRoofLimited(timeTresholdMS);
12896
12897 float time =
g_Game.GetTime();
12898 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12899 {
12900 m_PreviousRoofTestTime = time;
12901 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12902 }
12903 }
12904
12905
12907 {
12909 {
12910 return 0;
12911 }
12912
12913 if (GetInventory().GetAttachmentSlotsCount() != 0)
12914 {
12915 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12916 if (filter)
12917 return filter.GetProtectionLevel(type, false, system);
12918 else
12919 return 0;
12920 }
12921
12922 string subclassPath, entryName;
12923
12924 switch (type)
12925 {
12927 entryName = "biological";
12928 break;
12930 entryName = "chemical";
12931 break;
12932 default:
12933 entryName = "biological";
12934 break;
12935 }
12936
12937 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12938
12939 return g_Game.ConfigGetFloat(subclassPath + entryName);
12940 }
12941
12942
12943
12946 {
12947 if (!IsMagazine())
12949
12951 }
12952
12953
12954
12955
12956
12961 {
12962 return true;
12963 }
12964
12966 {
12968 }
12969
12970
12971
12972
12973
12975 {
12976 if (parent)
12977 {
12978 if (parent.IsInherited(DayZInfected))
12979 return true;
12980
12981 if (!parent.IsRuined())
12982 return true;
12983 }
12984
12985 return true;
12986 }
12987
12989 {
12990 if (!super.CanPutAsAttachment(parent))
12991 {
12992 return false;
12993 }
12994
12995 if (!IsRuined() && !parent.IsRuined())
12996 {
12997 return true;
12998 }
12999
13000 return false;
13001 }
13002
13004 {
13005
13006
13007
13008
13009 return super.CanReceiveItemIntoCargo(item);
13010 }
13011
13013 {
13014
13015
13016
13017
13018 GameInventory attachmentInv = attachment.GetInventory();
13020 {
13021 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13022 return false;
13023 }
13024
13025 InventoryLocation loc = new InventoryLocation();
13026 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13027 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13028 return false;
13029
13030 return super.CanReceiveAttachment(attachment, slotId);
13031 }
13032
13034 {
13035 if (!super.CanReleaseAttachment(attachment))
13036 return false;
13037
13038 return GetInventory().AreChildrenAccessible();
13039 }
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13062 {
13063 int id = muzzle_owner.GetMuzzleID();
13064 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13065
13066 if (WPOF_array)
13067 {
13068 for (int i = 0; i < WPOF_array.Count(); i++)
13069 {
13070 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13071
13072 if (WPOF)
13073 {
13074 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13075 }
13076 }
13077 }
13078 }
13079
13080
13082 {
13083 int id = muzzle_owner.GetMuzzleID();
13085
13086 if (WPOBE_array)
13087 {
13088 for (int i = 0; i < WPOBE_array.Count(); i++)
13089 {
13090 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13091
13092 if (WPOBE)
13093 {
13094 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13095 }
13096 }
13097 }
13098 }
13099
13100
13102 {
13103 int id = muzzle_owner.GetMuzzleID();
13104 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13105
13106 if (WPOOH_array)
13107 {
13108 for (int i = 0; i < WPOOH_array.Count(); i++)
13109 {
13110 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13111
13112 if (WPOOH)
13113 {
13114 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13115 }
13116 }
13117 }
13118 }
13119
13120
13122 {
13123 int id = muzzle_owner.GetMuzzleID();
13124 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13125
13126 if (WPOOH_array)
13127 {
13128 for (int i = 0; i < WPOOH_array.Count(); i++)
13129 {
13130 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13131
13132 if (WPOOH)
13133 {
13134 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13135 }
13136 }
13137 }
13138 }
13139
13140
13142 {
13143 int id = muzzle_owner.GetMuzzleID();
13144 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13145
13146 if (WPOOH_array)
13147 {
13148 for (int i = 0; i < WPOOH_array.Count(); i++)
13149 {
13150 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13151
13152 if (WPOOH)
13153 {
13154 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13155 }
13156 }
13157 }
13158 }
13159
13160
13161
13163 {
13165 {
13166 return true;
13167 }
13168
13169 return false;
13170 }
13171
13173 {
13175 {
13176 return true;
13177 }
13178
13179 return false;
13180 }
13181
13183 {
13185 {
13186 return true;
13187 }
13188
13189 return false;
13190 }
13191
13193 {
13194 return false;
13195 }
13196
13199 {
13200 return UATimeSpent.DEFAULT_DEPLOY;
13201 }
13202
13203
13204
13205
13207 {
13209 SetSynchDirty();
13210 }
13211
13213 {
13215 }
13216
13217
13219 {
13220 return false;
13221 }
13222
13225 {
13226 string att_type = "None";
13227
13228 if (ConfigIsExisting("soundAttType"))
13229 {
13230 att_type = ConfigGetString("soundAttType");
13231 }
13232
13234 }
13235
13237 {
13239 }
13240
13241
13242
13243
13244
13250
13252 {
13255
13257 }
13258
13259
13261 {
13263 return;
13264
13266
13269
13272
13273 SoundParameters params = new SoundParameters();
13277 }
13278
13279
13281 {
13283 {
13286
13287 SetSynchDirty();
13288
13291 }
13292 }
13293
13295 {
13297 }
13298
13299
13301 {
13303 return;
13304
13306 SetSynchDirty();
13307
13310 }
13311
13313 {
13316 }
13317
13319 {
13321 }
13322
13323 void OnApply(PlayerBase player);
13324
13326 {
13327 return 1.0;
13328 };
13329
13331 {
13333 }
13334
13336 {
13338 }
13339
13341
13343 {
13344 SetDynamicPhysicsLifeTime(0.01);
13346 }
13347
13349 {
13350 array<string> zone_names = new array<string>;
13351 GetDamageZones(zone_names);
13352 for (int i = 0; i < zone_names.Count(); i++)
13353 {
13354 SetHealthMax(zone_names.Get(i),"Health");
13355 }
13356 SetHealthMax("","Health");
13357 }
13358
13361 {
13362 float global_health = GetHealth01("","Health");
13363 array<string> zones = new array<string>;
13364 GetDamageZones(zones);
13365
13366 for (int i = 0; i < zones.Count(); i++)
13367 {
13368 SetHealth01(zones.Get(i),"Health",global_health);
13369 }
13370 }
13371
13374 {
13375 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13376 }
13377
13379 {
13380 if (!hasRootAsPlayer)
13381 {
13382 if (refParentIB)
13383 {
13384
13385 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13386 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13387
13388 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13389 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13390
13393 }
13394 else
13395 {
13396
13399 }
13400 }
13401 }
13402
13404 {
13406 {
13407 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13408 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13409 {
13410 float heatPermCoef = 1.0;
13412 while (ent)
13413 {
13414 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13415 ent = ent.GetHierarchyParent();
13416 }
13417
13418 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13419 }
13420 }
13421 }
13422
13424 {
13425
13426 EntityAI parent = GetHierarchyParent();
13427 if (!parent)
13428 {
13429 hasParent = false;
13430 hasRootAsPlayer = false;
13431 }
13432 else
13433 {
13434 hasParent = true;
13435 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13436 refParentIB =
ItemBase.Cast(parent);
13437 }
13438 }
13439
13440 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13441 {
13442
13443 }
13444
13446 {
13447
13448 return false;
13449 }
13450
13452 {
13453
13454
13455 return false;
13456 }
13457
13459 {
13460
13461 return false;
13462 }
13463
13466 {
13467 return !GetIsFrozen() &&
IsOpen();
13468 }
13469
13471 {
13472 bool hasParent = false, hasRootAsPlayer = false;
13474
13475 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13476 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13477
13478 if (wwtu || foodDecay)
13479 {
13483
13484 if (processWetness || processTemperature || processDecay)
13485 {
13487
13488 if (processWetness)
13489 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13490
13491 if (processTemperature)
13493
13494 if (processDecay)
13495 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13496 }
13497 }
13498 }
13499
13502 {
13504 }
13505
13507 {
13510
13511 return super.GetTemperatureFreezeThreshold();
13512 }
13513
13515 {
13518
13519 return super.GetTemperatureThawThreshold();
13520 }
13521
13523 {
13526
13527 return super.GetItemOverheatThreshold();
13528 }
13529
13531 {
13533 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13534
13535 return super.GetTemperatureFreezeTime();
13536 }
13537
13539 {
13541 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13542
13543 return super.GetTemperatureThawTime();
13544 }
13545
13550
13552 {
13553 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13554 }
13555
13557 {
13558 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13559 }
13560
13563 {
13565 }
13566
13568 {
13570 }
13571
13573 {
13575 }
13576
13579 {
13580 return null;
13581 }
13582
13585 {
13586 return false;
13587 }
13588
13590 {
13592 {
13595 if (!trg)
13596 {
13598 explosive = this;
13599 }
13600
13601 explosive.PairRemote(trg);
13603
13604 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13605 trg.SetPersistentPairID(persistentID);
13606 explosive.SetPersistentPairID(persistentID);
13607
13608 return true;
13609 }
13610 return false;
13611 }
13612
13615 {
13616 float ret = 1.0;
13619 ret *= GetHealth01();
13620
13621 return ret;
13622 }
13623
13624 #ifdef DEVELOPER
13625 override void SetDebugItem()
13626 {
13627 super.SetDebugItem();
13628 _itemBase = this;
13629 }
13630
13632 {
13633 string text = super.GetDebugText();
13634
13636 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13637
13638 return text;
13639 }
13640 #endif
13641
13643 {
13644 return true;
13645 }
13646
13648
13650
13652 {
13655 }
13656
13657
13665
13681
13682 [
Obsolete(
"Use ItemSoundHandler instead")]
13685 {
13686 if (!
g_Game.IsDedicatedServer())
13687 {
13688 if (ConfigIsExisting("attachSoundSet"))
13689 {
13690 string cfg_path = "";
13691 string soundset = "";
13692 string type_name =
GetType();
13693
13696 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13697 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13698
13699 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13700 {
13701 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13702 {
13703 if (cfg_slot_array[i] == slot_type)
13704 {
13705 soundset = cfg_soundset_array[i];
13706 break;
13707 }
13708 }
13709 }
13710
13711 if (soundset != "")
13712 {
13713 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13715 }
13716 }
13717 }
13718 }
13719
13721}
13722
13724{
13726 if (entity)
13727 {
13728 bool is_item = entity.IsInherited(
ItemBase);
13729 if (is_item && full_quantity)
13730 {
13733 }
13734 }
13735 else
13736 {
13738 return NULL;
13739 }
13740 return entity;
13741}
13742
13744{
13745 if (item)
13746 {
13747 if (health > 0)
13748 item.SetHealth("", "", health);
13749
13750 if (item.CanHaveTemperature())
13751 {
13753 if (item.CanFreeze())
13754 item.SetFrozen(false);
13755 }
13756
13757 if (item.HasEnergyManager())
13758 {
13759 if (quantity >= 0)
13760 {
13761 item.GetCompEM().SetEnergy0To1(quantity);
13762 }
13763 else
13764 {
13766 }
13767 }
13768 else if (item.IsMagazine())
13769 {
13770 Magazine mag = Magazine.Cast(item);
13771 if (quantity >= 0)
13772 {
13773 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13774 }
13775 else
13776 {
13778 }
13779
13780 }
13781 else
13782 {
13783 if (quantity >= 0)
13784 {
13785 item.SetQuantityNormalized(quantity, false);
13786 }
13787 else
13788 {
13790 }
13791
13792 }
13793 }
13794}
13795
13796#ifdef DEVELOPER
13798#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.