8881{
8883 {
8884 return true;
8885 }
8886};
8887
8889{
8890
8891};
8892
8893
8894
8896{
8900
8902
8905
8906
8907
8908
8909
8918
8924
8929
8934
8955 protected bool m_IsResultOfSplit
8956
8958
8963
8964
8965
8967
8971
8972
8973
8975
8978
8979
8980
8986
8987
8995
8998
8999
9001
9002
9004
9005
9010
9011
9016
9018
9019
9021
9022
9024 {
9029
9030 if (!
g_Game.IsDedicatedServer())
9031 {
9033 {
9035
9037 {
9039 }
9040 }
9041
9044 }
9045
9046 m_OldLocation = null;
9047
9049 {
9051 }
9052
9053 if (ConfigIsExisting("headSelectionsToHide"))
9054 {
9057 }
9058
9060 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9061 {
9063 }
9064
9066
9067 m_IsResultOfSplit = false;
9068
9070 }
9071
9073 {
9074 super.InitItemVariables();
9075
9081 m_Count = ConfigGetInt(
"count");
9082
9085
9090
9093
9098
9110
9114
9115
9118 if (ConfigIsExisting("canBeSplit"))
9119 {
9122 }
9123
9125 if (ConfigIsExisting("itemBehaviour"))
9127
9128
9131 RegisterNetSyncVariableInt("m_VarLiquidType");
9132 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9133
9134 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9135 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9136 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9137
9138 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9139 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9140 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9141 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9142
9143 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9144 RegisterNetSyncVariableBool("m_IsTakeable");
9145 RegisterNetSyncVariableBool("m_IsHologram");
9146
9149 {
9152 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9153 }
9154
9156
9158 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9160
9162 }
9163
9165 {
9167 }
9168
9170 {
9173 {
9178 }
9179 }
9180
9181 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9182 {
9184 {
9187 }
9188
9190 }
9191
9193 {
9199 }
9200
9202
9204 {
9206
9207 if (!action)
9208 {
9209 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9210 return;
9211 }
9212
9214 if (!ai)
9215 {
9217 return;
9218 }
9219
9221 if (!action_array)
9222 {
9223 action_array = new array<ActionBase_Basic>;
9225 }
9226 if (LogManager.IsActionLogEnable())
9227 {
9228 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9229 }
9230
9231 if (action_array.Find(action) != -1)
9232 {
9233 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9234 }
9235 else
9236 {
9237 action_array.Insert(action);
9238 }
9239 }
9240
9242 {
9243 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9244 ActionBase action = player.GetActionManager().GetAction(actionName);
9247
9248 if (action_array)
9249 {
9250 action_array.RemoveItem(action);
9251 }
9252 }
9253
9254
9255
9257 {
9258 ActionOverrideData overrideData = new ActionOverrideData();
9262
9264 if (!actionMap)
9265 {
9268 }
9269
9270 actionMap.Insert(this.
Type(), overrideData);
9271
9272 }
9273
9275
9277
9278
9280 {
9283
9286
9287 string config_to_search = "CfgVehicles";
9288 string muzzle_owner_config;
9289
9291 {
9292 if (IsInherited(Weapon))
9293 config_to_search = "CfgWeapons";
9294
9295 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9296
9297 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9298
9299 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9300
9301 if (config_OnFire_subclass_count > 0)
9302 {
9303 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9304
9305 for (int i = 0; i < config_OnFire_subclass_count; i++)
9306 {
9307 string particle_class = "";
9308 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9309 string config_OnFire_entry = config_OnFire_class + particle_class;
9310 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9311 WPOF_array.Insert(WPOF);
9312 }
9313
9314
9316 }
9317 }
9318
9320 {
9321 config_to_search = "CfgWeapons";
9322 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9323
9324 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9325
9326 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9327
9328 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9329 {
9330 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9331
9332 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9333 {
9334 string particle_class2 = "";
9335 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9336 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9337 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9338 WPOBE_array.Insert(WPOBE);
9339 }
9340
9341
9343 }
9344 }
9345 }
9346
9347
9349 {
9352
9354 {
9355 string config_to_search = "CfgVehicles";
9356
9357 if (IsInherited(Weapon))
9358 config_to_search = "CfgWeapons";
9359
9360 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9361 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9362
9363 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9364 {
9365
9367
9369 {
9371 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9373 return;
9374 }
9375
9378
9379
9380
9381 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9382 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9383
9384 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9385 {
9386 string particle_class = "";
9387 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9388 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9389 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9390
9391 if (entry_type == CT_CLASS)
9392 {
9393 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9394 WPOOH_array.Insert(WPOF);
9395 }
9396 }
9397
9398
9400 }
9401 }
9402 }
9403
9405 {
9407 }
9408
9410 {
9412 {
9414
9417
9420
9421 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9422 }
9423 }
9424
9426 {
9428 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9429
9431 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9432
9434 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9435
9437 {
9439 }
9440 }
9441
9443 {
9445 }
9446
9448 {
9451 else
9453
9455 {
9458 }
9459 else
9460 {
9463
9466 }
9467
9469 }
9470
9472 {
9474 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9475 }
9476
9478 {
9480 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9482 }
9483
9485 {
9487 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9488 }
9489
9491 {
9494
9495 OverheatingParticle OP = new OverheatingParticle();
9500
9502 }
9503
9505 {
9508
9509 return -1;
9510 }
9511
9513 {
9515 {
9518
9519 for (int i = count; i > 0; --i)
9520 {
9521 int id = i - 1;
9524
9527
9528 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9529 {
9530 if (p)
9531 {
9534 }
9535 }
9536 }
9537 }
9538 }
9539
9541 {
9543 {
9545 {
9546 int id = i - 1;
9548
9549 if (OP)
9550 {
9552
9553 if (p)
9554 {
9556 }
9557
9558 delete OP;
9559 }
9560 }
9561
9564 }
9565 }
9566
9569 {
9570 return 0.0;
9571 }
9572
9573
9575 {
9576 return 250;
9577 }
9578
9580 {
9581 return 0;
9582 }
9583
9586 {
9588 return true;
9589
9590 return false;
9591 }
9592
9595 {
9598
9600 {
9602 }
9603 else
9604 {
9605
9607 }
9608
9610 }
9611
9618 {
9619 return -1;
9620 }
9621
9622
9623
9624
9626 {
9628 {
9629 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9630 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9631
9632 if (r_index >= 0)
9633 {
9634 InventoryLocation r_il = new InventoryLocation;
9635 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9636
9637 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9640 {
9641 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9642 }
9644 {
9645 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9646 }
9647
9648 }
9649
9650 player.GetHumanInventory().ClearUserReservedLocation(this);
9651 }
9652
9655 }
9656
9657
9658
9659
9661 {
9662 return ItemBase.m_DebugActionsMask;
9663 }
9664
9666 {
9667 return ItemBase.m_DebugActionsMask & mask;
9668 }
9669
9671 {
9672 ItemBase.m_DebugActionsMask = mask;
9673 }
9674
9676 {
9677 ItemBase.m_DebugActionsMask |= mask;
9678 }
9679
9681 {
9682 ItemBase.m_DebugActionsMask &= ~mask;
9683 }
9684
9686 {
9688 {
9690 }
9691 else
9692 {
9694 }
9695 }
9696
9697
9699 {
9700 if (GetEconomyProfile())
9701 {
9702 float q_max = GetEconomyProfile().GetQuantityMax();
9703 if (q_max > 0)
9704 {
9705 float q_min = GetEconomyProfile().GetQuantityMin();
9706 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9707
9709 {
9710 ComponentEnergyManager comp = GetCompEM();
9712 {
9714 }
9715 }
9717 {
9719
9720 }
9721
9722 }
9723 }
9724 }
9725
9728 {
9729 EntityAI parent = GetHierarchyParent();
9730
9731 if (parent)
9732 {
9733 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9734 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9735 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9736 }
9737 }
9738
9741 {
9742 EntityAI parent = GetHierarchyParent();
9743
9744 if (parent)
9745 {
9746 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9747 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9748 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9749 }
9750 }
9751
9753 {
9754
9755
9756
9757
9759
9761 {
9762 if (ScriptInputUserData.CanStoreInputUserData())
9763 {
9764 ScriptInputUserData ctx = new ScriptInputUserData;
9770 ctx.
Write(use_stack_max);
9773
9775 {
9776 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9777 }
9778 }
9779 }
9780 else if (!
g_Game.IsMultiplayer())
9781 {
9783 }
9784 }
9785
9787 {
9789 }
9790
9792 {
9794 }
9795
9797 {
9799 }
9800
9802 {
9803
9804 return false;
9805 }
9806
9808 {
9809 return false;
9810 }
9811
9815 {
9816 return false;
9817 }
9818
9820 {
9821 return "";
9822 }
9823
9825
9827 {
9828 return false;
9829 }
9830
9832 {
9833 return true;
9834 }
9835
9836
9837
9839 {
9840 return true;
9841 }
9842
9844 {
9845 return true;
9846 }
9847
9849 {
9850 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9852 }
9853
9855 {
9857 }
9858
9860 {
9862 if (!is_being_placed)
9864 SetSynchDirty();
9865 }
9866
9867
9869
9871 {
9873 }
9874
9876 {
9878 }
9879
9881 {
9882 return 1;
9883 }
9884
9886 {
9887 return false;
9888 }
9889
9891 {
9893 SetSynchDirty();
9894 }
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9931 {
9932 super.OnMovedInsideCargo(container);
9933
9934 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9935 }
9936
9937 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9938 {
9939 super.EEItemLocationChanged(oldLoc, newLoc);
9940
9941 PlayerBase newPlayer = null;
9942 PlayerBase oldPlayer = null;
9943
9944 if (newLoc.GetParent())
9945 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9946
9947 if (oldLoc.GetParent())
9948 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9949
9951 {
9952 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9953
9954 if (rIndex >= 0)
9955 {
9956 InventoryLocation rIl = new InventoryLocation;
9957 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9958
9959 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9962 {
9963 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9964 }
9966 {
9968 }
9969
9970 }
9971 }
9972
9974 {
9975 if (newPlayer)
9976 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9977
9978 if (newPlayer == oldPlayer)
9979 {
9980 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9981 {
9983 {
9984 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9985 {
9986 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9987 }
9988 }
9989 else
9990 {
9991 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9992 }
9993 }
9994
9995 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9996 {
9997 int type = oldLoc.GetType();
9999 {
10000 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10001 }
10003 {
10004 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10005 }
10006 }
10007 if (!m_OldLocation)
10008 {
10009 m_OldLocation = new InventoryLocation;
10010 }
10011 m_OldLocation.Copy(oldLoc);
10012 }
10013 else
10014 {
10015 if (m_OldLocation)
10016 {
10017 m_OldLocation.Reset();
10018 }
10019 }
10020
10021 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10022 }
10023 else
10024 {
10025 if (newPlayer)
10026 {
10027 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10028 if (resIndex >= 0)
10029 {
10030 InventoryLocation il = new InventoryLocation;
10031 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10033 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10036 {
10037 il.
GetParent().GetOnReleaseLock().Invoke(it);
10038 }
10040 {
10042 }
10043
10044 }
10045 }
10047 {
10048
10050 }
10051
10052 if (m_OldLocation)
10053 {
10054 m_OldLocation.Reset();
10055 }
10056 }
10057
10059 {
10060 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10061 }
10062
10064 {
10065 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10066 }
10067 }
10068
10069 override void EOnContact(IEntity other, Contact extra)
10070 {
10072 {
10073 int liquidType = -1;
10075 if (impactSpeed > 0.0)
10076 {
10078 #ifndef SERVER
10080 #else
10082 SetSynchDirty();
10083 #endif
10085 }
10086 }
10087
10088 #ifdef SERVER
10089 if (GetCompEM() && GetCompEM().IsPlugged())
10090 {
10091 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10092 GetCompEM().UnplugThis();
10093 }
10094 #endif
10095 }
10096
10098
10100 {
10102 }
10103
10105 {
10106
10107 }
10108
10110 {
10111 super.OnItemLocationChanged(old_owner, new_owner);
10112
10113 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10114 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10115
10116 if (!relatedPlayer && playerNew)
10117 relatedPlayer = playerNew;
10118
10119 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10120 {
10122 if (actionMgr)
10123 {
10124 ActionBase currentAction = actionMgr.GetRunningAction();
10125 if (currentAction)
10127 }
10128 }
10129
10130 Man ownerPlayerOld = null;
10131 Man ownerPlayerNew = null;
10132
10133 if (old_owner)
10134 {
10135 if (old_owner.
IsMan())
10136 {
10137 ownerPlayerOld = Man.Cast(old_owner);
10138 }
10139 else
10140 {
10141 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10142 }
10143 }
10144 else
10145 {
10147 {
10149
10150 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10151 {
10152 GetCompEM().UnplugThis();
10153 }
10154 }
10155 }
10156
10157 if (new_owner)
10158 {
10159 if (new_owner.
IsMan())
10160 {
10161 ownerPlayerNew = Man.Cast(new_owner);
10162 }
10163 else
10164 {
10165 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10166 }
10167 }
10168
10169 if (ownerPlayerOld != ownerPlayerNew)
10170 {
10171 if (ownerPlayerOld)
10172 {
10173 array<EntityAI> subItemsExit = new array<EntityAI>;
10175 for (int i = 0; i < subItemsExit.Count(); i++)
10176 {
10179 }
10180 }
10181
10182 if (ownerPlayerNew)
10183 {
10184 array<EntityAI> subItemsEnter = new array<EntityAI>;
10186 for (int j = 0; j < subItemsEnter.Count(); j++)
10187 {
10190 }
10191 }
10192 }
10193 else if (ownerPlayerNew != null)
10194 {
10195 PlayerBase nplayer;
10196 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10197 {
10198 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10200 for (int k = 0; k < subItemsUpdate.Count(); k++)
10201 {
10203 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10204 }
10205 }
10206 }
10207
10208 if (old_owner)
10209 old_owner.OnChildItemRemoved(this);
10210 if (new_owner)
10211 new_owner.OnChildItemReceived(this);
10212 }
10213
10214
10216 {
10217 super.EEDelete(parent);
10218 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10219 if (player)
10220 {
10222
10223 if (player.IsAlive())
10224 {
10225 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10226 if (r_index >= 0)
10227 {
10228 InventoryLocation r_il = new InventoryLocation;
10229 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10230
10231 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10234 {
10235 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10236 }
10238 {
10239 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10240 }
10241
10242 }
10243
10244 player.RemoveQuickBarEntityShortcut(this);
10245 }
10246 }
10247 }
10248
10250 {
10251 super.EEKilled(killer);
10252
10255 {
10256 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10257 {
10258 if (IsMagazine())
10259 {
10260 if (Magazine.Cast(this).GetAmmoCount() > 0)
10261 {
10263 }
10264 }
10265 else
10266 {
10268 }
10269 }
10270 }
10271 }
10272
10274 {
10275 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10276
10277 super.OnWasAttached(parent, slot_id);
10278
10281
10284 }
10285
10287 {
10288 super.OnWasDetached(parent, slot_id);
10289
10292
10295 }
10296
10298 {
10299 int idx;
10302
10303 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10304 if (inventory_slots.Count() < 1)
10305 {
10306 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10307 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10308 }
10309 else
10310 {
10311 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10312 }
10313
10314 idx = inventory_slots.Find(slot);
10315 if (idx < 0)
10316 return "";
10317
10318 return attach_types.Get(idx);
10319 }
10320
10322 {
10323 int idx = -1;
10324 string slot;
10325
10328
10329 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10330 if (inventory_slots.Count() < 1)
10331 {
10332 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10333 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10334 }
10335 else
10336 {
10337 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10338 if (detach_types.Count() < 1)
10339 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10340 }
10341
10342 for (int i = 0; i < inventory_slots.Count(); i++)
10343 {
10344 slot = inventory_slots.Get(i);
10345 }
10346
10347 if (slot != "")
10348 {
10349 if (detach_types.Count() == 1)
10350 idx = 0;
10351 else
10352 idx = inventory_slots.Find(slot);
10353 }
10354 if (idx < 0)
10355 return "";
10356
10357 return detach_types.Get(idx);
10358 }
10359
10361 {
10362
10364
10365
10366 float min_time = 1;
10367 float max_time = 3;
10368 float delay = Math.RandomFloat(min_time, max_time);
10369
10370 explode_timer.Run(delay, this, "DoAmmoExplosion");
10371 }
10372
10374 {
10375 Magazine magazine = Magazine.Cast(this);
10376 int pop_sounds_count = 6;
10377 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10378
10379
10380 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10381 string sound_name = pop_sounds[ sound_idx ];
10382 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10383
10384
10385 magazine.ServerAddAmmoCount(-1);
10386
10387
10388 float min_temp_to_explode = 100;
10389
10390 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10391 {
10393 }
10394 }
10395
10396
10397 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10398 {
10399 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10400
10401 const int CHANCE_DAMAGE_CARGO = 4;
10402 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10403 const int CHANCE_DAMAGE_NOTHING = 2;
10404
10406 {
10407 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10408 int chances;
10409 int rnd;
10410
10411 if (GetInventory().GetCargo())
10412 {
10413 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10414 rnd = Math.RandomInt(0,chances);
10415
10416 if (rnd < CHANCE_DAMAGE_CARGO)
10417 {
10419 }
10420 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10421 {
10423 }
10424 }
10425 else
10426 {
10427 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10428 rnd = Math.RandomInt(0,chances);
10429
10430 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10431 {
10433 }
10434 }
10435 }
10436 }
10437
10439 {
10440 CargoBase cargo = GetInventory().GetCargo();
10441 if (cargo)
10442 {
10444 if (item_count > 0)
10445 {
10446 int random_pick = Math.RandomInt(0, item_count);
10448 if (!item.IsExplosive())
10449 {
10450 item.AddHealth("","",damage);
10451 return true;
10452 }
10453 }
10454 }
10455 return false;
10456 }
10457
10459 {
10460 GameInventory inventory = GetInventory();
10462 if (attachment_count > 0)
10463 {
10464 int random_pick = Math.RandomInt(0, attachment_count);
10466 if (!attachment.IsExplosive())
10467 {
10468 attachment.AddHealth("","",damage);
10469 return true;
10470 }
10471 }
10472 return false;
10473 }
10474
10476 {
10478 }
10479
10481 {
10483 return GetInventory().CanRemoveEntity();
10484
10485 return false;
10486 }
10487
10489 {
10490
10492 return false;
10493
10494
10496 return false;
10497
10498
10499
10501 if (delta == 0)
10502 return false;
10503
10504
10505 return true;
10506 }
10507
10509 {
10511 {
10512 if (ScriptInputUserData.CanStoreInputUserData())
10513 {
10514 ScriptInputUserData ctx = new ScriptInputUserData;
10519 ctx.
Write(destination_entity);
10521 ctx.
Write(slot_id);
10523 }
10524 }
10525 else if (!
g_Game.IsMultiplayer())
10526 {
10528 }
10529 }
10530
10532 {
10533 float split_quantity_new;
10537 InventoryLocation loc = new InventoryLocation;
10538
10539 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10540 {
10542 split_quantity_new = stack_max;
10543 else
10545
10547 {
10548 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10549 if (new_item)
10550 {
10551 new_item.SetResultOfSplit(true);
10552 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10554 new_item.
SetQuantity(split_quantity_new,
false,
true);
10555 }
10556 }
10557 }
10558 else if (destination_entity && slot_id == -1)
10559 {
10560 if (quantity > stack_max)
10561 split_quantity_new = stack_max;
10562 else
10563 split_quantity_new = quantity;
10564
10566 {
10567 GameInventory destinationInventory = destination_entity.GetInventory();
10569 {
10572 }
10573
10574 if (new_item)
10575 {
10576 new_item.SetResultOfSplit(true);
10577 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10579 new_item.
SetQuantity(split_quantity_new,
false,
true);
10580 }
10581 }
10582 }
10583 else
10584 {
10585 if (stack_max != 0)
10586 {
10588 {
10590 }
10591
10592 if (split_quantity_new == 0)
10593 {
10594 if (!
g_Game.IsMultiplayer())
10595 player.PhysicalPredictiveDropItem(this);
10596 else
10597 player.ServerDropEntity(this);
10598 return;
10599 }
10600
10602 {
10604
10605 if (new_item)
10606 {
10607 new_item.SetResultOfSplit(true);
10608 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10611 new_item.PlaceOnSurface();
10612 }
10613 }
10614 }
10615 }
10616 }
10617
10619 {
10620 float split_quantity_new;
10624 InventoryLocation loc = new InventoryLocation;
10625
10626 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10627 {
10629 split_quantity_new = stack_max;
10630 else
10632
10634 {
10635 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10636 if (new_item)
10637 {
10638 new_item.SetResultOfSplit(true);
10639 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10641 new_item.
SetQuantity(split_quantity_new,
false,
true);
10642 }
10643 }
10644 }
10645 else if (destination_entity && slot_id == -1)
10646 {
10647 if (quantity > stack_max)
10648 split_quantity_new = stack_max;
10649 else
10650 split_quantity_new = quantity;
10651
10653 {
10654 GameInventory destinationInventory = destination_entity.GetInventory();
10656 {
10659 }
10660
10661 if (new_item)
10662 {
10663 new_item.SetResultOfSplit(true);
10664 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10666 new_item.
SetQuantity(split_quantity_new,
false,
true);
10667 }
10668 }
10669 }
10670 else
10671 {
10672 if (stack_max != 0)
10673 {
10675 {
10677 }
10678
10680 {
10682
10683 if (new_item)
10684 {
10685 new_item.SetResultOfSplit(true);
10686 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10689 new_item.PlaceOnSurface();
10690 }
10691 }
10692 }
10693 }
10694 }
10695
10697 {
10699 {
10700 if (ScriptInputUserData.CanStoreInputUserData())
10701 {
10702 ScriptInputUserData ctx = new ScriptInputUserData;
10707 dst.WriteToContext(ctx);
10709 }
10710 }
10711 else if (!
g_Game.IsMultiplayer())
10712 {
10714 }
10715 }
10716
10718 {
10720 {
10721 if (ScriptInputUserData.CanStoreInputUserData())
10722 {
10723 ScriptInputUserData ctx = new ScriptInputUserData;
10728 ctx.
Write(destination_entity);
10734 }
10735 }
10736 else if (!
g_Game.IsMultiplayer())
10737 {
10739 }
10740 }
10741
10743 {
10745 }
10746
10748 {
10750 float split_quantity_new;
10752 if (dst.IsValid())
10753 {
10754 int slot_id = dst.GetSlot();
10756
10757 if (quantity > stack_max)
10758 split_quantity_new = stack_max;
10759 else
10760 split_quantity_new = quantity;
10761
10763 {
10765
10766 if (new_item)
10767 {
10768 new_item.SetResultOfSplit(true);
10769 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10771 new_item.
SetQuantity(split_quantity_new,
false,
true);
10772 }
10773
10774 return new_item;
10775 }
10776 }
10777
10778 return null;
10779 }
10780
10782 {
10784 float split_quantity_new;
10786 if (destination_entity)
10787 {
10789 if (quantity > stackable)
10790 split_quantity_new = stackable;
10791 else
10792 split_quantity_new = quantity;
10793
10795 {
10796 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10797 if (new_item)
10798 {
10799 new_item.SetResultOfSplit(true);
10800 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10802 new_item.
SetQuantity(split_quantity_new,
false,
true);
10803 }
10804 }
10805 }
10806 }
10807
10809 {
10811 {
10812 if (ScriptInputUserData.CanStoreInputUserData())
10813 {
10814 ScriptInputUserData ctx = new ScriptInputUserData;
10819 ItemBase destination_entity =
this;
10820 ctx.
Write(destination_entity);
10824 }
10825 }
10826 else if (!
g_Game.IsMultiplayer())
10827 {
10829 }
10830 }
10831
10833 {
10835 float split_quantity_new;
10837 if (player)
10838 {
10840 if (quantity > stackable)
10841 split_quantity_new = stackable;
10842 else
10843 split_quantity_new = quantity;
10844
10846 {
10847 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10848 new_item =
ItemBase.Cast(in_hands);
10849 if (new_item)
10850 {
10851 new_item.SetResultOfSplit(true);
10852 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10854 new_item.SetQuantity(split_quantity_new, false, true);
10855 }
10856 }
10857 }
10858 }
10859
10861 {
10863 float split_quantity_new = Math.Floor(quantity * 0.5);
10864
10866 return;
10867
10869
10870 if (new_item)
10871 {
10872 if (new_item.GetQuantityMax() < split_quantity_new)
10873 {
10874 split_quantity_new = new_item.GetQuantityMax();
10875 }
10876
10877 new_item.SetResultOfSplit(true);
10878 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10879
10881 {
10884 }
10885 else
10886 {
10888 new_item.
SetQuantity(split_quantity_new,
false,
true);
10889 }
10890 }
10891 }
10892
10894 {
10896 float split_quantity_new = Math.Floor(quantity / 2);
10897
10899 return;
10900
10901 InventoryLocation invloc = new InventoryLocation;
10903
10905 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10906
10907 if (new_item)
10908 {
10909 if (new_item.GetQuantityMax() < split_quantity_new)
10910 {
10911 split_quantity_new = new_item.GetQuantityMax();
10912 }
10914 {
10917 }
10918 else if (split_quantity_new > 1)
10919 {
10921 new_item.
SetQuantity(split_quantity_new,
false,
true);
10922 }
10923 }
10924 }
10925
10928 {
10929 SetWeightDirty();
10931
10932 if (parent)
10933 parent.OnAttachmentQuantityChangedEx(this, delta);
10934
10936 {
10938 {
10940 }
10942 {
10943 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10945 }
10946 }
10947 }
10948
10951 {
10952
10953 }
10954
10957 {
10959 }
10960
10962 {
10963 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10964
10966 {
10967 if (newLevel == GameConstants.STATE_RUINED)
10968 {
10970 EntityAI parent = GetHierarchyParent();
10971 if (parent && parent.IsFireplace())
10972 {
10973 CargoBase cargo = GetInventory().GetCargo();
10974 if (cargo)
10975 {
10977 {
10979 }
10980 }
10981 }
10982 }
10983
10985 {
10986
10988 return;
10989 }
10990
10991 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10992 {
10994 }
10995 }
10996 }
10997
10998
11000 {
11001 super.OnRightClick();
11002
11004 {
11006 {
11007 if (ScriptInputUserData.CanStoreInputUserData())
11008 {
11009 EntityAI root = GetHierarchyRoot();
11010 Man playerOwner = GetHierarchyRootPlayer();
11011 InventoryLocation dst = new InventoryLocation;
11012
11013
11014 if (!playerOwner && root && root == this)
11015 {
11017 }
11018 else
11019 {
11020
11021 GetInventory().GetCurrentInventoryLocation(dst);
11023 {
11024 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11026 {
11028 }
11029 else
11030 {
11032
11033
11034 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11035 {
11037 }
11038 else
11039 {
11040 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11041 }
11042 }
11043 }
11044 }
11045
11046 ScriptInputUserData ctx = new ScriptInputUserData;
11054 }
11055 }
11056 else if (!
g_Game.IsMultiplayer())
11057 {
11059 }
11060 }
11061 }
11062
11064 {
11065 if (root)
11066 {
11067 vector m4[4];
11068 root.GetTransform(m4);
11069 dst.SetGround(this, m4);
11070 }
11071 else
11072 {
11073 GetInventory().GetCurrentInventoryLocation(dst);
11074 }
11075 }
11076
11077 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11078 {
11079
11080 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11081 return false;
11082
11083 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11084 return false;
11085
11086
11088 return false;
11089
11090
11091 Magazine mag = Magazine.Cast(this);
11092 if (mag)
11093 {
11094 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11095 return false;
11096
11097 if (stack_max_limit)
11098 {
11099 Magazine other_mag = Magazine.Cast(other_item);
11100 if (other_item)
11101 {
11102 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11103 return false;
11104 }
11105
11106 }
11107 }
11108 else
11109 {
11110
11112 return false;
11113
11115 return false;
11116 }
11117
11118 PlayerBase player = null;
11119 if (CastTo(player, GetHierarchyRootPlayer()))
11120 {
11121 if (player.GetInventory().HasAttachment(this))
11122 return false;
11123
11124 if (player.IsItemsToDelete())
11125 return false;
11126 }
11127
11128 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11129 return false;
11130
11131 int slotID;
11133 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11134 return false;
11135
11136 return true;
11137 }
11138
11140 {
11142 }
11143
11145 {
11146 return m_IsResultOfSplit;
11147 }
11148
11150 {
11151 m_IsResultOfSplit = value;
11152 }
11153
11155 {
11157 }
11158
11160 {
11161 float other_item_quantity = other_item.GetQuantity();
11162 float this_free_space;
11163
11165
11167
11168 if (other_item_quantity > this_free_space)
11169 {
11170 return this_free_space;
11171 }
11172 else
11173 {
11174 return other_item_quantity;
11175 }
11176 }
11177
11179 {
11181 }
11182
11184 {
11186 return;
11187
11188 if (!IsMagazine() && other_item)
11189 {
11191 if (quantity_used != 0)
11192 {
11193 float hp1 = GetHealth01("","");
11194 float hp2 = other_item.GetHealth01("","");
11195 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11196 hpResult = hpResult / (
GetQuantity() + quantity_used);
11197
11198 hpResult *= GetMaxHealth();
11199 Math.Round(hpResult);
11200 SetHealth("", "Health", hpResult);
11201
11203 other_item.AddQuantity(-quantity_used);
11204 }
11205 }
11207 }
11208
11210 {
11211 #ifdef SERVER
11212 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11213 GetHierarchyParent().IncreaseLifetimeUp();
11214 #endif
11215 };
11216
11218 {
11219 PlayerBase p = PlayerBase.Cast(player);
11220
11221 array<int> recipesIds = p.m_Recipes;
11222 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11223 if (moduleRecipesManager)
11224 {
11225 EntityAI itemInHands = player.GetEntityInHands();
11226 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11227 }
11228
11229 for (int i = 0;i < recipesIds.Count(); i++)
11230 {
11231 int key = recipesIds.Get(i);
11232 string recipeName = moduleRecipesManager.GetRecipeName(key);
11234 }
11235 }
11236
11237
11238 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11239 {
11240 super.GetDebugActions(outputList);
11241
11242
11248
11249
11254
11259
11260
11264
11265
11267 {
11271 }
11272
11275
11276
11280
11282
11283 InventoryLocation loc = new InventoryLocation();
11284 GetInventory().GetCurrentInventoryLocation(loc);
11286 {
11287 if (Gizmo_IsSupported())
11290 }
11291
11293 }
11294
11295
11296
11297
11299 {
11300 super.OnAction(action_id, player, ctx);
11301
11303 {
11304 switch (action_id)
11305 {
11309 return true;
11313 return true;
11314 }
11315 }
11316
11318 {
11319 switch (action_id)
11320 {
11322 Delete();
11323 return true;
11324 }
11325 }
11326
11327 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11328 {
11329 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11330 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11331 PlayerBase p = PlayerBase.Cast(player);
11332 if (
EActions.RECIPES_RANGE_START < 1000)
11333 {
11334 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11335 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11336 }
11337 }
11338 #ifndef SERVER
11339 else if (action_id ==
EActions.WATCH_PLAYER)
11340 {
11341 PluginDeveloper.SetDeveloperItemClientEx(player);
11342 }
11343 #endif
11345 {
11346 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11347 {
11348 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11349 OnDebugButtonPressServer(id + 1);
11350 }
11351
11352 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11353 {
11354 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11356 }
11357
11358 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11359 {
11360 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11362 }
11363
11364 else if (action_id ==
EActions.ADD_QUANTITY)
11365 {
11366 if (IsMagazine())
11367 {
11368 Magazine mag = Magazine.Cast(this);
11369 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11370 }
11371 else
11372 {
11374 }
11375
11376 if (m_EM)
11377 {
11378 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11379 }
11380
11381 }
11382
11383 else if (action_id ==
EActions.REMOVE_QUANTITY)
11384 {
11385 if (IsMagazine())
11386 {
11387 Magazine mag2 = Magazine.Cast(this);
11388 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11389 }
11390 else
11391 {
11393 }
11394 if (m_EM)
11395 {
11396 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11397 }
11398
11399 }
11400
11401 else if (action_id ==
EActions.SET_QUANTITY_0)
11402 {
11404
11405 if (m_EM)
11406 {
11407 m_EM.SetEnergy(0);
11408 }
11409 }
11410
11411 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11412 {
11414
11415 if (m_EM)
11416 {
11417 m_EM.SetEnergy(m_EM.GetEnergyMax());
11418 }
11419 }
11420
11421 else if (action_id ==
EActions.ADD_HEALTH)
11422 {
11423 AddHealth("","",GetMaxHealth("","Health")/5);
11424 }
11425 else if (action_id ==
EActions.REMOVE_HEALTH)
11426 {
11427 AddHealth("","",-GetMaxHealth("","Health")/5);
11428 }
11429 else if (action_id ==
EActions.DESTROY_HEALTH)
11430 {
11431 SetHealth01("","",0);
11432 }
11433 else if (action_id ==
EActions.WATCH_ITEM)
11434 {
11436 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11437 #ifdef DEVELOPER
11438 SetDebugDeveloper_item(this);
11439 #endif
11440 }
11441
11442 else if (action_id ==
EActions.ADD_TEMPERATURE)
11443 {
11444 AddTemperature(20);
11445
11446 }
11447
11448 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11449 {
11450 AddTemperature(-20);
11451
11452 }
11453
11454 else if (action_id ==
EActions.FLIP_FROZEN)
11455 {
11456 SetFrozen(!GetIsFrozen());
11457
11458 }
11459
11460 else if (action_id ==
EActions.ADD_WETNESS)
11461 {
11463
11464 }
11465
11466 else if (action_id ==
EActions.REMOVE_WETNESS)
11467 {
11469
11470 }
11471
11472 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11473 {
11476
11477
11478 }
11479
11480 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11481 {
11484 }
11485
11486 else if (action_id ==
EActions.MAKE_SPECIAL)
11487 {
11488 auto debugParams = DebugSpawnParams.WithPlayer(player);
11489 OnDebugSpawnEx(debugParams);
11490 }
11491
11492 }
11493
11494
11495 return false;
11496 }
11497
11498
11499
11500
11504
11507
11508
11509
11511 {
11512 return false;
11513 }
11514
11515
11517 {
11518 return true;
11519 }
11520
11521
11523 {
11524 return true;
11525 }
11526
11527
11528
11530 {
11531 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11532 return g_Game.ConfigIsExisting(config_path);
11533 }
11534
11537 {
11538 return null;
11539 }
11540
11542 {
11543 return false;
11544 }
11545
11547 {
11548 return false;
11549 }
11550
11554
11555
11557 {
11558 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11559 return module_repairing.CanRepair(this, item_repair_kit);
11560 }
11561
11562
11563 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11564 {
11565 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11566 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11567 }
11568
11569
11571 {
11572
11573
11574
11575
11576
11577
11578
11579
11580 return 1;
11581 }
11582
11583
11584
11586 {
11588 }
11589
11590
11591
11593 {
11595 }
11596
11597
11606 {
11607 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11608
11609 if (player)
11610 {
11611 player.MessageStatus(text);
11612 }
11613 }
11614
11615
11624 {
11625 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11626
11627 if (player)
11628 {
11629 player.MessageAction(text);
11630 }
11631 }
11632
11633
11642 {
11643 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11644
11645 if (player)
11646 {
11647 player.MessageFriendly(text);
11648 }
11649 }
11650
11651
11660 {
11661 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11662
11663 if (player)
11664 {
11665 player.MessageImportant(text);
11666 }
11667 }
11668
11670 {
11671 return true;
11672 }
11673
11674
11675 override bool KindOf(
string tag)
11676 {
11677 bool found = false;
11678 string item_name = this.
GetType();
11680 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11681
11682 int array_size = item_tag_array.Count();
11683 for (int i = 0; i < array_size; i++)
11684 {
11685 if (item_tag_array.Get(i) == tag)
11686 {
11687 found = true;
11688 break;
11689 }
11690 }
11691 return found;
11692 }
11693
11694
11696 {
11697
11698 super.OnRPC(sender, rpc_type,ctx);
11699
11700
11701 switch (rpc_type)
11702 {
11703 #ifndef SERVER
11704 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11705 Param2<bool, string> p = new Param2<bool, string>(false, "");
11706
11708 return;
11709
11710 bool play = p.param1;
11711 string soundSet = p.param2;
11712
11713 if (play)
11714 {
11716 {
11718 {
11720 }
11721 }
11722 else
11723 {
11725 }
11726 }
11727 else
11728 {
11730 }
11731
11732 break;
11733 #endif
11734
11735 }
11736
11738 {
11740 }
11741 }
11742
11743
11744
11745
11747 {
11748 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11749 return plugin.GetID(
name);
11750 }
11751
11753 {
11754 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11755 return plugin.GetName(id);
11756 }
11757
11760 {
11761
11762
11763 int varFlags;
11764 if (!ctx.
Read(varFlags))
11765 return;
11766
11767 if (varFlags & ItemVariableFlags.FLOAT)
11768 {
11770 }
11771 }
11772
11774 {
11775
11776 super.SerializeNumericalVars(floats_out);
11777
11778
11779
11781 {
11783 }
11784
11786 {
11788 }
11789
11791 {
11793 }
11794
11796 {
11801 }
11802
11804 {
11806 }
11807 }
11808
11810 {
11811
11812 super.DeSerializeNumericalVars(floats);
11813
11814
11815 int index = 0;
11816 int mask = Math.Round(floats.Get(index));
11817
11818 index++;
11819
11821 {
11823 {
11825 }
11826 else
11827 {
11828 float quantity = floats.Get(index);
11829 SetQuantity(quantity,
true,
false,
false,
false);
11830 }
11831 index++;
11832 }
11833
11835 {
11836 float wet = floats.Get(index);
11838 index++;
11839 }
11840
11842 {
11843 int liquidtype = Math.Round(floats.Get(index));
11845 index++;
11846 }
11847
11849 {
11851 index++;
11853 index++;
11855 index++;
11857 index++;
11858 }
11859
11861 {
11862 int cleanness = Math.Round(floats.Get(index));
11864 index++;
11865 }
11866 }
11867
11869 {
11870 super.WriteVarsToCTX(ctx);
11871
11872
11874 {
11876 }
11877
11879 {
11881 }
11882
11884 {
11886 }
11887
11889 {
11890 int r,g,b,a;
11896 }
11897
11899 {
11901 }
11902 }
11903
11905 {
11906 if (!super.ReadVarsFromCTX(ctx,version))
11907 return false;
11908
11909 int intValue;
11910 float value;
11911
11912 if (version < 140)
11913 {
11914 if (!ctx.
Read(intValue))
11915 return false;
11916
11917 m_VariablesMask = intValue;
11918 }
11919
11921 {
11922 if (!ctx.
Read(value))
11923 return false;
11924
11926 {
11928 }
11929 else
11930 {
11932 }
11933 }
11934
11935 if (version < 140)
11936 {
11938 {
11939 if (!ctx.
Read(value))
11940 return false;
11941 SetTemperatureDirect(value);
11942 }
11943 }
11944
11946 {
11947 if (!ctx.
Read(value))
11948 return false;
11950 }
11951
11953 {
11954 if (!ctx.
Read(intValue))
11955 return false;
11957 }
11958
11960 {
11961 int r,g,b,a;
11963 return false;
11965 return false;
11967 return false;
11969 return false;
11970
11972 }
11973
11975 {
11976 if (!ctx.
Read(intValue))
11977 return false;
11979 }
11980
11981 if (version >= 138 && version < 140)
11982 {
11984 {
11985 if (!ctx.
Read(intValue))
11986 return false;
11987 SetFrozen(intValue);
11988 }
11989 }
11990
11991 return true;
11992 }
11993
11994
11996 {
11999 {
12001 }
12002
12003 if (!super.OnStoreLoad(ctx, version))
12004 {
12006 return false;
12007 }
12008
12009 if (version >= 114)
12010 {
12011 bool hasQuickBarIndexSaved;
12012
12013 if (!ctx.
Read(hasQuickBarIndexSaved))
12014 {
12016 return false;
12017 }
12018
12019 if (hasQuickBarIndexSaved)
12020 {
12021 int itmQBIndex;
12022
12023
12024 if (!ctx.
Read(itmQBIndex))
12025 {
12027 return false;
12028 }
12029
12030 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12031 if (itmQBIndex != -1 && parentPlayer)
12032 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12033 }
12034 }
12035 else
12036 {
12037
12038 PlayerBase player;
12039 int itemQBIndex;
12040 if (version ==
int.
MAX)
12041 {
12042 if (!ctx.
Read(itemQBIndex))
12043 {
12045 return false;
12046 }
12047 }
12048 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12049 {
12050
12051 if (!ctx.
Read(itemQBIndex))
12052 {
12054 return false;
12055 }
12056 if (itemQBIndex != -1 && player)
12057 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12058 }
12059 }
12060
12061 if (version < 140)
12062 {
12063
12064 if (!LoadVariables(ctx, version))
12065 {
12067 return false;
12068 }
12069 }
12070
12071
12073 {
12075 return false;
12076 }
12077 if (version >= 132)
12078 {
12080 if (raib)
12081 {
12083 {
12085 return false;
12086 }
12087 }
12088 }
12089
12091 return true;
12092 }
12093
12094
12095
12097 {
12098 super.OnStoreSave(ctx);
12099
12100 PlayerBase player;
12101 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12102 {
12104
12105 int itemQBIndex = -1;
12106 itemQBIndex = player.FindQuickBarEntityIndex(this);
12107 ctx.
Write(itemQBIndex);
12108 }
12109 else
12110 {
12112 }
12113
12115
12117 if (raib)
12118 {
12120 }
12121 }
12122
12123
12125 {
12126 super.AfterStoreLoad();
12127
12129 {
12131 }
12132
12134 {
12137 }
12138 }
12139
12141 {
12142 super.EEOnAfterLoad();
12143
12145 {
12147 }
12148
12151 }
12152
12154 {
12155 return false;
12156 }
12157
12158
12159
12161 {
12163 {
12164 #ifdef PLATFORM_CONSOLE
12165
12167 {
12169 if (menu)
12170 {
12172 }
12173 }
12174 #endif
12175 }
12176
12178 {
12181 }
12182
12184 {
12185 SetWeightDirty();
12187 }
12189 {
12192 }
12193
12195 {
12198
12201 }
12203 {
12207 }
12208
12209 super.OnVariablesSynchronized();
12210 }
12211
12212
12213
12215 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12216 {
12217 if (!IsServerCheck(allow_client))
12218 return false;
12219
12221 return false;
12222
12225
12226 if (value <= (min + 0.001))
12227 value = min;
12228
12229 if (value == min)
12230 {
12231 if (destroy_config)
12232 {
12233 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12234 if (dstr)
12235 {
12237 this.Delete();
12238 return true;
12239 }
12240 }
12241 else if (destroy_forced)
12242 {
12244 this.Delete();
12245 return true;
12246 }
12247
12249 }
12250
12253
12255 {
12256 EntityAI parent = GetHierarchyRoot();
12257 InventoryLocation iLoc = new InventoryLocation();
12258 GetInventory().GetCurrentInventoryLocation(iLoc);
12260 {
12261 int iLocSlot = iLoc.
GetSlot();
12263 {
12265 }
12267 {
12269 }
12270 }
12271 }
12272
12274 {
12276
12277 if (delta)
12279 }
12280
12282
12283 return false;
12284 }
12285
12286
12288 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12289 {
12291 }
12292
12294 {
12297 }
12298
12300 {
12303 }
12304
12306 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12307 {
12308 float value_clamped = Math.Clamp(value, 0, 1);
12310 SetQuantity(result, destroy_config, destroy_forced);
12311 }
12312
12313
12316 {
12318 }
12319
12321 {
12323 }
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12335 {
12336 int slot = -1;
12337 GameInventory inventory = GetInventory();
12338 if (inventory)
12339 {
12340 InventoryLocation il = new InventoryLocation;
12343 }
12344
12346 }
12347
12349 {
12350 float quantity_max = 0;
12351
12353 {
12354 if (attSlotID != -1)
12355 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12356
12357 if (quantity_max <= 0)
12359 }
12360
12361 if (quantity_max <= 0)
12363
12364 return quantity_max;
12365 }
12366
12368 {
12370 }
12371
12373 {
12375 }
12376
12377
12379 {
12381 }
12382
12384 {
12386 }
12387
12389 {
12391 }
12392
12393
12395 {
12396
12397 float weightEx = GetWeightEx();
12398 float special = GetInventoryAndCargoWeight();
12399 return weightEx - special;
12400 }
12401
12402
12404 {
12406 }
12407
12409 {
12411 {
12412 #ifdef DEVELOPER
12413 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12414 {
12415 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12417 }
12418 #endif
12419
12420 return GetQuantity() * GetConfigWeightModified();
12421 }
12422 else if (HasEnergyManager())
12423 {
12424 #ifdef DEVELOPER
12425 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12426 {
12427 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12428 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12429 }
12430 #endif
12431 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12432 }
12433 else
12434 {
12435 #ifdef DEVELOPER
12436 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12437 {
12438 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12439 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12440 }
12441 #endif
12442 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12443 }
12444 }
12445
12448 {
12449 int item_count = 0;
12451
12452 GameInventory inventory = GetInventory();
12453 CargoBase cargo = inventory.
GetCargo();
12454 if (cargo != NULL)
12455 {
12457 }
12458
12460 for (int i = 0; i < nAttachments; ++i)
12461 {
12463 if (item)
12464 item_count += item.GetNumberOfItems();
12465 }
12466 return item_count;
12467 }
12468
12471 {
12472 float weight = 0;
12473 float wetness = 1;
12474 if (include_wetness)
12477 {
12478 weight = wetness * m_ConfigWeight;
12479 }
12481 {
12482 weight = 1;
12483 }
12484 return weight;
12485 }
12486
12487
12488
12490 {
12491 GameInventory inventory = GetInventory();
12492 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12493 {
12494 array<EntityAI> items = new array<EntityAI>;
12496 for (int i = 0; i < items.Count(); ++i)
12497 {
12499 if (item)
12500 {
12501 g_Game.ObjectDelete(item);
12502 }
12503 }
12504 }
12505 }
12506
12507
12508
12509
12511 {
12512 float energy = 0;
12513 if (HasEnergyManager())
12514 {
12515 energy = GetCompEM().GetEnergy();
12516 }
12517 return energy;
12518 }
12519
12520
12522 {
12523 super.OnEnergyConsumed();
12524
12526 }
12527
12529 {
12530 super.OnEnergyAdded();
12531
12533 }
12534
12535
12537 {
12538 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12539 {
12541 {
12542 float energy_0to1 = GetCompEM().GetEnergy0To1();
12544 }
12545 }
12546 }
12547
12548
12550 {
12551 return ConfigGetFloat("heatIsolation");
12552 }
12553
12555 {
12557 }
12558
12560 {
12561 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12562 if (
g_Game.ConfigIsExisting(paramPath))
12563 return g_Game.ConfigGetFloat(paramPath);
12564
12565 return 0.0;
12566 }
12567
12569 {
12570 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12571 if (
g_Game.ConfigIsExisting(paramPath))
12572 return g_Game.ConfigGetFloat(paramPath);
12573
12574 return 0.0;
12575 }
12576
12577 override void SetWet(
float value,
bool allow_client =
false)
12578 {
12579 if (!IsServerCheck(allow_client))
12580 return;
12581
12584
12586
12587 m_VarWet = Math.Clamp(value, min, max);
12588
12590 {
12593 }
12594 }
12595
12596 override void AddWet(
float value)
12597 {
12599 }
12600
12602 {
12604 }
12605
12607 {
12609 }
12610
12612 {
12614 }
12615
12617 {
12619 }
12620
12622 {
12624 }
12625
12626 override void OnWetChanged(
float newVal,
float oldVal)
12627 {
12630 if (newLevel != oldLevel)
12631 {
12633 }
12634 }
12635
12637 {
12638 SetWeightDirty();
12639 }
12640
12642 {
12643 return GetWetLevelInternal(
m_VarWet);
12644 }
12645
12646
12647
12649 {
12651 }
12652
12654 {
12656 }
12657
12659 {
12661 }
12662
12664 {
12666 }
12667
12668
12669
12671 {
12672 if (ConfigIsExisting("itemModelLength"))
12673 {
12674 return ConfigGetFloat("itemModelLength");
12675 }
12676 return 0;
12677 }
12678
12680 {
12681 if (ConfigIsExisting("itemAttachOffset"))
12682 {
12683 return ConfigGetFloat("itemAttachOffset");
12684 }
12685 return 0;
12686 }
12687
12688 override void SetCleanness(
int value,
bool allow_client =
false)
12689 {
12690 if (!IsServerCheck(allow_client))
12691 return;
12692
12694
12696
12699 }
12700
12702 {
12704 }
12705
12707 {
12708 return true;
12709 }
12710
12711
12712
12713
12715 {
12717 }
12718
12720 {
12722 }
12723
12724
12725
12726
12727 override void SetColor(
int r,
int g,
int b,
int a)
12728 {
12734 }
12736 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12737 {
12742 }
12743
12745 {
12747 }
12748
12751 {
12752 int r,g,b,a;
12754 r = r/255;
12755 g = g/255;
12756 b = b/255;
12757 a = a/255;
12758 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12759 }
12760
12761
12762
12763 override void SetLiquidType(
int value,
bool allow_client =
false)
12764 {
12765 if (!IsServerCheck(allow_client))
12766 return;
12767
12772 }
12773
12775 {
12776 return ConfigGetInt("varLiquidTypeInit");
12777 }
12778
12780 {
12782 }
12783
12785 {
12787 SetFrozen(false);
12788 }
12789
12792 {
12793 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12794 }
12795
12796
12799 {
12800 PlayerBase nplayer;
12801 if (PlayerBase.CastTo(nplayer, player))
12802 {
12804 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12805 }
12806 }
12807
12808
12811 {
12812 PlayerBase nplayer;
12813 if (PlayerBase.CastTo(nplayer,player))
12814 {
12815 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12816 }
12817
12818 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12819
12820 if (HasEnergyManager())
12821 {
12822 GetCompEM().UpdatePlugState();
12823 }
12824 }
12825
12826
12828 {
12829 super.OnPlacementStarted(player);
12830
12832 }
12833
12834 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12835 {
12837 {
12838 m_AdminLog.OnPlacementComplete(player,
this);
12839 }
12840
12841 super.OnPlacementComplete(player, position, orientation);
12842 }
12843
12844
12845
12846
12847
12849 {
12851 {
12852 return true;
12853 }
12854 else
12855 {
12856 return false;
12857 }
12858 }
12859
12860
12862 {
12864 {
12866 }
12867 }
12868
12869
12871 {
12873 }
12874
12876 {
12878 }
12879
12880 override void InsertAgent(
int agent,
float count = 1)
12881 {
12882 if (count < 1)
12883 return;
12884
12886 }
12887
12890 {
12892 }
12893
12894
12896 {
12898 }
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12942 {
12944 return false;
12945 return true;
12946 }
12947
12949 {
12950
12952 }
12953
12954
12957 {
12958 super.CheckForRoofLimited(timeTresholdMS);
12959
12960 float time =
g_Game.GetTime();
12961 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12962 {
12963 m_PreviousRoofTestTime = time;
12964 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12965 }
12966 }
12967
12968
12970 {
12972 {
12973 return 0;
12974 }
12975
12976 if (GetInventory().GetAttachmentSlotsCount() != 0)
12977 {
12978 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12979 if (filter)
12980 return filter.GetProtectionLevel(type, false, system);
12981 else
12982 return 0;
12983 }
12984
12985 string subclassPath, entryName;
12986
12987 switch (type)
12988 {
12990 entryName = "biological";
12991 break;
12993 entryName = "chemical";
12994 break;
12995 default:
12996 entryName = "biological";
12997 break;
12998 }
12999
13000 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13001
13002 return g_Game.ConfigGetFloat(subclassPath + entryName);
13003 }
13004
13005
13006
13009 {
13010 if (!IsMagazine())
13012
13014 }
13015
13016
13017
13018
13019
13024 {
13025 return true;
13026 }
13027
13029 {
13031 }
13032
13033
13034
13035
13036
13038 {
13039 if (parent)
13040 {
13041 if (parent.IsInherited(DayZInfected))
13042 return true;
13043
13044 if (!parent.IsRuined())
13045 return true;
13046 }
13047
13048 return true;
13049 }
13050
13052 {
13053 if (!super.CanPutAsAttachment(parent))
13054 {
13055 return false;
13056 }
13057
13058 if (!IsRuined() && !parent.IsRuined())
13059 {
13060 return true;
13061 }
13062
13063 return false;
13064 }
13065
13067 {
13068
13069
13070
13071
13072 return super.CanReceiveItemIntoCargo(item);
13073 }
13074
13076 {
13077
13078
13079
13080
13081 GameInventory attachmentInv = attachment.GetInventory();
13083 {
13084 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13085 return false;
13086 }
13087
13088 InventoryLocation loc = new InventoryLocation();
13089 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13090 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13091 return false;
13092
13093 return super.CanReceiveAttachment(attachment, slotId);
13094 }
13095
13097 {
13098 if (!super.CanReleaseAttachment(attachment))
13099 return false;
13100
13101 return GetInventory().AreChildrenAccessible();
13102 }
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13125 {
13126 int id = muzzle_owner.GetMuzzleID();
13127 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13128
13129 if (WPOF_array)
13130 {
13131 for (int i = 0; i < WPOF_array.Count(); i++)
13132 {
13133 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13134
13135 if (WPOF)
13136 {
13137 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13138 }
13139 }
13140 }
13141 }
13142
13143
13145 {
13146 int id = muzzle_owner.GetMuzzleID();
13148
13149 if (WPOBE_array)
13150 {
13151 for (int i = 0; i < WPOBE_array.Count(); i++)
13152 {
13153 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13154
13155 if (WPOBE)
13156 {
13157 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13158 }
13159 }
13160 }
13161 }
13162
13163
13165 {
13166 int id = muzzle_owner.GetMuzzleID();
13167 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13168
13169 if (WPOOH_array)
13170 {
13171 for (int i = 0; i < WPOOH_array.Count(); i++)
13172 {
13173 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13174
13175 if (WPOOH)
13176 {
13177 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13178 }
13179 }
13180 }
13181 }
13182
13183
13185 {
13186 int id = muzzle_owner.GetMuzzleID();
13187 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13188
13189 if (WPOOH_array)
13190 {
13191 for (int i = 0; i < WPOOH_array.Count(); i++)
13192 {
13193 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13194
13195 if (WPOOH)
13196 {
13197 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13198 }
13199 }
13200 }
13201 }
13202
13203
13205 {
13206 int id = muzzle_owner.GetMuzzleID();
13207 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13208
13209 if (WPOOH_array)
13210 {
13211 for (int i = 0; i < WPOOH_array.Count(); i++)
13212 {
13213 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13214
13215 if (WPOOH)
13216 {
13217 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13218 }
13219 }
13220 }
13221 }
13222
13223
13224
13226 {
13228 {
13229 return true;
13230 }
13231
13232 return false;
13233 }
13234
13236 {
13238 {
13239 return true;
13240 }
13241
13242 return false;
13243 }
13244
13246 {
13248 {
13249 return true;
13250 }
13251
13252 return false;
13253 }
13254
13256 {
13257 return false;
13258 }
13259
13262 {
13263 return UATimeSpent.DEFAULT_DEPLOY;
13264 }
13265
13266
13267
13268
13270 {
13272 SetSynchDirty();
13273 }
13274
13276 {
13278 }
13279
13280
13282 {
13283 return false;
13284 }
13285
13288 {
13289 string att_type = "None";
13290
13291 if (ConfigIsExisting("soundAttType"))
13292 {
13293 att_type = ConfigGetString("soundAttType");
13294 }
13295
13297 }
13298
13300 {
13302 }
13303
13304
13305
13306
13307
13313
13315 {
13318
13320 }
13321
13322
13324 {
13326 return;
13327
13329
13332
13335
13336 SoundParameters params = new SoundParameters();
13340 }
13341
13342
13344 {
13346 {
13349
13350 SetSynchDirty();
13351
13354 }
13355 }
13356
13358 {
13360 }
13361
13362
13364 {
13366 return;
13367
13369 SetSynchDirty();
13370
13373 }
13374
13376 {
13379 }
13380
13382 {
13384 }
13385
13386 void OnApply(PlayerBase player);
13387
13389 {
13390 return 1.0;
13391 };
13392
13394 {
13396 }
13397
13399 {
13401 }
13402
13404
13406 {
13407 SetDynamicPhysicsLifeTime(0.01);
13409 }
13410
13412 {
13413 array<string> zone_names = new array<string>;
13414 GetDamageZones(zone_names);
13415 for (int i = 0; i < zone_names.Count(); i++)
13416 {
13417 SetHealthMax(zone_names.Get(i),"Health");
13418 }
13419 SetHealthMax("","Health");
13420 }
13421
13424 {
13425 float global_health = GetHealth01("","Health");
13426 array<string> zones = new array<string>;
13427 GetDamageZones(zones);
13428
13429 for (int i = 0; i < zones.Count(); i++)
13430 {
13431 SetHealth01(zones.Get(i),"Health",global_health);
13432 }
13433 }
13434
13437 {
13438 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13439 }
13440
13442 {
13443 if (!hasRootAsPlayer)
13444 {
13445 if (refParentIB)
13446 {
13447
13448 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13449 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13450
13451 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13452 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13453
13456 }
13457 else
13458 {
13459
13462 }
13463 }
13464 }
13465
13467 {
13469 {
13470 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13471 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13472 {
13473 float heatPermCoef = 1.0;
13475 while (ent)
13476 {
13477 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13478 ent = ent.GetHierarchyParent();
13479 }
13480
13481 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13482 }
13483 }
13484 }
13485
13487 {
13488
13489 EntityAI parent = GetHierarchyParent();
13490 if (!parent)
13491 {
13492 hasParent = false;
13493 hasRootAsPlayer = false;
13494 }
13495 else
13496 {
13497 hasParent = true;
13498 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13499 refParentIB =
ItemBase.Cast(parent);
13500 }
13501 }
13502
13503 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13504 {
13505
13506 }
13507
13509 {
13510
13511 return false;
13512 }
13513
13515 {
13516
13517
13518 return false;
13519 }
13520
13522 {
13523
13524 return false;
13525 }
13526
13529 {
13530 return !GetIsFrozen() &&
IsOpen();
13531 }
13532
13534 {
13535 bool hasParent = false, hasRootAsPlayer = false;
13537
13538 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13539 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13540
13541 if (wwtu || foodDecay)
13542 {
13546
13547 if (processWetness || processTemperature || processDecay)
13548 {
13550
13551 if (processWetness)
13552 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13553
13554 if (processTemperature)
13556
13557 if (processDecay)
13558 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13559 }
13560 }
13561 }
13562
13565 {
13567 }
13568
13570 {
13573
13574 return super.GetTemperatureFreezeThreshold();
13575 }
13576
13578 {
13581
13582 return super.GetTemperatureThawThreshold();
13583 }
13584
13586 {
13589
13590 return super.GetItemOverheatThreshold();
13591 }
13592
13594 {
13596 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13597
13598 return super.GetTemperatureFreezeTime();
13599 }
13600
13602 {
13604 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13605
13606 return super.GetTemperatureThawTime();
13607 }
13608
13613
13615 {
13616 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13617 }
13618
13620 {
13621 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13622 }
13623
13626 {
13628 }
13629
13631 {
13633 }
13634
13636 {
13638 }
13639
13642 {
13643 return null;
13644 }
13645
13648 {
13649 return false;
13650 }
13651
13653 {
13655 {
13658 if (!trg)
13659 {
13661 explosive = this;
13662 }
13663
13664 explosive.PairRemote(trg);
13666
13667 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13668 trg.SetPersistentPairID(persistentID);
13669 explosive.SetPersistentPairID(persistentID);
13670
13671 return true;
13672 }
13673 return false;
13674 }
13675
13678 {
13679 float ret = 1.0;
13682 ret *= GetHealth01();
13683
13684 return ret;
13685 }
13686
13687 #ifdef DEVELOPER
13688 override void SetDebugItem()
13689 {
13690 super.SetDebugItem();
13691 _itemBase = this;
13692 }
13693
13695 {
13696 string text = super.GetDebugText();
13697
13699 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13700
13701 return text;
13702 }
13703 #endif
13704
13706 {
13707 return true;
13708 }
13709
13711
13713
13715 {
13718 }
13719
13720
13728
13744
13745 [
Obsolete(
"Use ItemSoundHandler instead")]
13748 {
13749 if (!
g_Game.IsDedicatedServer())
13750 {
13751 if (ConfigIsExisting("attachSoundSet"))
13752 {
13753 string cfg_path = "";
13754 string soundset = "";
13755 string type_name =
GetType();
13756
13759 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13760 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13761
13762 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13763 {
13764 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13765 {
13766 if (cfg_slot_array[i] == slot_type)
13767 {
13768 soundset = cfg_soundset_array[i];
13769 break;
13770 }
13771 }
13772 }
13773
13774 if (soundset != "")
13775 {
13776 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13778 }
13779 }
13780 }
13781 }
13782
13784}
13785
13787{
13789 if (entity)
13790 {
13791 bool is_item = entity.IsInherited(
ItemBase);
13792 if (is_item && full_quantity)
13793 {
13796 }
13797 }
13798 else
13799 {
13801 return NULL;
13802 }
13803 return entity;
13804}
13805
13807{
13808 if (item)
13809 {
13810 if (health > 0)
13811 item.SetHealth("", "", health);
13812
13813 if (item.CanHaveTemperature())
13814 {
13816 if (item.CanFreeze())
13817 item.SetFrozen(false);
13818 }
13819
13820 if (item.HasEnergyManager())
13821 {
13822 if (quantity >= 0)
13823 {
13824 item.GetCompEM().SetEnergy0To1(quantity);
13825 }
13826 else
13827 {
13829 }
13830 }
13831 else if (item.IsMagazine())
13832 {
13833 Magazine mag = Magazine.Cast(item);
13834 if (quantity >= 0)
13835 {
13836 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13837 }
13838 else
13839 {
13841 }
13842
13843 }
13844 else
13845 {
13846 if (quantity >= 0)
13847 {
13848 item.SetQuantityNormalized(quantity, false);
13849 }
13850 else
13851 {
13853 }
13854
13855 }
13856 }
13857}
13858
13859#ifdef DEVELOPER
13861#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.