Event called on item when it is removed from the player(Man) inventory, passes the old owner as a parameter.
8830{
8832 {
8833 return true;
8834 }
8835};
8836
8838{
8839
8840};
8841
8842
8843
8845{
8849
8851
8854
8855
8856
8857
8858
8867
8873
8878
8883
8904 protected bool m_IsResultOfSplit
8905
8907
8912
8913
8914
8916
8920
8921
8922
8924
8927
8928
8929
8935
8936
8944
8947
8948
8950
8951
8953
8954
8959
8960
8965
8967
8968
8970
8971
8973 {
8978
8979 if (!
g_Game.IsDedicatedServer())
8980 {
8982 {
8984
8986 {
8988 }
8989 }
8990
8993 }
8994
8995 m_OldLocation = null;
8996
8998 {
9000 }
9001
9002 if (ConfigIsExisting("headSelectionsToHide"))
9003 {
9006 }
9007
9009 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9010 {
9012 }
9013
9015
9016 m_IsResultOfSplit = false;
9017
9019 }
9020
9022 {
9023 super.InitItemVariables();
9024
9030 m_Count = ConfigGetInt(
"count");
9031
9034
9039
9042
9047
9059
9063
9064
9067 if (ConfigIsExisting("canBeSplit"))
9068 {
9071 }
9072
9074 if (ConfigIsExisting("itemBehaviour"))
9076
9077
9080 RegisterNetSyncVariableInt("m_VarLiquidType");
9081 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9082
9083 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9084 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9085 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9086
9087 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9088 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9089 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9090 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9091
9092 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9093 RegisterNetSyncVariableBool("m_IsTakeable");
9094 RegisterNetSyncVariableBool("m_IsHologram");
9095
9098 {
9101 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9102 }
9103
9105
9107 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9109
9111 }
9112
9114 {
9116 }
9117
9119 {
9122 {
9127 }
9128 }
9129
9130 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9131 {
9133 {
9136 }
9137
9139 }
9140
9142 {
9148 }
9149
9151
9153 {
9155
9156 if (!action)
9157 {
9158 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9159 return;
9160 }
9161
9163 if (!ai)
9164 {
9166 return;
9167 }
9168
9170 if (!action_array)
9171 {
9172 action_array = new array<ActionBase_Basic>;
9174 }
9175 if (LogManager.IsActionLogEnable())
9176 {
9177 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9178 }
9179
9180 if (action_array.Find(action) != -1)
9181 {
9182 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9183 }
9184 else
9185 {
9186 action_array.Insert(action);
9187 }
9188 }
9189
9191 {
9192 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9193 ActionBase action = player.GetActionManager().GetAction(actionName);
9196
9197 if (action_array)
9198 {
9199 action_array.RemoveItem(action);
9200 }
9201 }
9202
9203
9204
9206 {
9207 ActionOverrideData overrideData = new ActionOverrideData();
9211
9213 if (!actionMap)
9214 {
9217 }
9218
9219 actionMap.Insert(this.
Type(), overrideData);
9220
9221 }
9222
9224
9226
9227
9229 {
9232
9235
9236 string config_to_search = "CfgVehicles";
9237 string muzzle_owner_config;
9238
9240 {
9241 if (IsInherited(Weapon))
9242 config_to_search = "CfgWeapons";
9243
9244 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9245
9246 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9247
9248 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9249
9250 if (config_OnFire_subclass_count > 0)
9251 {
9252 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9253
9254 for (int i = 0; i < config_OnFire_subclass_count; i++)
9255 {
9256 string particle_class = "";
9257 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9258 string config_OnFire_entry = config_OnFire_class + particle_class;
9259 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9260 WPOF_array.Insert(WPOF);
9261 }
9262
9263
9265 }
9266 }
9267
9269 {
9270 config_to_search = "CfgWeapons";
9271 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9272
9273 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9274
9275 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9276
9277 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9278 {
9279 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9280
9281 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9282 {
9283 string particle_class2 = "";
9284 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9285 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9286 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9287 WPOBE_array.Insert(WPOBE);
9288 }
9289
9290
9292 }
9293 }
9294 }
9295
9296
9298 {
9301
9303 {
9304 string config_to_search = "CfgVehicles";
9305
9306 if (IsInherited(Weapon))
9307 config_to_search = "CfgWeapons";
9308
9309 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9310 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9311
9312 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9313 {
9314
9316
9318 {
9320 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9322 return;
9323 }
9324
9327
9328
9329
9330 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9331 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9332
9333 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9334 {
9335 string particle_class = "";
9336 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9337 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9338 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9339
9340 if (entry_type == CT_CLASS)
9341 {
9342 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9343 WPOOH_array.Insert(WPOF);
9344 }
9345 }
9346
9347
9349 }
9350 }
9351 }
9352
9354 {
9356 }
9357
9359 {
9361 {
9363
9366
9369
9370 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9371 }
9372 }
9373
9375 {
9377 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9378
9380 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9381
9383 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9384
9386 {
9388 }
9389 }
9390
9392 {
9394 }
9395
9397 {
9400 else
9402
9404 {
9407 }
9408 else
9409 {
9412
9415 }
9416
9418 }
9419
9421 {
9423 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9424 }
9425
9427 {
9429 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9431 }
9432
9434 {
9436 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9437 }
9438
9440 {
9443
9444 OverheatingParticle OP = new OverheatingParticle();
9449
9451 }
9452
9454 {
9457
9458 return -1;
9459 }
9460
9462 {
9464 {
9467
9468 for (int i = count; i > 0; --i)
9469 {
9470 int id = i - 1;
9473
9476
9477 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9478 {
9479 if (p)
9480 {
9483 }
9484 }
9485 }
9486 }
9487 }
9488
9490 {
9492 {
9494 {
9495 int id = i - 1;
9497
9498 if (OP)
9499 {
9501
9502 if (p)
9503 {
9505 }
9506
9507 delete OP;
9508 }
9509 }
9510
9513 }
9514 }
9515
9518 {
9519 return 0.0;
9520 }
9521
9522
9524 {
9525 return 250;
9526 }
9527
9529 {
9530 return 0;
9531 }
9532
9535 {
9537 return true;
9538
9539 return false;
9540 }
9541
9544 {
9547
9549 {
9551 }
9552 else
9553 {
9554
9556 }
9557
9559 }
9560
9567 {
9568 return -1;
9569 }
9570
9571
9572
9573
9575 {
9577 {
9578 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9579 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9580
9581 if (r_index >= 0)
9582 {
9583 InventoryLocation r_il = new InventoryLocation;
9584 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9585
9586 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9589 {
9590 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9591 }
9593 {
9594 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9595 }
9596
9597 }
9598
9599 player.GetHumanInventory().ClearUserReservedLocation(this);
9600 }
9601
9604 }
9605
9606
9607
9608
9610 {
9611 return ItemBase.m_DebugActionsMask;
9612 }
9613
9615 {
9616 return ItemBase.m_DebugActionsMask & mask;
9617 }
9618
9620 {
9621 ItemBase.m_DebugActionsMask = mask;
9622 }
9623
9625 {
9626 ItemBase.m_DebugActionsMask |= mask;
9627 }
9628
9630 {
9631 ItemBase.m_DebugActionsMask &= ~mask;
9632 }
9633
9635 {
9637 {
9639 }
9640 else
9641 {
9643 }
9644 }
9645
9646
9648 {
9649 if (GetEconomyProfile())
9650 {
9651 float q_max = GetEconomyProfile().GetQuantityMax();
9652 if (q_max > 0)
9653 {
9654 float q_min = GetEconomyProfile().GetQuantityMin();
9655 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9656
9658 {
9659 ComponentEnergyManager comp = GetCompEM();
9661 {
9663 }
9664 }
9666 {
9668
9669 }
9670
9671 }
9672 }
9673 }
9674
9677 {
9678 EntityAI parent = GetHierarchyParent();
9679
9680 if (parent)
9681 {
9682 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9683 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9684 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9685 }
9686 }
9687
9690 {
9691 EntityAI parent = GetHierarchyParent();
9692
9693 if (parent)
9694 {
9695 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9696 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9697 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9698 }
9699 }
9700
9702 {
9703
9704
9705
9706
9708
9710 {
9711 if (ScriptInputUserData.CanStoreInputUserData())
9712 {
9713 ScriptInputUserData ctx = new ScriptInputUserData;
9719 ctx.
Write(use_stack_max);
9722
9724 {
9725 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9726 }
9727 }
9728 }
9729 else if (!
g_Game.IsMultiplayer())
9730 {
9732 }
9733 }
9734
9736 {
9738 }
9739
9741 {
9743 }
9744
9746 {
9748 }
9749
9751 {
9752
9753 return false;
9754 }
9755
9757 {
9758 return false;
9759 }
9760
9764 {
9765 return false;
9766 }
9767
9769 {
9770 return "";
9771 }
9772
9774
9776 {
9777 return false;
9778 }
9779
9781 {
9782 return true;
9783 }
9784
9785
9786
9788 {
9789 return true;
9790 }
9791
9793 {
9794 return true;
9795 }
9796
9798 {
9799 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9801 }
9802
9804 {
9806 }
9807
9809 {
9811 if (!is_being_placed)
9813 SetSynchDirty();
9814 }
9815
9816
9818
9820 {
9822 }
9823
9825 {
9827 }
9828
9830 {
9831 return 1;
9832 }
9833
9835 {
9836 return false;
9837 }
9838
9840 {
9842 SetSynchDirty();
9843 }
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9880 {
9881 super.OnMovedInsideCargo(container);
9882
9883 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9884 }
9885
9886 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9887 {
9888 super.EEItemLocationChanged(oldLoc, newLoc);
9889
9890 PlayerBase newPlayer = null;
9891 PlayerBase oldPlayer = null;
9892
9893 if (newLoc.GetParent())
9894 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9895
9896 if (oldLoc.GetParent())
9897 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9898
9900 {
9901 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9902
9903 if (rIndex >= 0)
9904 {
9905 InventoryLocation rIl = new InventoryLocation;
9906 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9907
9908 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9911 {
9912 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9913 }
9915 {
9917 }
9918
9919 }
9920 }
9921
9923 {
9924 if (newPlayer)
9925 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9926
9927 if (newPlayer == oldPlayer)
9928 {
9929 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9930 {
9932 {
9933 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9934 {
9935 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9936 }
9937 }
9938 else
9939 {
9940 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9941 }
9942 }
9943
9944 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9945 {
9946 int type = oldLoc.GetType();
9948 {
9949 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9950 }
9952 {
9953 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9954 }
9955 }
9956 if (!m_OldLocation)
9957 {
9958 m_OldLocation = new InventoryLocation;
9959 }
9960 m_OldLocation.Copy(oldLoc);
9961 }
9962 else
9963 {
9964 if (m_OldLocation)
9965 {
9966 m_OldLocation.Reset();
9967 }
9968 }
9969
9970 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9971 }
9972 else
9973 {
9974 if (newPlayer)
9975 {
9976 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9977 if (resIndex >= 0)
9978 {
9979 InventoryLocation il = new InventoryLocation;
9980 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9982 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9985 {
9986 il.
GetParent().GetOnReleaseLock().Invoke(it);
9987 }
9989 {
9991 }
9992
9993 }
9994 }
9996 {
9997
9999 }
10000
10001 if (m_OldLocation)
10002 {
10003 m_OldLocation.Reset();
10004 }
10005 }
10006
10008 {
10009 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10010 }
10011
10013 {
10014 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10015 }
10016 }
10017
10018 override void EOnContact(IEntity other, Contact extra)
10019 {
10021 {
10022 int liquidType = -1;
10024 if (impactSpeed > 0.0)
10025 {
10027 #ifndef SERVER
10029 #else
10031 SetSynchDirty();
10032 #endif
10034 }
10035 }
10036
10037 #ifdef SERVER
10038 if (GetCompEM() && GetCompEM().IsPlugged())
10039 {
10040 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10041 GetCompEM().UnplugThis();
10042 }
10043 #endif
10044 }
10045
10047
10049 {
10051 }
10052
10054 {
10055
10056 }
10057
10059 {
10060 super.OnItemLocationChanged(old_owner, new_owner);
10061
10062 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10063 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10064
10065 if (!relatedPlayer && playerNew)
10066 relatedPlayer = playerNew;
10067
10068 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10069 {
10071 if (actionMgr)
10072 {
10073 ActionBase currentAction = actionMgr.GetRunningAction();
10074 if (currentAction)
10076 }
10077 }
10078
10079 Man ownerPlayerOld = null;
10080 Man ownerPlayerNew = null;
10081
10082 if (old_owner)
10083 {
10084 if (old_owner.
IsMan())
10085 {
10086 ownerPlayerOld = Man.Cast(old_owner);
10087 }
10088 else
10089 {
10090 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10091 }
10092 }
10093 else
10094 {
10096 {
10098
10099 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10100 {
10101 GetCompEM().UnplugThis();
10102 }
10103 }
10104 }
10105
10106 if (new_owner)
10107 {
10108 if (new_owner.
IsMan())
10109 {
10110 ownerPlayerNew = Man.Cast(new_owner);
10111 }
10112 else
10113 {
10114 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10115 }
10116 }
10117
10118 if (ownerPlayerOld != ownerPlayerNew)
10119 {
10120 if (ownerPlayerOld)
10121 {
10122 array<EntityAI> subItemsExit = new array<EntityAI>;
10124 for (int i = 0; i < subItemsExit.Count(); i++)
10125 {
10128 }
10129 }
10130
10131 if (ownerPlayerNew)
10132 {
10133 array<EntityAI> subItemsEnter = new array<EntityAI>;
10135 for (int j = 0; j < subItemsEnter.Count(); j++)
10136 {
10139 }
10140 }
10141 }
10142 else if (ownerPlayerNew != null)
10143 {
10144 PlayerBase nplayer;
10145 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10146 {
10147 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10149 for (int k = 0; k < subItemsUpdate.Count(); k++)
10150 {
10152 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10153 }
10154 }
10155 }
10156
10157 if (old_owner)
10158 old_owner.OnChildItemRemoved(this);
10159 if (new_owner)
10160 new_owner.OnChildItemReceived(this);
10161 }
10162
10163
10165 {
10166 super.EEDelete(parent);
10167 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10168 if (player)
10169 {
10171
10172 if (player.IsAlive())
10173 {
10174 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10175 if (r_index >= 0)
10176 {
10177 InventoryLocation r_il = new InventoryLocation;
10178 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10179
10180 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10183 {
10184 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10185 }
10187 {
10188 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10189 }
10190
10191 }
10192
10193 player.RemoveQuickBarEntityShortcut(this);
10194 }
10195 }
10196 }
10197
10199 {
10200 super.EEKilled(killer);
10201
10204 {
10205 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10206 {
10207 if (IsMagazine())
10208 {
10209 if (Magazine.Cast(this).GetAmmoCount() > 0)
10210 {
10212 }
10213 }
10214 else
10215 {
10217 }
10218 }
10219 }
10220 }
10221
10223 {
10224 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10225
10226 super.OnWasAttached(parent, slot_id);
10227
10230
10233 }
10234
10236 {
10237 super.OnWasDetached(parent, slot_id);
10238
10241
10244 }
10245
10247 {
10248 int idx;
10251
10252 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10253 if (inventory_slots.Count() < 1)
10254 {
10255 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10256 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10257 }
10258 else
10259 {
10260 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10261 }
10262
10263 idx = inventory_slots.Find(slot);
10264 if (idx < 0)
10265 return "";
10266
10267 return attach_types.Get(idx);
10268 }
10269
10271 {
10272 int idx = -1;
10273 string slot;
10274
10277
10278 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10279 if (inventory_slots.Count() < 1)
10280 {
10281 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10282 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10283 }
10284 else
10285 {
10286 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10287 if (detach_types.Count() < 1)
10288 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10289 }
10290
10291 for (int i = 0; i < inventory_slots.Count(); i++)
10292 {
10293 slot = inventory_slots.Get(i);
10294 }
10295
10296 if (slot != "")
10297 {
10298 if (detach_types.Count() == 1)
10299 idx = 0;
10300 else
10301 idx = inventory_slots.Find(slot);
10302 }
10303 if (idx < 0)
10304 return "";
10305
10306 return detach_types.Get(idx);
10307 }
10308
10310 {
10311
10313
10314
10315 float min_time = 1;
10316 float max_time = 3;
10317 float delay = Math.RandomFloat(min_time, max_time);
10318
10319 explode_timer.Run(delay, this, "DoAmmoExplosion");
10320 }
10321
10323 {
10324 Magazine magazine = Magazine.Cast(this);
10325 int pop_sounds_count = 6;
10326 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10327
10328
10329 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10330 string sound_name = pop_sounds[ sound_idx ];
10331 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10332
10333
10334 magazine.ServerAddAmmoCount(-1);
10335
10336
10337 float min_temp_to_explode = 100;
10338
10339 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10340 {
10342 }
10343 }
10344
10345
10346 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10347 {
10348 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10349
10350 const int CHANCE_DAMAGE_CARGO = 4;
10351 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10352 const int CHANCE_DAMAGE_NOTHING = 2;
10353
10355 {
10356 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10357 int chances;
10358 int rnd;
10359
10360 if (GetInventory().GetCargo())
10361 {
10362 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10363 rnd = Math.RandomInt(0,chances);
10364
10365 if (rnd < CHANCE_DAMAGE_CARGO)
10366 {
10368 }
10369 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10370 {
10372 }
10373 }
10374 else
10375 {
10376 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10377 rnd = Math.RandomInt(0,chances);
10378
10379 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10380 {
10382 }
10383 }
10384 }
10385 }
10386
10388 {
10389 CargoBase cargo = GetInventory().GetCargo();
10390 if (cargo)
10391 {
10393 if (item_count > 0)
10394 {
10395 int random_pick = Math.RandomInt(0, item_count);
10397 if (!item.IsExplosive())
10398 {
10399 item.AddHealth("","",damage);
10400 return true;
10401 }
10402 }
10403 }
10404 return false;
10405 }
10406
10408 {
10409 GameInventory inventory = GetInventory();
10411 if (attachment_count > 0)
10412 {
10413 int random_pick = Math.RandomInt(0, attachment_count);
10415 if (!attachment.IsExplosive())
10416 {
10417 attachment.AddHealth("","",damage);
10418 return true;
10419 }
10420 }
10421 return false;
10422 }
10423
10425 {
10427 }
10428
10430 {
10432 return GetInventory().CanRemoveEntity();
10433
10434 return false;
10435 }
10436
10438 {
10439
10441 return false;
10442
10443
10445 return false;
10446
10447
10448
10450 if (delta == 0)
10451 return false;
10452
10453
10454 return true;
10455 }
10456
10458 {
10460 {
10461 if (ScriptInputUserData.CanStoreInputUserData())
10462 {
10463 ScriptInputUserData ctx = new ScriptInputUserData;
10468 ctx.
Write(destination_entity);
10470 ctx.
Write(slot_id);
10472 }
10473 }
10474 else if (!
g_Game.IsMultiplayer())
10475 {
10477 }
10478 }
10479
10481 {
10482 float split_quantity_new;
10486 InventoryLocation loc = new InventoryLocation;
10487
10488 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10489 {
10491 split_quantity_new = stack_max;
10492 else
10494
10496 {
10497 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10498 if (new_item)
10499 {
10500 new_item.SetResultOfSplit(true);
10501 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10503 new_item.
SetQuantity(split_quantity_new,
false,
true);
10504 }
10505 }
10506 }
10507 else if (destination_entity && slot_id == -1)
10508 {
10509 if (quantity > stack_max)
10510 split_quantity_new = stack_max;
10511 else
10512 split_quantity_new = quantity;
10513
10515 {
10516 GameInventory destinationInventory = destination_entity.GetInventory();
10518 {
10521 }
10522
10523 if (new_item)
10524 {
10525 new_item.SetResultOfSplit(true);
10526 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10528 new_item.
SetQuantity(split_quantity_new,
false,
true);
10529 }
10530 }
10531 }
10532 else
10533 {
10534 if (stack_max != 0)
10535 {
10537 {
10539 }
10540
10541 if (split_quantity_new == 0)
10542 {
10543 if (!
g_Game.IsMultiplayer())
10544 player.PhysicalPredictiveDropItem(this);
10545 else
10546 player.ServerDropEntity(this);
10547 return;
10548 }
10549
10551 {
10553
10554 if (new_item)
10555 {
10556 new_item.SetResultOfSplit(true);
10557 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10560 new_item.PlaceOnSurface();
10561 }
10562 }
10563 }
10564 }
10565 }
10566
10568 {
10569 float split_quantity_new;
10573 InventoryLocation loc = new InventoryLocation;
10574
10575 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10576 {
10578 split_quantity_new = stack_max;
10579 else
10581
10583 {
10584 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10585 if (new_item)
10586 {
10587 new_item.SetResultOfSplit(true);
10588 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10590 new_item.
SetQuantity(split_quantity_new,
false,
true);
10591 }
10592 }
10593 }
10594 else if (destination_entity && slot_id == -1)
10595 {
10596 if (quantity > stack_max)
10597 split_quantity_new = stack_max;
10598 else
10599 split_quantity_new = quantity;
10600
10602 {
10603 GameInventory destinationInventory = destination_entity.GetInventory();
10605 {
10608 }
10609
10610 if (new_item)
10611 {
10612 new_item.SetResultOfSplit(true);
10613 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10615 new_item.
SetQuantity(split_quantity_new,
false,
true);
10616 }
10617 }
10618 }
10619 else
10620 {
10621 if (stack_max != 0)
10622 {
10624 {
10626 }
10627
10629 {
10631
10632 if (new_item)
10633 {
10634 new_item.SetResultOfSplit(true);
10635 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10638 new_item.PlaceOnSurface();
10639 }
10640 }
10641 }
10642 }
10643 }
10644
10646 {
10648 {
10649 if (ScriptInputUserData.CanStoreInputUserData())
10650 {
10651 ScriptInputUserData ctx = new ScriptInputUserData;
10656 dst.WriteToContext(ctx);
10658 }
10659 }
10660 else if (!
g_Game.IsMultiplayer())
10661 {
10663 }
10664 }
10665
10667 {
10669 {
10670 if (ScriptInputUserData.CanStoreInputUserData())
10671 {
10672 ScriptInputUserData ctx = new ScriptInputUserData;
10677 ctx.
Write(destination_entity);
10683 }
10684 }
10685 else if (!
g_Game.IsMultiplayer())
10686 {
10688 }
10689 }
10690
10692 {
10694 }
10695
10697 {
10699 float split_quantity_new;
10701 if (dst.IsValid())
10702 {
10703 int slot_id = dst.GetSlot();
10705
10706 if (quantity > stack_max)
10707 split_quantity_new = stack_max;
10708 else
10709 split_quantity_new = quantity;
10710
10712 {
10714
10715 if (new_item)
10716 {
10717 new_item.SetResultOfSplit(true);
10718 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10720 new_item.
SetQuantity(split_quantity_new,
false,
true);
10721 }
10722
10723 return new_item;
10724 }
10725 }
10726
10727 return null;
10728 }
10729
10731 {
10733 float split_quantity_new;
10735 if (destination_entity)
10736 {
10738 if (quantity > stackable)
10739 split_quantity_new = stackable;
10740 else
10741 split_quantity_new = quantity;
10742
10744 {
10745 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10746 if (new_item)
10747 {
10748 new_item.SetResultOfSplit(true);
10749 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10751 new_item.
SetQuantity(split_quantity_new,
false,
true);
10752 }
10753 }
10754 }
10755 }
10756
10758 {
10760 {
10761 if (ScriptInputUserData.CanStoreInputUserData())
10762 {
10763 ScriptInputUserData ctx = new ScriptInputUserData;
10768 ItemBase destination_entity =
this;
10769 ctx.
Write(destination_entity);
10773 }
10774 }
10775 else if (!
g_Game.IsMultiplayer())
10776 {
10778 }
10779 }
10780
10782 {
10784 float split_quantity_new;
10786 if (player)
10787 {
10789 if (quantity > stackable)
10790 split_quantity_new = stackable;
10791 else
10792 split_quantity_new = quantity;
10793
10795 {
10796 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10797 new_item =
ItemBase.Cast(in_hands);
10798 if (new_item)
10799 {
10800 new_item.SetResultOfSplit(true);
10801 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10803 new_item.SetQuantity(split_quantity_new, false, true);
10804 }
10805 }
10806 }
10807 }
10808
10810 {
10812 float split_quantity_new = Math.Floor(quantity * 0.5);
10813
10815 return;
10816
10818
10819 if (new_item)
10820 {
10821 if (new_item.GetQuantityMax() < split_quantity_new)
10822 {
10823 split_quantity_new = new_item.GetQuantityMax();
10824 }
10825
10826 new_item.SetResultOfSplit(true);
10827 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10828
10830 {
10833 }
10834 else
10835 {
10837 new_item.
SetQuantity(split_quantity_new,
false,
true);
10838 }
10839 }
10840 }
10841
10843 {
10845 float split_quantity_new = Math.Floor(quantity / 2);
10846
10848 return;
10849
10850 InventoryLocation invloc = new InventoryLocation;
10852
10854 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10855
10856 if (new_item)
10857 {
10858 if (new_item.GetQuantityMax() < split_quantity_new)
10859 {
10860 split_quantity_new = new_item.GetQuantityMax();
10861 }
10863 {
10866 }
10867 else if (split_quantity_new > 1)
10868 {
10870 new_item.
SetQuantity(split_quantity_new,
false,
true);
10871 }
10872 }
10873 }
10874
10877 {
10878 SetWeightDirty();
10880
10881 if (parent)
10882 parent.OnAttachmentQuantityChangedEx(this, delta);
10883
10885 {
10887 {
10889 }
10891 {
10892 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10894 }
10895 }
10896 }
10897
10900 {
10901
10902 }
10903
10906 {
10908 }
10909
10911 {
10912 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10913
10915 {
10916 if (newLevel == GameConstants.STATE_RUINED)
10917 {
10919 EntityAI parent = GetHierarchyParent();
10920 if (parent && parent.IsFireplace())
10921 {
10922 CargoBase cargo = GetInventory().GetCargo();
10923 if (cargo)
10924 {
10926 {
10928 }
10929 }
10930 }
10931 }
10932
10934 {
10935
10937 return;
10938 }
10939
10940 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10941 {
10943 }
10944 }
10945 }
10946
10947
10949 {
10950 super.OnRightClick();
10951
10953 {
10955 {
10956 if (ScriptInputUserData.CanStoreInputUserData())
10957 {
10958 EntityAI root = GetHierarchyRoot();
10959 Man playerOwner = GetHierarchyRootPlayer();
10960 InventoryLocation dst = new InventoryLocation;
10961
10962
10963 if (!playerOwner && root && root == this)
10964 {
10966 }
10967 else
10968 {
10969
10970 GetInventory().GetCurrentInventoryLocation(dst);
10972 {
10973 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10975 {
10977 }
10978 else
10979 {
10981
10982
10983 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10984 {
10986 }
10987 else
10988 {
10989 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10990 }
10991 }
10992 }
10993 }
10994
10995 ScriptInputUserData ctx = new ScriptInputUserData;
11003 }
11004 }
11005 else if (!
g_Game.IsMultiplayer())
11006 {
11008 }
11009 }
11010 }
11011
11013 {
11014 if (root)
11015 {
11016 vector m4[4];
11017 root.GetTransform(m4);
11018 dst.SetGround(this, m4);
11019 }
11020 else
11021 {
11022 GetInventory().GetCurrentInventoryLocation(dst);
11023 }
11024 }
11025
11026 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11027 {
11028
11029 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11030 return false;
11031
11032 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11033 return false;
11034
11035
11037 return false;
11038
11039
11040 Magazine mag = Magazine.Cast(this);
11041 if (mag)
11042 {
11043 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11044 return false;
11045
11046 if (stack_max_limit)
11047 {
11048 Magazine other_mag = Magazine.Cast(other_item);
11049 if (other_item)
11050 {
11051 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11052 return false;
11053 }
11054
11055 }
11056 }
11057 else
11058 {
11059
11061 return false;
11062
11064 return false;
11065 }
11066
11067 PlayerBase player = null;
11068 if (CastTo(player, GetHierarchyRootPlayer()))
11069 {
11070 if (player.GetInventory().HasAttachment(this))
11071 return false;
11072
11073 if (player.IsItemsToDelete())
11074 return false;
11075 }
11076
11077 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11078 return false;
11079
11080 int slotID;
11082 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11083 return false;
11084
11085 return true;
11086 }
11087
11089 {
11091 }
11092
11094 {
11095 return m_IsResultOfSplit;
11096 }
11097
11099 {
11100 m_IsResultOfSplit = value;
11101 }
11102
11104 {
11106 }
11107
11109 {
11110 float other_item_quantity = other_item.GetQuantity();
11111 float this_free_space;
11112
11114
11116
11117 if (other_item_quantity > this_free_space)
11118 {
11119 return this_free_space;
11120 }
11121 else
11122 {
11123 return other_item_quantity;
11124 }
11125 }
11126
11128 {
11130 }
11131
11133 {
11135 return;
11136
11137 if (!IsMagazine() && other_item)
11138 {
11140 if (quantity_used != 0)
11141 {
11142 float hp1 = GetHealth01("","");
11143 float hp2 = other_item.GetHealth01("","");
11144 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11145 hpResult = hpResult / (
GetQuantity() + quantity_used);
11146
11147 hpResult *= GetMaxHealth();
11148 Math.Round(hpResult);
11149 SetHealth("", "Health", hpResult);
11150
11152 other_item.AddQuantity(-quantity_used);
11153 }
11154 }
11156 }
11157
11159 {
11160 #ifdef SERVER
11161 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11162 GetHierarchyParent().IncreaseLifetimeUp();
11163 #endif
11164 };
11165
11167 {
11168 PlayerBase p = PlayerBase.Cast(player);
11169
11170 array<int> recipesIds = p.m_Recipes;
11171 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11172 if (moduleRecipesManager)
11173 {
11174 EntityAI itemInHands = player.GetEntityInHands();
11175 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11176 }
11177
11178 for (int i = 0;i < recipesIds.Count(); i++)
11179 {
11180 int key = recipesIds.Get(i);
11181 string recipeName = moduleRecipesManager.GetRecipeName(key);
11183 }
11184 }
11185
11186
11187 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11188 {
11189 super.GetDebugActions(outputList);
11190
11191
11197
11198
11203
11208
11209
11213
11214
11216 {
11220 }
11221
11224
11225
11229
11231
11232 InventoryLocation loc = new InventoryLocation();
11233 GetInventory().GetCurrentInventoryLocation(loc);
11235 {
11236 if (Gizmo_IsSupported())
11239 }
11240
11242 }
11243
11244
11245
11246
11248 {
11249 super.OnAction(action_id, player, ctx);
11250
11252 {
11253 switch (action_id)
11254 {
11258 return true;
11262 return true;
11263 }
11264 }
11265
11267 {
11268 switch (action_id)
11269 {
11271 Delete();
11272 return true;
11273 }
11274 }
11275
11276 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11277 {
11278 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11279 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11280 PlayerBase p = PlayerBase.Cast(player);
11281 if (
EActions.RECIPES_RANGE_START < 1000)
11282 {
11283 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11284 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11285 }
11286 }
11287 #ifndef SERVER
11288 else if (action_id ==
EActions.WATCH_PLAYER)
11289 {
11290 PluginDeveloper.SetDeveloperItemClientEx(player);
11291 }
11292 #endif
11294 {
11295 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11296 {
11297 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11298 OnDebugButtonPressServer(id + 1);
11299 }
11300
11301 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11302 {
11303 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11305 }
11306
11307 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11308 {
11309 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11311 }
11312
11313 else if (action_id ==
EActions.ADD_QUANTITY)
11314 {
11315 if (IsMagazine())
11316 {
11317 Magazine mag = Magazine.Cast(this);
11318 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11319 }
11320 else
11321 {
11323 }
11324
11325 if (m_EM)
11326 {
11327 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11328 }
11329
11330 }
11331
11332 else if (action_id ==
EActions.REMOVE_QUANTITY)
11333 {
11334 if (IsMagazine())
11335 {
11336 Magazine mag2 = Magazine.Cast(this);
11337 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11338 }
11339 else
11340 {
11342 }
11343 if (m_EM)
11344 {
11345 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11346 }
11347
11348 }
11349
11350 else if (action_id ==
EActions.SET_QUANTITY_0)
11351 {
11353
11354 if (m_EM)
11355 {
11356 m_EM.SetEnergy(0);
11357 }
11358 }
11359
11360 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11361 {
11363
11364 if (m_EM)
11365 {
11366 m_EM.SetEnergy(m_EM.GetEnergyMax());
11367 }
11368 }
11369
11370 else if (action_id ==
EActions.ADD_HEALTH)
11371 {
11372 AddHealth("","",GetMaxHealth("","Health")/5);
11373 }
11374 else if (action_id ==
EActions.REMOVE_HEALTH)
11375 {
11376 AddHealth("","",-GetMaxHealth("","Health")/5);
11377 }
11378 else if (action_id ==
EActions.DESTROY_HEALTH)
11379 {
11380 SetHealth01("","",0);
11381 }
11382 else if (action_id ==
EActions.WATCH_ITEM)
11383 {
11385 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11386 #ifdef DEVELOPER
11387 SetDebugDeveloper_item(this);
11388 #endif
11389 }
11390
11391 else if (action_id ==
EActions.ADD_TEMPERATURE)
11392 {
11393 AddTemperature(20);
11394
11395 }
11396
11397 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11398 {
11399 AddTemperature(-20);
11400
11401 }
11402
11403 else if (action_id ==
EActions.FLIP_FROZEN)
11404 {
11405 SetFrozen(!GetIsFrozen());
11406
11407 }
11408
11409 else if (action_id ==
EActions.ADD_WETNESS)
11410 {
11412
11413 }
11414
11415 else if (action_id ==
EActions.REMOVE_WETNESS)
11416 {
11418
11419 }
11420
11421 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11422 {
11425
11426
11427 }
11428
11429 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11430 {
11433 }
11434
11435 else if (action_id ==
EActions.MAKE_SPECIAL)
11436 {
11437 auto debugParams = DebugSpawnParams.WithPlayer(player);
11438 OnDebugSpawnEx(debugParams);
11439 }
11440
11441 }
11442
11443
11444 return false;
11445 }
11446
11447
11448
11449
11453
11456
11457
11458
11460 {
11461 return false;
11462 }
11463
11464
11466 {
11467 return true;
11468 }
11469
11470
11472 {
11473 return true;
11474 }
11475
11476
11477
11479 {
11480 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11481 return g_Game.ConfigIsExisting(config_path);
11482 }
11483
11486 {
11487 return null;
11488 }
11489
11491 {
11492 return false;
11493 }
11494
11496 {
11497 return false;
11498 }
11499
11503
11504
11506 {
11507 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11508 return module_repairing.CanRepair(this, item_repair_kit);
11509 }
11510
11511
11512 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11513 {
11514 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11515 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11516 }
11517
11518
11520 {
11521
11522
11523
11524
11525
11526
11527
11528
11529 return 1;
11530 }
11531
11532
11533
11535 {
11537 }
11538
11539
11540
11542 {
11544 }
11545
11546
11555 {
11556 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11557
11558 if (player)
11559 {
11560 player.MessageStatus(text);
11561 }
11562 }
11563
11564
11573 {
11574 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11575
11576 if (player)
11577 {
11578 player.MessageAction(text);
11579 }
11580 }
11581
11582
11591 {
11592 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11593
11594 if (player)
11595 {
11596 player.MessageFriendly(text);
11597 }
11598 }
11599
11600
11609 {
11610 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11611
11612 if (player)
11613 {
11614 player.MessageImportant(text);
11615 }
11616 }
11617
11619 {
11620 return true;
11621 }
11622
11623
11624 override bool KindOf(
string tag)
11625 {
11626 bool found = false;
11627 string item_name = this.
GetType();
11629 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11630
11631 int array_size = item_tag_array.Count();
11632 for (int i = 0; i < array_size; i++)
11633 {
11634 if (item_tag_array.Get(i) == tag)
11635 {
11636 found = true;
11637 break;
11638 }
11639 }
11640 return found;
11641 }
11642
11643
11645 {
11646
11647 super.OnRPC(sender, rpc_type,ctx);
11648
11649
11650 switch (rpc_type)
11651 {
11652 #ifndef SERVER
11653 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11654 Param2<bool, string> p = new Param2<bool, string>(false, "");
11655
11657 return;
11658
11659 bool play = p.param1;
11660 string soundSet = p.param2;
11661
11662 if (play)
11663 {
11665 {
11667 {
11669 }
11670 }
11671 else
11672 {
11674 }
11675 }
11676 else
11677 {
11679 }
11680
11681 break;
11682 #endif
11683
11684 }
11685
11687 {
11689 }
11690 }
11691
11692
11693
11694
11696 {
11697 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11698 return plugin.GetID(
name);
11699 }
11700
11702 {
11703 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11704 return plugin.GetName(id);
11705 }
11706
11709 {
11710
11711
11712 int varFlags;
11713 if (!ctx.
Read(varFlags))
11714 return;
11715
11716 if (varFlags & ItemVariableFlags.FLOAT)
11717 {
11719 }
11720 }
11721
11723 {
11724
11725 super.SerializeNumericalVars(floats_out);
11726
11727
11728
11730 {
11732 }
11733
11735 {
11737 }
11738
11740 {
11742 }
11743
11745 {
11750 }
11751
11753 {
11755 }
11756 }
11757
11759 {
11760
11761 super.DeSerializeNumericalVars(floats);
11762
11763
11764 int index = 0;
11765 int mask = Math.Round(floats.Get(index));
11766
11767 index++;
11768
11770 {
11772 {
11774 }
11775 else
11776 {
11777 float quantity = floats.Get(index);
11778 SetQuantity(quantity,
true,
false,
false,
false);
11779 }
11780 index++;
11781 }
11782
11784 {
11785 float wet = floats.Get(index);
11787 index++;
11788 }
11789
11791 {
11792 int liquidtype = Math.Round(floats.Get(index));
11794 index++;
11795 }
11796
11798 {
11800 index++;
11802 index++;
11804 index++;
11806 index++;
11807 }
11808
11810 {
11811 int cleanness = Math.Round(floats.Get(index));
11813 index++;
11814 }
11815 }
11816
11818 {
11819 super.WriteVarsToCTX(ctx);
11820
11821
11823 {
11825 }
11826
11828 {
11830 }
11831
11833 {
11835 }
11836
11838 {
11839 int r,g,b,a;
11845 }
11846
11848 {
11850 }
11851 }
11852
11854 {
11855 if (!super.ReadVarsFromCTX(ctx,version))
11856 return false;
11857
11858 int intValue;
11859 float value;
11860
11861 if (version < 140)
11862 {
11863 if (!ctx.
Read(intValue))
11864 return false;
11865
11866 m_VariablesMask = intValue;
11867 }
11868
11870 {
11871 if (!ctx.
Read(value))
11872 return false;
11873
11875 {
11877 }
11878 else
11879 {
11881 }
11882 }
11883
11884 if (version < 140)
11885 {
11887 {
11888 if (!ctx.
Read(value))
11889 return false;
11890 SetTemperatureDirect(value);
11891 }
11892 }
11893
11895 {
11896 if (!ctx.
Read(value))
11897 return false;
11899 }
11900
11902 {
11903 if (!ctx.
Read(intValue))
11904 return false;
11906 }
11907
11909 {
11910 int r,g,b,a;
11912 return false;
11914 return false;
11916 return false;
11918 return false;
11919
11921 }
11922
11924 {
11925 if (!ctx.
Read(intValue))
11926 return false;
11928 }
11929
11930 if (version >= 138 && version < 140)
11931 {
11933 {
11934 if (!ctx.
Read(intValue))
11935 return false;
11936 SetFrozen(intValue);
11937 }
11938 }
11939
11940 return true;
11941 }
11942
11943
11945 {
11948 {
11950 }
11951
11952 if (!super.OnStoreLoad(ctx, version))
11953 {
11955 return false;
11956 }
11957
11958 if (version >= 114)
11959 {
11960 bool hasQuickBarIndexSaved;
11961
11962 if (!ctx.
Read(hasQuickBarIndexSaved))
11963 {
11965 return false;
11966 }
11967
11968 if (hasQuickBarIndexSaved)
11969 {
11970 int itmQBIndex;
11971
11972
11973 if (!ctx.
Read(itmQBIndex))
11974 {
11976 return false;
11977 }
11978
11979 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11980 if (itmQBIndex != -1 && parentPlayer)
11981 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11982 }
11983 }
11984 else
11985 {
11986
11987 PlayerBase player;
11988 int itemQBIndex;
11989 if (version ==
int.
MAX)
11990 {
11991 if (!ctx.
Read(itemQBIndex))
11992 {
11994 return false;
11995 }
11996 }
11997 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11998 {
11999
12000 if (!ctx.
Read(itemQBIndex))
12001 {
12003 return false;
12004 }
12005 if (itemQBIndex != -1 && player)
12006 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12007 }
12008 }
12009
12010 if (version < 140)
12011 {
12012
12013 if (!LoadVariables(ctx, version))
12014 {
12016 return false;
12017 }
12018 }
12019
12020
12022 {
12024 return false;
12025 }
12026 if (version >= 132)
12027 {
12029 if (raib)
12030 {
12032 {
12034 return false;
12035 }
12036 }
12037 }
12038
12040 return true;
12041 }
12042
12043
12044
12046 {
12047 super.OnStoreSave(ctx);
12048
12049 PlayerBase player;
12050 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12051 {
12053
12054 int itemQBIndex = -1;
12055 itemQBIndex = player.FindQuickBarEntityIndex(this);
12056 ctx.
Write(itemQBIndex);
12057 }
12058 else
12059 {
12061 }
12062
12064
12066 if (raib)
12067 {
12069 }
12070 }
12071
12072
12074 {
12075 super.AfterStoreLoad();
12076
12078 {
12080 }
12081
12083 {
12086 }
12087 }
12088
12090 {
12091 super.EEOnAfterLoad();
12092
12094 {
12096 }
12097
12100 }
12101
12103 {
12104 return false;
12105 }
12106
12107
12108
12110 {
12112 {
12113 #ifdef PLATFORM_CONSOLE
12114
12116 {
12118 if (menu)
12119 {
12121 }
12122 }
12123 #endif
12124 }
12125
12127 {
12130 }
12131
12133 {
12134 SetWeightDirty();
12136 }
12138 {
12141 }
12142
12144 {
12147
12150 }
12152 {
12156 }
12157
12158 super.OnVariablesSynchronized();
12159 }
12160
12161
12162
12164 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12165 {
12166 if (!IsServerCheck(allow_client))
12167 return false;
12168
12170 return false;
12171
12174
12175 if (value <= (min + 0.001))
12176 value = min;
12177
12178 if (value == min)
12179 {
12180 if (destroy_config)
12181 {
12182 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12183 if (dstr)
12184 {
12186 this.Delete();
12187 return true;
12188 }
12189 }
12190 else if (destroy_forced)
12191 {
12193 this.Delete();
12194 return true;
12195 }
12196
12198 }
12199
12202
12204 {
12205 EntityAI parent = GetHierarchyRoot();
12206 InventoryLocation iLoc = new InventoryLocation();
12207 GetInventory().GetCurrentInventoryLocation(iLoc);
12209 {
12210 int iLocSlot = iLoc.
GetSlot();
12212 {
12214 }
12216 {
12218 }
12219 }
12220 }
12221
12223 {
12225
12226 if (delta)
12228 }
12229
12231
12232 return false;
12233 }
12234
12235
12237 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12238 {
12240 }
12241
12243 {
12246 }
12247
12249 {
12252 }
12253
12255 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12256 {
12257 float value_clamped = Math.Clamp(value, 0, 1);
12259 SetQuantity(result, destroy_config, destroy_forced);
12260 }
12261
12262
12265 {
12267 }
12268
12270 {
12272 }
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12284 {
12285 int slot = -1;
12286 GameInventory inventory = GetInventory();
12287 if (inventory)
12288 {
12289 InventoryLocation il = new InventoryLocation;
12292 }
12293
12295 }
12296
12298 {
12299 float quantity_max = 0;
12300
12302 {
12303 if (attSlotID != -1)
12304 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12305
12306 if (quantity_max <= 0)
12308 }
12309
12310 if (quantity_max <= 0)
12312
12313 return quantity_max;
12314 }
12315
12317 {
12319 }
12320
12322 {
12324 }
12325
12326
12328 {
12330 }
12331
12333 {
12335 }
12336
12338 {
12340 }
12341
12342
12344 {
12345
12346 float weightEx = GetWeightEx();
12347 float special = GetInventoryAndCargoWeight();
12348 return weightEx - special;
12349 }
12350
12351
12353 {
12355 }
12356
12358 {
12360 {
12361 #ifdef DEVELOPER
12362 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12363 {
12364 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12366 }
12367 #endif
12368
12369 return GetQuantity() * GetConfigWeightModified();
12370 }
12371 else if (HasEnergyManager())
12372 {
12373 #ifdef DEVELOPER
12374 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12375 {
12376 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12377 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12378 }
12379 #endif
12380 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12381 }
12382 else
12383 {
12384 #ifdef DEVELOPER
12385 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12386 {
12387 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12388 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12389 }
12390 #endif
12391 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12392 }
12393 }
12394
12397 {
12398 int item_count = 0;
12400
12401 GameInventory inventory = GetInventory();
12402 CargoBase cargo = inventory.
GetCargo();
12403 if (cargo != NULL)
12404 {
12406 }
12407
12409 for (int i = 0; i < nAttachments; ++i)
12410 {
12412 if (item)
12413 item_count += item.GetNumberOfItems();
12414 }
12415 return item_count;
12416 }
12417
12420 {
12421 float weight = 0;
12422 float wetness = 1;
12423 if (include_wetness)
12426 {
12427 weight = wetness * m_ConfigWeight;
12428 }
12430 {
12431 weight = 1;
12432 }
12433 return weight;
12434 }
12435
12436
12437
12439 {
12440 GameInventory inventory = GetInventory();
12441 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12442 {
12443 array<EntityAI> items = new array<EntityAI>;
12445 for (int i = 0; i < items.Count(); ++i)
12446 {
12448 if (item)
12449 {
12450 g_Game.ObjectDelete(item);
12451 }
12452 }
12453 }
12454 }
12455
12456
12457
12458
12460 {
12461 float energy = 0;
12462 if (HasEnergyManager())
12463 {
12464 energy = GetCompEM().GetEnergy();
12465 }
12466 return energy;
12467 }
12468
12469
12471 {
12472 super.OnEnergyConsumed();
12473
12475 }
12476
12478 {
12479 super.OnEnergyAdded();
12480
12482 }
12483
12484
12486 {
12487 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12488 {
12490 {
12491 float energy_0to1 = GetCompEM().GetEnergy0To1();
12493 }
12494 }
12495 }
12496
12497
12499 {
12500 return ConfigGetFloat("heatIsolation");
12501 }
12502
12504 {
12506 }
12507
12509 {
12510 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12511 if (
g_Game.ConfigIsExisting(paramPath))
12512 return g_Game.ConfigGetFloat(paramPath);
12513
12514 return 0.0;
12515 }
12516
12518 {
12519 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12520 if (
g_Game.ConfigIsExisting(paramPath))
12521 return g_Game.ConfigGetFloat(paramPath);
12522
12523 return 0.0;
12524 }
12525
12526 override void SetWet(
float value,
bool allow_client =
false)
12527 {
12528 if (!IsServerCheck(allow_client))
12529 return;
12530
12533
12535
12536 m_VarWet = Math.Clamp(value, min, max);
12537
12539 {
12542 }
12543 }
12544
12545 override void AddWet(
float value)
12546 {
12548 }
12549
12551 {
12553 }
12554
12556 {
12558 }
12559
12561 {
12563 }
12564
12566 {
12568 }
12569
12571 {
12573 }
12574
12575 override void OnWetChanged(
float newVal,
float oldVal)
12576 {
12579 if (newLevel != oldLevel)
12580 {
12582 }
12583 }
12584
12586 {
12587 SetWeightDirty();
12588 }
12589
12591 {
12592 return GetWetLevelInternal(
m_VarWet);
12593 }
12594
12595
12596
12598 {
12600 }
12601
12603 {
12605 }
12606
12608 {
12610 }
12611
12613 {
12615 }
12616
12617
12618
12620 {
12621 if (ConfigIsExisting("itemModelLength"))
12622 {
12623 return ConfigGetFloat("itemModelLength");
12624 }
12625 return 0;
12626 }
12627
12629 {
12630 if (ConfigIsExisting("itemAttachOffset"))
12631 {
12632 return ConfigGetFloat("itemAttachOffset");
12633 }
12634 return 0;
12635 }
12636
12637 override void SetCleanness(
int value,
bool allow_client =
false)
12638 {
12639 if (!IsServerCheck(allow_client))
12640 return;
12641
12643
12645
12648 }
12649
12651 {
12653 }
12654
12656 {
12657 return true;
12658 }
12659
12660
12661
12662
12664 {
12666 }
12667
12669 {
12671 }
12672
12673
12674
12675
12676 override void SetColor(
int r,
int g,
int b,
int a)
12677 {
12683 }
12685 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12686 {
12691 }
12692
12694 {
12696 }
12697
12700 {
12701 int r,g,b,a;
12703 r = r/255;
12704 g = g/255;
12705 b = b/255;
12706 a = a/255;
12707 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12708 }
12709
12710
12711
12712 override void SetLiquidType(
int value,
bool allow_client =
false)
12713 {
12714 if (!IsServerCheck(allow_client))
12715 return;
12716
12721 }
12722
12724 {
12725 return ConfigGetInt("varLiquidTypeInit");
12726 }
12727
12729 {
12731 }
12732
12734 {
12736 SetFrozen(false);
12737 }
12738
12741 {
12742 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12743 }
12744
12745
12748 {
12749 PlayerBase nplayer;
12750 if (PlayerBase.CastTo(nplayer, player))
12751 {
12753 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12754 }
12755 }
12756
12757
12760 {
12761 PlayerBase nplayer;
12762 if (PlayerBase.CastTo(nplayer,player))
12763 {
12764 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12765 }
12766
12767 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12768
12769 if (HasEnergyManager())
12770 {
12771 GetCompEM().UpdatePlugState();
12772 }
12773 }
12774
12775
12777 {
12778 super.OnPlacementStarted(player);
12779
12781 }
12782
12783 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12784 {
12786 {
12787 m_AdminLog.OnPlacementComplete(player,
this);
12788 }
12789
12790 super.OnPlacementComplete(player, position, orientation);
12791 }
12792
12793
12794
12795
12796
12798 {
12800 {
12801 return true;
12802 }
12803 else
12804 {
12805 return false;
12806 }
12807 }
12808
12809
12811 {
12813 {
12815 }
12816 }
12817
12818
12820 {
12822 }
12823
12825 {
12827 }
12828
12829 override void InsertAgent(
int agent,
float count = 1)
12830 {
12831 if (count < 1)
12832 return;
12833
12835 }
12836
12839 {
12841 }
12842
12843
12845 {
12847 }
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12891 {
12893 return false;
12894 return true;
12895 }
12896
12898 {
12899
12901 }
12902
12903
12906 {
12907 super.CheckForRoofLimited(timeTresholdMS);
12908
12909 float time =
g_Game.GetTime();
12910 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12911 {
12912 m_PreviousRoofTestTime = time;
12913 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12914 }
12915 }
12916
12917
12919 {
12921 {
12922 return 0;
12923 }
12924
12925 if (GetInventory().GetAttachmentSlotsCount() != 0)
12926 {
12927 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12928 if (filter)
12929 return filter.GetProtectionLevel(type, false, system);
12930 else
12931 return 0;
12932 }
12933
12934 string subclassPath, entryName;
12935
12936 switch (type)
12937 {
12939 entryName = "biological";
12940 break;
12942 entryName = "chemical";
12943 break;
12944 default:
12945 entryName = "biological";
12946 break;
12947 }
12948
12949 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12950
12951 return g_Game.ConfigGetFloat(subclassPath + entryName);
12952 }
12953
12954
12955
12958 {
12959 if (!IsMagazine())
12961
12963 }
12964
12965
12966
12967
12968
12973 {
12974 return true;
12975 }
12976
12978 {
12980 }
12981
12982
12983
12984
12985
12987 {
12988 if (parent)
12989 {
12990 if (parent.IsInherited(DayZInfected))
12991 return true;
12992
12993 if (!parent.IsRuined())
12994 return true;
12995 }
12996
12997 return true;
12998 }
12999
13001 {
13002 if (!super.CanPutAsAttachment(parent))
13003 {
13004 return false;
13005 }
13006
13007 if (!IsRuined() && !parent.IsRuined())
13008 {
13009 return true;
13010 }
13011
13012 return false;
13013 }
13014
13016 {
13017
13018
13019
13020
13021 return super.CanReceiveItemIntoCargo(item);
13022 }
13023
13025 {
13026
13027
13028
13029
13030 GameInventory attachmentInv = attachment.GetInventory();
13032 {
13033 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13034 return false;
13035 }
13036
13037 InventoryLocation loc = new InventoryLocation();
13038 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13039 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13040 return false;
13041
13042 return super.CanReceiveAttachment(attachment, slotId);
13043 }
13044
13046 {
13047 if (!super.CanReleaseAttachment(attachment))
13048 return false;
13049
13050 return GetInventory().AreChildrenAccessible();
13051 }
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13074 {
13075 int id = muzzle_owner.GetMuzzleID();
13076 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13077
13078 if (WPOF_array)
13079 {
13080 for (int i = 0; i < WPOF_array.Count(); i++)
13081 {
13082 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13083
13084 if (WPOF)
13085 {
13086 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13087 }
13088 }
13089 }
13090 }
13091
13092
13094 {
13095 int id = muzzle_owner.GetMuzzleID();
13097
13098 if (WPOBE_array)
13099 {
13100 for (int i = 0; i < WPOBE_array.Count(); i++)
13101 {
13102 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13103
13104 if (WPOBE)
13105 {
13106 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13107 }
13108 }
13109 }
13110 }
13111
13112
13114 {
13115 int id = muzzle_owner.GetMuzzleID();
13116 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13117
13118 if (WPOOH_array)
13119 {
13120 for (int i = 0; i < WPOOH_array.Count(); i++)
13121 {
13122 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13123
13124 if (WPOOH)
13125 {
13126 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13127 }
13128 }
13129 }
13130 }
13131
13132
13134 {
13135 int id = muzzle_owner.GetMuzzleID();
13136 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13137
13138 if (WPOOH_array)
13139 {
13140 for (int i = 0; i < WPOOH_array.Count(); i++)
13141 {
13142 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13143
13144 if (WPOOH)
13145 {
13146 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13147 }
13148 }
13149 }
13150 }
13151
13152
13154 {
13155 int id = muzzle_owner.GetMuzzleID();
13156 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13157
13158 if (WPOOH_array)
13159 {
13160 for (int i = 0; i < WPOOH_array.Count(); i++)
13161 {
13162 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13163
13164 if (WPOOH)
13165 {
13166 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13167 }
13168 }
13169 }
13170 }
13171
13172
13173
13175 {
13177 {
13178 return true;
13179 }
13180
13181 return false;
13182 }
13183
13185 {
13187 {
13188 return true;
13189 }
13190
13191 return false;
13192 }
13193
13195 {
13197 {
13198 return true;
13199 }
13200
13201 return false;
13202 }
13203
13205 {
13206 return false;
13207 }
13208
13211 {
13212 return UATimeSpent.DEFAULT_DEPLOY;
13213 }
13214
13215
13216
13217
13219 {
13221 SetSynchDirty();
13222 }
13223
13225 {
13227 }
13228
13229
13231 {
13232 return false;
13233 }
13234
13237 {
13238 string att_type = "None";
13239
13240 if (ConfigIsExisting("soundAttType"))
13241 {
13242 att_type = ConfigGetString("soundAttType");
13243 }
13244
13246 }
13247
13249 {
13251 }
13252
13253
13254
13255
13256
13262
13264 {
13267
13269 }
13270
13271
13273 {
13275 return;
13276
13278
13281
13284
13285 SoundParameters params = new SoundParameters();
13289 }
13290
13291
13293 {
13295 {
13298
13299 SetSynchDirty();
13300
13303 }
13304 }
13305
13307 {
13309 }
13310
13311
13313 {
13315 return;
13316
13318 SetSynchDirty();
13319
13322 }
13323
13325 {
13328 }
13329
13331 {
13333 }
13334
13335 void OnApply(PlayerBase player);
13336
13338 {
13339 return 1.0;
13340 };
13341
13343 {
13345 }
13346
13348 {
13350 }
13351
13353
13355 {
13356 SetDynamicPhysicsLifeTime(0.01);
13358 }
13359
13361 {
13362 array<string> zone_names = new array<string>;
13363 GetDamageZones(zone_names);
13364 for (int i = 0; i < zone_names.Count(); i++)
13365 {
13366 SetHealthMax(zone_names.Get(i),"Health");
13367 }
13368 SetHealthMax("","Health");
13369 }
13370
13373 {
13374 float global_health = GetHealth01("","Health");
13375 array<string> zones = new array<string>;
13376 GetDamageZones(zones);
13377
13378 for (int i = 0; i < zones.Count(); i++)
13379 {
13380 SetHealth01(zones.Get(i),"Health",global_health);
13381 }
13382 }
13383
13386 {
13387 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13388 }
13389
13391 {
13392 if (!hasRootAsPlayer)
13393 {
13394 if (refParentIB)
13395 {
13396
13397 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13398 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13399
13400 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13401 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13402
13405 }
13406 else
13407 {
13408
13411 }
13412 }
13413 }
13414
13416 {
13418 {
13419 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13420 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13421 {
13422 float heatPermCoef = 1.0;
13424 while (ent)
13425 {
13426 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13427 ent = ent.GetHierarchyParent();
13428 }
13429
13430 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13431 }
13432 }
13433 }
13434
13436 {
13437
13438 EntityAI parent = GetHierarchyParent();
13439 if (!parent)
13440 {
13441 hasParent = false;
13442 hasRootAsPlayer = false;
13443 }
13444 else
13445 {
13446 hasParent = true;
13447 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13448 refParentIB =
ItemBase.Cast(parent);
13449 }
13450 }
13451
13452 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13453 {
13454
13455 }
13456
13458 {
13459
13460 return false;
13461 }
13462
13464 {
13465
13466
13467 return false;
13468 }
13469
13471 {
13472
13473 return false;
13474 }
13475
13478 {
13479 return !GetIsFrozen() &&
IsOpen();
13480 }
13481
13483 {
13484 bool hasParent = false, hasRootAsPlayer = false;
13486
13487 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13488 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13489
13490 if (wwtu || foodDecay)
13491 {
13495
13496 if (processWetness || processTemperature || processDecay)
13497 {
13499
13500 if (processWetness)
13501 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13502
13503 if (processTemperature)
13505
13506 if (processDecay)
13507 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13508 }
13509 }
13510 }
13511
13514 {
13516 }
13517
13519 {
13522
13523 return super.GetTemperatureFreezeThreshold();
13524 }
13525
13527 {
13530
13531 return super.GetTemperatureThawThreshold();
13532 }
13533
13535 {
13538
13539 return super.GetItemOverheatThreshold();
13540 }
13541
13543 {
13545 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13546
13547 return super.GetTemperatureFreezeTime();
13548 }
13549
13551 {
13553 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13554
13555 return super.GetTemperatureThawTime();
13556 }
13557
13562
13564 {
13565 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13566 }
13567
13569 {
13570 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13571 }
13572
13575 {
13577 }
13578
13580 {
13582 }
13583
13585 {
13587 }
13588
13591 {
13592 return null;
13593 }
13594
13597 {
13598 return false;
13599 }
13600
13602 {
13604 {
13607 if (!trg)
13608 {
13610 explosive = this;
13611 }
13612
13613 explosive.PairRemote(trg);
13615
13616 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13617 trg.SetPersistentPairID(persistentID);
13618 explosive.SetPersistentPairID(persistentID);
13619
13620 return true;
13621 }
13622 return false;
13623 }
13624
13627 {
13628 float ret = 1.0;
13631 ret *= GetHealth01();
13632
13633 return ret;
13634 }
13635
13636 #ifdef DEVELOPER
13637 override void SetDebugItem()
13638 {
13639 super.SetDebugItem();
13640 _itemBase = this;
13641 }
13642
13644 {
13645 string text = super.GetDebugText();
13646
13648 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13649
13650 return text;
13651 }
13652 #endif
13653
13655 {
13656 return true;
13657 }
13658
13660
13662
13664 {
13667 }
13668
13669
13677
13693
13694 [
Obsolete(
"Use ItemSoundHandler instead")]
13697 {
13698 if (!
g_Game.IsDedicatedServer())
13699 {
13700 if (ConfigIsExisting("attachSoundSet"))
13701 {
13702 string cfg_path = "";
13703 string soundset = "";
13704 string type_name =
GetType();
13705
13708 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13709 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13710
13711 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13712 {
13713 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13714 {
13715 if (cfg_slot_array[i] == slot_type)
13716 {
13717 soundset = cfg_soundset_array[i];
13718 break;
13719 }
13720 }
13721 }
13722
13723 if (soundset != "")
13724 {
13725 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13727 }
13728 }
13729 }
13730 }
13731
13733}
13734
13736{
13738 if (entity)
13739 {
13740 bool is_item = entity.IsInherited(
ItemBase);
13741 if (is_item && full_quantity)
13742 {
13745 }
13746 }
13747 else
13748 {
13750 return NULL;
13751 }
13752 return entity;
13753}
13754
13756{
13757 if (item)
13758 {
13759 if (health > 0)
13760 item.SetHealth("", "", health);
13761
13762 if (item.CanHaveTemperature())
13763 {
13765 if (item.CanFreeze())
13766 item.SetFrozen(false);
13767 }
13768
13769 if (item.HasEnergyManager())
13770 {
13771 if (quantity >= 0)
13772 {
13773 item.GetCompEM().SetEnergy0To1(quantity);
13774 }
13775 else
13776 {
13778 }
13779 }
13780 else if (item.IsMagazine())
13781 {
13782 Magazine mag = Magazine.Cast(item);
13783 if (quantity >= 0)
13784 {
13785 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13786 }
13787 else
13788 {
13790 }
13791
13792 }
13793 else
13794 {
13795 if (quantity >= 0)
13796 {
13797 item.SetQuantityNormalized(quantity, false);
13798 }
13799 else
13800 {
13802 }
13803
13804 }
13805 }
13806}
13807
13808#ifdef DEVELOPER
13810#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.