8976{
8978 {
8979 return true;
8980 }
8981};
8982
8984{
8985
8986};
8987
8988
8989
8991{
8995
8997
9000
9001
9002
9003
9004
9013
9019
9024
9029
9050 protected bool m_IsResultOfSplit
9051
9053
9058
9059
9060
9062
9066
9067
9068
9070
9073
9074
9075
9081
9082
9090
9093
9094
9096
9097
9099
9100
9105
9106
9111
9113
9114
9116
9117
9119 {
9124
9125 if (!
g_Game.IsDedicatedServer())
9126 {
9128 {
9130
9132 {
9134 }
9135 }
9136
9139 }
9140
9141 m_OldLocation = null;
9142
9144 {
9146 }
9147
9148 if (ConfigIsExisting("headSelectionsToHide"))
9149 {
9152 }
9153
9155 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9156 {
9158 }
9159
9161
9162 m_IsResultOfSplit = false;
9163
9165 }
9166
9168 {
9169 super.InitItemVariables();
9170
9176 m_Count = ConfigGetInt(
"count");
9177
9180
9185
9188
9193
9205
9209
9210
9213 if (ConfigIsExisting("canBeSplit"))
9214 {
9217 }
9218
9220 if (ConfigIsExisting("itemBehaviour"))
9222
9223
9226 RegisterNetSyncVariableInt("m_VarLiquidType");
9227 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9228
9229 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9230 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9231 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9232
9233 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9234 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9235 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9236 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9237
9238 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9239 RegisterNetSyncVariableBool("m_IsTakeable");
9240 RegisterNetSyncVariableBool("m_IsHologram");
9241
9244 {
9247 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9248 }
9249
9251
9253 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9255
9257 }
9258
9260 {
9262 }
9263
9265 {
9268 {
9273 }
9274 }
9275
9276 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9277 {
9279 {
9282 }
9283
9285 }
9286
9288 {
9294 }
9295
9297
9299 {
9301
9302 if (!action)
9303 {
9304 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9305 return;
9306 }
9307
9309 if (!ai)
9310 {
9312 return;
9313 }
9314
9316 if (!action_array)
9317 {
9318 action_array = new array<ActionBase_Basic>;
9320 }
9321 if (LogManager.IsActionLogEnable())
9322 {
9323 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9324 }
9325
9326 if (action_array.Find(action) != -1)
9327 {
9328 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9329 }
9330 else
9331 {
9332 action_array.Insert(action);
9333 }
9334 }
9335
9337 {
9338 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9339 ActionBase action = player.GetActionManager().GetAction(actionName);
9342
9343 if (action_array)
9344 {
9345 action_array.RemoveItem(action);
9346 }
9347 }
9348
9349
9350
9352 {
9353 ActionOverrideData overrideData = new ActionOverrideData();
9357
9359 if (!actionMap)
9360 {
9363 }
9364
9365 actionMap.Insert(this.
Type(), overrideData);
9366
9367 }
9368
9370
9372
9373
9375 {
9378
9381
9382 string config_to_search = "CfgVehicles";
9383 string muzzle_owner_config;
9384
9386 {
9387 if (IsInherited(Weapon))
9388 config_to_search = "CfgWeapons";
9389
9390 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9391
9392 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9393
9394 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9395
9396 if (config_OnFire_subclass_count > 0)
9397 {
9398 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9399
9400 for (int i = 0; i < config_OnFire_subclass_count; i++)
9401 {
9402 string particle_class = "";
9403 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9404 string config_OnFire_entry = config_OnFire_class + particle_class;
9405 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9406 WPOF_array.Insert(WPOF);
9407 }
9408
9409
9411 }
9412 }
9413
9415 {
9416 config_to_search = "CfgWeapons";
9417 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9418
9419 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9420
9421 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9422
9423 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9424 {
9425 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9426
9427 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9428 {
9429 string particle_class2 = "";
9430 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9431 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9432 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9433 WPOBE_array.Insert(WPOBE);
9434 }
9435
9436
9438 }
9439 }
9440 }
9441
9442
9444 {
9447
9449 {
9450 string config_to_search = "CfgVehicles";
9451
9452 if (IsInherited(Weapon))
9453 config_to_search = "CfgWeapons";
9454
9455 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9456 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9457
9458 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9459 {
9460
9462
9464 {
9466 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9468 return;
9469 }
9470
9473
9474
9475
9476 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9477 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9478
9479 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9480 {
9481 string particle_class = "";
9482 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9483 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9484 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9485
9486 if (entry_type == CT_CLASS)
9487 {
9488 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9489 WPOOH_array.Insert(WPOF);
9490 }
9491 }
9492
9493
9495 }
9496 }
9497 }
9498
9500 {
9502 }
9503
9505 {
9507 {
9509
9512
9515
9516 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9517 }
9518 }
9519
9521 {
9523 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9524
9526 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9527
9529 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9530
9532 {
9534 }
9535 }
9536
9538 {
9540 }
9541
9543 {
9546 else
9548
9550 {
9553 }
9554 else
9555 {
9558
9561 }
9562
9564 }
9565
9567 {
9569 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9570 }
9571
9573 {
9575 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9577 }
9578
9580 {
9582 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9583 }
9584
9586 {
9589
9590 OverheatingParticle OP = new OverheatingParticle();
9595
9597 }
9598
9600 {
9603
9604 return -1;
9605 }
9606
9608 {
9610 {
9613
9614 for (int i = count; i > 0; --i)
9615 {
9616 int id = i - 1;
9619
9622
9623 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9624 {
9625 if (p)
9626 {
9629 }
9630 }
9631 }
9632 }
9633 }
9634
9636 {
9638 {
9640 {
9641 int id = i - 1;
9643
9644 if (OP)
9645 {
9647
9648 if (p)
9649 {
9651 }
9652
9653 delete OP;
9654 }
9655 }
9656
9659 }
9660 }
9661
9664 {
9665 return 0.0;
9666 }
9667
9668
9670 {
9671 return 250;
9672 }
9673
9675 {
9676 return 0;
9677 }
9678
9681 {
9683 return true;
9684
9685 return false;
9686 }
9687
9690 {
9693
9695 {
9697 }
9698 else
9699 {
9700
9702 }
9703
9705 }
9706
9713 {
9714 return -1;
9715 }
9716
9717
9718
9719
9721 {
9723 {
9724 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9725 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9726
9727 if (r_index >= 0)
9728 {
9729 InventoryLocation r_il = new InventoryLocation;
9730 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9731
9732 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9735 {
9736 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9737 }
9739 {
9740 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9741 }
9742
9743 }
9744
9745 player.GetHumanInventory().ClearUserReservedLocation(this);
9746 }
9747
9750 }
9751
9752
9753
9754
9756 {
9757 return ItemBase.m_DebugActionsMask;
9758 }
9759
9761 {
9762 return ItemBase.m_DebugActionsMask & mask;
9763 }
9764
9766 {
9767 ItemBase.m_DebugActionsMask = mask;
9768 }
9769
9771 {
9772 ItemBase.m_DebugActionsMask |= mask;
9773 }
9774
9776 {
9777 ItemBase.m_DebugActionsMask &= ~mask;
9778 }
9779
9781 {
9783 {
9785 }
9786 else
9787 {
9789 }
9790 }
9791
9792
9794 {
9795 if (GetEconomyProfile())
9796 {
9797 float q_max = GetEconomyProfile().GetQuantityMax();
9798 if (q_max > 0)
9799 {
9800 float q_min = GetEconomyProfile().GetQuantityMin();
9801 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9802
9804 {
9805 ComponentEnergyManager comp = GetCompEM();
9807 {
9809 }
9810 }
9812 {
9814
9815 }
9816
9817 }
9818 }
9819 }
9820
9823 {
9824 EntityAI parent = GetHierarchyParent();
9825
9826 if (parent)
9827 {
9828 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9829 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9830 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9831 }
9832 }
9833
9836 {
9837 EntityAI parent = GetHierarchyParent();
9838
9839 if (parent)
9840 {
9841 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9842 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9843 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9844 }
9845 }
9846
9848 {
9849
9850
9851
9852
9854
9856 {
9857 if (ScriptInputUserData.CanStoreInputUserData())
9858 {
9859 ScriptInputUserData ctx = new ScriptInputUserData;
9865 ctx.
Write(use_stack_max);
9868
9870 {
9871 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9872 }
9873 }
9874 }
9875 else if (!
g_Game.IsMultiplayer())
9876 {
9878 }
9879 }
9880
9882 {
9884 }
9885
9887 {
9889 }
9890
9892 {
9894 }
9895
9897 {
9898
9899 return false;
9900 }
9901
9903 {
9904 return false;
9905 }
9906
9910 {
9911 return false;
9912 }
9913
9915 {
9916 return "";
9917 }
9918
9920
9922 {
9923 return false;
9924 }
9925
9927 {
9928 return true;
9929 }
9930
9931
9932
9934 {
9935 return true;
9936 }
9937
9939 {
9940 return true;
9941 }
9942
9944 {
9945 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9947 }
9948
9950 {
9952 }
9953
9955 {
9957 if (!is_being_placed)
9959 SetSynchDirty();
9960 }
9961
9962
9964
9966 {
9968 }
9969
9971 {
9973 }
9974
9976 {
9977 return 1;
9978 }
9979
9981 {
9982 return false;
9983 }
9984
9986 {
9988 SetSynchDirty();
9989 }
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10026 {
10027 super.OnMovedInsideCargo(container);
10028
10029 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10030 }
10031
10032 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10033 {
10034 super.EEItemLocationChanged(oldLoc, newLoc);
10035
10036 PlayerBase newPlayer = null;
10037 PlayerBase oldPlayer = null;
10038
10039 if (newLoc.GetParent())
10040 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10041
10042 if (oldLoc.GetParent())
10043 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10044
10046 {
10047 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10048
10049 if (rIndex >= 0)
10050 {
10051 InventoryLocation rIl = new InventoryLocation;
10052 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10053
10054 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10057 {
10058 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10059 }
10061 {
10063 }
10064
10065 }
10066 }
10067
10069 {
10070 if (newPlayer)
10071 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10072
10073 if (newPlayer == oldPlayer)
10074 {
10075 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10076 {
10078 {
10079 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10080 {
10081 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10082 }
10083 }
10084 else
10085 {
10086 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10087 }
10088 }
10089
10090 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10091 {
10092 int type = oldLoc.GetType();
10094 {
10095 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10096 }
10098 {
10099 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10100 }
10101 }
10102 if (!m_OldLocation)
10103 {
10104 m_OldLocation = new InventoryLocation;
10105 }
10106 m_OldLocation.Copy(oldLoc);
10107 }
10108 else
10109 {
10110 if (m_OldLocation)
10111 {
10112 m_OldLocation.Reset();
10113 }
10114 }
10115
10116 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10117 }
10118 else
10119 {
10120 if (newPlayer)
10121 {
10122 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10123 if (resIndex >= 0)
10124 {
10125 InventoryLocation il = new InventoryLocation;
10126 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10128 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10131 {
10132 il.
GetParent().GetOnReleaseLock().Invoke(it);
10133 }
10135 {
10137 }
10138
10139 }
10140 }
10142 {
10143
10145 }
10146
10147 if (m_OldLocation)
10148 {
10149 m_OldLocation.Reset();
10150 }
10151 }
10152
10154 {
10155 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10156 }
10157
10159 {
10160 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10161 }
10162 }
10163
10164 override void EOnContact(IEntity other, Contact extra)
10165 {
10167 {
10168 int liquidType = -1;
10170 if (impactSpeed > 0.0)
10171 {
10173 #ifndef SERVER
10175 #else
10177 SetSynchDirty();
10178 #endif
10180 }
10181 }
10182
10183 #ifdef SERVER
10184 if (GetCompEM() && GetCompEM().IsPlugged())
10185 {
10186 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10187 GetCompEM().UnplugThis();
10188 }
10189 #endif
10190 }
10191
10193
10195 {
10197 }
10198
10200 {
10201
10202 }
10203
10205 {
10206 super.OnItemLocationChanged(old_owner, new_owner);
10207
10208 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10209 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10210
10211 if (!relatedPlayer && playerNew)
10212 relatedPlayer = playerNew;
10213
10214 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10215 {
10217 if (actionMgr)
10218 {
10219 ActionBase currentAction = actionMgr.GetRunningAction();
10220 if (currentAction)
10222 }
10223 }
10224
10225 Man ownerPlayerOld = null;
10226 Man ownerPlayerNew = null;
10227
10228 if (old_owner)
10229 {
10230 if (old_owner.
IsMan())
10231 {
10232 ownerPlayerOld = Man.Cast(old_owner);
10233 }
10234 else
10235 {
10236 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10237 }
10238 }
10239 else
10240 {
10242 {
10244
10245 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10246 {
10247 GetCompEM().UnplugThis();
10248 }
10249 }
10250 }
10251
10252 if (new_owner)
10253 {
10254 if (new_owner.
IsMan())
10255 {
10256 ownerPlayerNew = Man.Cast(new_owner);
10257 }
10258 else
10259 {
10260 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10261 }
10262 }
10263
10264 if (ownerPlayerOld != ownerPlayerNew)
10265 {
10266 if (ownerPlayerOld)
10267 {
10268 array<EntityAI> subItemsExit = new array<EntityAI>;
10270 for (int i = 0; i < subItemsExit.Count(); i++)
10271 {
10274 }
10275 }
10276
10277 if (ownerPlayerNew)
10278 {
10279 array<EntityAI> subItemsEnter = new array<EntityAI>;
10281 for (int j = 0; j < subItemsEnter.Count(); j++)
10282 {
10285 }
10286 }
10287 }
10288 else if (ownerPlayerNew != null)
10289 {
10290 PlayerBase nplayer;
10291 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10292 {
10293 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10295 for (int k = 0; k < subItemsUpdate.Count(); k++)
10296 {
10298 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10299 }
10300 }
10301 }
10302
10303 if (old_owner)
10304 old_owner.OnChildItemRemoved(this);
10305 if (new_owner)
10306 new_owner.OnChildItemReceived(this);
10307 }
10308
10309
10311 {
10312 super.EEDelete(parent);
10313 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10314 if (player)
10315 {
10317
10318 if (player.IsAlive())
10319 {
10320 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10321 if (r_index >= 0)
10322 {
10323 InventoryLocation r_il = new InventoryLocation;
10324 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10325
10326 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10329 {
10330 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10331 }
10333 {
10334 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10335 }
10336
10337 }
10338
10339 player.RemoveQuickBarEntityShortcut(this);
10340 }
10341 }
10342 }
10343
10345 {
10346 super.EEKilled(killer);
10347
10350 {
10351 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10352 {
10353 if (IsMagazine())
10354 {
10355 if (Magazine.Cast(this).GetAmmoCount() > 0)
10356 {
10358 }
10359 }
10360 else
10361 {
10363 }
10364 }
10365 }
10366 }
10367
10369 {
10370 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10371
10372 super.OnWasAttached(parent, slot_id);
10373
10376
10379 }
10380
10382 {
10383 super.OnWasDetached(parent, slot_id);
10384
10387
10390 }
10391
10393 {
10394 int idx;
10397
10398 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10399 if (inventory_slots.Count() < 1)
10400 {
10401 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10402 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10403 }
10404 else
10405 {
10406 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10407 }
10408
10409 idx = inventory_slots.Find(slot);
10410 if (idx < 0)
10411 return "";
10412
10413 return attach_types.Get(idx);
10414 }
10415
10417 {
10418 int idx = -1;
10419 string slot;
10420
10423
10424 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10425 if (inventory_slots.Count() < 1)
10426 {
10427 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10428 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10429 }
10430 else
10431 {
10432 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10433 if (detach_types.Count() < 1)
10434 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10435 }
10436
10437 for (int i = 0; i < inventory_slots.Count(); i++)
10438 {
10439 slot = inventory_slots.Get(i);
10440 }
10441
10442 if (slot != "")
10443 {
10444 if (detach_types.Count() == 1)
10445 idx = 0;
10446 else
10447 idx = inventory_slots.Find(slot);
10448 }
10449 if (idx < 0)
10450 return "";
10451
10452 return detach_types.Get(idx);
10453 }
10454
10456 {
10457
10459
10460
10461 float min_time = 1;
10462 float max_time = 3;
10463 float delay = Math.RandomFloat(min_time, max_time);
10464
10465 explode_timer.Run(delay, this, "DoAmmoExplosion");
10466 }
10467
10469 {
10470 Magazine magazine = Magazine.Cast(this);
10471 int pop_sounds_count = 6;
10472 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10473
10474
10475 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10476 string sound_name = pop_sounds[ sound_idx ];
10477 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10478
10479
10480 magazine.ServerAddAmmoCount(-1);
10481
10482
10483 float min_temp_to_explode = 100;
10484
10485 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10486 {
10488 }
10489 }
10490
10491
10492 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10493 {
10494 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10495
10496 const int CHANCE_DAMAGE_CARGO = 4;
10497 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10498 const int CHANCE_DAMAGE_NOTHING = 2;
10499
10501 {
10502 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10503 int chances;
10504 int rnd;
10505
10506 if (GetInventory().GetCargo())
10507 {
10508 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10509 rnd = Math.RandomInt(0,chances);
10510
10511 if (rnd < CHANCE_DAMAGE_CARGO)
10512 {
10514 }
10515 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10516 {
10518 }
10519 }
10520 else
10521 {
10522 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10523 rnd = Math.RandomInt(0,chances);
10524
10525 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10526 {
10528 }
10529 }
10530 }
10531 }
10532
10534 {
10535 CargoBase cargo = GetInventory().GetCargo();
10536 if (cargo)
10537 {
10539 if (item_count > 0)
10540 {
10541 int random_pick = Math.RandomInt(0, item_count);
10543 if (!item.IsExplosive())
10544 {
10545 item.AddHealth("","",damage);
10546 return true;
10547 }
10548 }
10549 }
10550 return false;
10551 }
10552
10554 {
10555 GameInventory inventory = GetInventory();
10557 if (attachment_count > 0)
10558 {
10559 int random_pick = Math.RandomInt(0, attachment_count);
10561 if (!attachment.IsExplosive())
10562 {
10563 attachment.AddHealth("","",damage);
10564 return true;
10565 }
10566 }
10567 return false;
10568 }
10569
10571 {
10573 }
10574
10576 {
10578 return GetInventory().CanRemoveEntity();
10579
10580 return false;
10581 }
10582
10584 {
10585
10587 return false;
10588
10589
10591 return false;
10592
10593
10594
10596 if (delta == 0)
10597 return false;
10598
10599
10600 return true;
10601 }
10602
10604 {
10606 {
10607 if (ScriptInputUserData.CanStoreInputUserData())
10608 {
10609 ScriptInputUserData ctx = new ScriptInputUserData;
10614 ctx.
Write(destination_entity);
10616 ctx.
Write(slot_id);
10618 }
10619 }
10620 else if (!
g_Game.IsMultiplayer())
10621 {
10623 }
10624 }
10625
10627 {
10628 float split_quantity_new;
10632 InventoryLocation loc = new InventoryLocation;
10633
10634 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10635 {
10637 split_quantity_new = stack_max;
10638 else
10640
10642 {
10643 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10644 if (new_item)
10645 {
10646 new_item.SetResultOfSplit(true);
10647 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10649 new_item.
SetQuantity(split_quantity_new,
false,
true);
10650 }
10651 }
10652 }
10653 else if (destination_entity && slot_id == -1)
10654 {
10655 if (quantity > stack_max)
10656 split_quantity_new = stack_max;
10657 else
10658 split_quantity_new = quantity;
10659
10661 {
10662 GameInventory destinationInventory = destination_entity.GetInventory();
10664 {
10667 }
10668
10669 if (new_item)
10670 {
10671 new_item.SetResultOfSplit(true);
10672 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10674 new_item.
SetQuantity(split_quantity_new,
false,
true);
10675 }
10676 }
10677 }
10678 else
10679 {
10680 if (stack_max != 0)
10681 {
10683 {
10685 }
10686
10687 if (split_quantity_new == 0)
10688 {
10689 if (!
g_Game.IsMultiplayer())
10690 player.PhysicalPredictiveDropItem(this);
10691 else
10692 player.ServerDropEntity(this);
10693 return;
10694 }
10695
10697 {
10699
10700 if (new_item)
10701 {
10702 new_item.SetResultOfSplit(true);
10703 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10706 new_item.PlaceOnSurface();
10707 }
10708 }
10709 }
10710 }
10711 }
10712
10714 {
10715 float split_quantity_new;
10719 InventoryLocation loc = new InventoryLocation;
10720
10721 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10722 {
10724 split_quantity_new = stack_max;
10725 else
10727
10729 {
10730 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10731 if (new_item)
10732 {
10733 new_item.SetResultOfSplit(true);
10734 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10736 new_item.
SetQuantity(split_quantity_new,
false,
true);
10737 }
10738 }
10739 }
10740 else if (destination_entity && slot_id == -1)
10741 {
10742 if (quantity > stack_max)
10743 split_quantity_new = stack_max;
10744 else
10745 split_quantity_new = quantity;
10746
10748 {
10749 GameInventory destinationInventory = destination_entity.GetInventory();
10751 {
10754 }
10755
10756 if (new_item)
10757 {
10758 new_item.SetResultOfSplit(true);
10759 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10761 new_item.
SetQuantity(split_quantity_new,
false,
true);
10762 }
10763 }
10764 }
10765 else
10766 {
10767 if (stack_max != 0)
10768 {
10770 {
10772 }
10773
10775 {
10777
10778 if (new_item)
10779 {
10780 new_item.SetResultOfSplit(true);
10781 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10784 new_item.PlaceOnSurface();
10785 }
10786 }
10787 }
10788 }
10789 }
10790
10792 {
10794 {
10795 if (ScriptInputUserData.CanStoreInputUserData())
10796 {
10797 ScriptInputUserData ctx = new ScriptInputUserData;
10802 dst.WriteToContext(ctx);
10804 }
10805 }
10806 else if (!
g_Game.IsMultiplayer())
10807 {
10809 }
10810 }
10811
10813 {
10815 {
10816 if (ScriptInputUserData.CanStoreInputUserData())
10817 {
10818 ScriptInputUserData ctx = new ScriptInputUserData;
10823 ctx.
Write(destination_entity);
10829 }
10830 }
10831 else if (!
g_Game.IsMultiplayer())
10832 {
10834 }
10835 }
10836
10838 {
10840 }
10841
10843 {
10845 float split_quantity_new;
10847 if (dst.IsValid())
10848 {
10849 int slot_id = dst.GetSlot();
10851
10852 if (quantity > stack_max)
10853 split_quantity_new = stack_max;
10854 else
10855 split_quantity_new = quantity;
10856
10858 {
10860
10861 if (new_item)
10862 {
10863 new_item.SetResultOfSplit(true);
10864 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10866 new_item.
SetQuantity(split_quantity_new,
false,
true);
10867 }
10868
10869 return new_item;
10870 }
10871 }
10872
10873 return null;
10874 }
10875
10877 {
10879 float split_quantity_new;
10881 if (destination_entity)
10882 {
10884 if (quantity > stackable)
10885 split_quantity_new = stackable;
10886 else
10887 split_quantity_new = quantity;
10888
10890 {
10891 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10892 if (new_item)
10893 {
10894 new_item.SetResultOfSplit(true);
10895 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10897 new_item.
SetQuantity(split_quantity_new,
false,
true);
10898 }
10899 }
10900 }
10901 }
10902
10904 {
10906 {
10907 if (ScriptInputUserData.CanStoreInputUserData())
10908 {
10909 ScriptInputUserData ctx = new ScriptInputUserData;
10914 ItemBase destination_entity =
this;
10915 ctx.
Write(destination_entity);
10919 }
10920 }
10921 else if (!
g_Game.IsMultiplayer())
10922 {
10924 }
10925 }
10926
10928 {
10930 float split_quantity_new;
10932 if (player)
10933 {
10935 if (quantity > stackable)
10936 split_quantity_new = stackable;
10937 else
10938 split_quantity_new = quantity;
10939
10941 {
10942 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10943 new_item =
ItemBase.Cast(in_hands);
10944 if (new_item)
10945 {
10946 new_item.SetResultOfSplit(true);
10947 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10949 new_item.SetQuantity(split_quantity_new, false, true);
10950 }
10951 }
10952 }
10953 }
10954
10956 {
10958 float split_quantity_new = Math.Floor(quantity * 0.5);
10959
10961 return;
10962
10964
10965 if (new_item)
10966 {
10967 if (new_item.GetQuantityMax() < split_quantity_new)
10968 {
10969 split_quantity_new = new_item.GetQuantityMax();
10970 }
10971
10972 new_item.SetResultOfSplit(true);
10973 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10974
10976 {
10979 }
10980 else
10981 {
10983 new_item.
SetQuantity(split_quantity_new,
false,
true);
10984 }
10985 }
10986 }
10987
10989 {
10991 float split_quantity_new = Math.Floor(quantity / 2);
10992
10994 return;
10995
10996 InventoryLocation invloc = new InventoryLocation;
10998
11000 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11001
11002 if (new_item)
11003 {
11004 if (new_item.GetQuantityMax() < split_quantity_new)
11005 {
11006 split_quantity_new = new_item.GetQuantityMax();
11007 }
11009 {
11012 }
11013 else if (split_quantity_new > 1)
11014 {
11016 new_item.
SetQuantity(split_quantity_new,
false,
true);
11017 }
11018 }
11019 }
11020
11023 {
11024 SetWeightDirty();
11026
11027 if (parent)
11028 parent.OnAttachmentQuantityChangedEx(this, delta);
11029
11031 {
11033 {
11035 }
11037 {
11038 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11040 }
11041 }
11042 }
11043
11046 {
11047
11048 }
11049
11052 {
11054 }
11055
11057 {
11058 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11059
11061 {
11062 if (newLevel == GameConstants.STATE_RUINED)
11063 {
11065 EntityAI parent = GetHierarchyParent();
11066 if (parent && parent.IsFireplace())
11067 {
11068 CargoBase cargo = GetInventory().GetCargo();
11069 if (cargo)
11070 {
11072 {
11074 }
11075 }
11076 }
11077 }
11078
11080 {
11081
11083 return;
11084 }
11085
11086 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11087 {
11089 }
11090 }
11091 }
11092
11093
11095 {
11096 super.OnRightClick();
11097
11099 {
11101 {
11102 if (ScriptInputUserData.CanStoreInputUserData())
11103 {
11104 EntityAI root = GetHierarchyRoot();
11105 Man playerOwner = GetHierarchyRootPlayer();
11106 InventoryLocation dst = new InventoryLocation;
11107
11108
11109 if (!playerOwner && root && root == this)
11110 {
11112 }
11113 else
11114 {
11115
11116 GetInventory().GetCurrentInventoryLocation(dst);
11118 {
11119 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11121 {
11123 }
11124 else
11125 {
11127
11128
11129 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11130 {
11132 }
11133 else
11134 {
11135 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11136 }
11137 }
11138 }
11139 }
11140
11141 ScriptInputUserData ctx = new ScriptInputUserData;
11149 }
11150 }
11151 else if (!
g_Game.IsMultiplayer())
11152 {
11154 }
11155 }
11156 }
11157
11159 {
11160 if (root)
11161 {
11162 vector m4[4];
11163 root.GetTransform(m4);
11164 dst.SetGround(this, m4);
11165 }
11166 else
11167 {
11168 GetInventory().GetCurrentInventoryLocation(dst);
11169 }
11170 }
11171
11172 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11173 {
11174
11175 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11176 return false;
11177
11178 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11179 return false;
11180
11181
11183 return false;
11184
11185
11186 Magazine mag = Magazine.Cast(this);
11187 if (mag)
11188 {
11189 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11190 return false;
11191
11192 if (stack_max_limit)
11193 {
11194 Magazine other_mag = Magazine.Cast(other_item);
11195 if (other_item)
11196 {
11197 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11198 return false;
11199 }
11200
11201 }
11202 }
11203 else
11204 {
11205
11207 return false;
11208
11210 return false;
11211 }
11212
11213 PlayerBase player = null;
11214 if (CastTo(player, GetHierarchyRootPlayer()))
11215 {
11216 if (player.GetInventory().HasAttachment(this))
11217 return false;
11218
11219 if (player.IsItemsToDelete())
11220 return false;
11221 }
11222
11223 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11224 return false;
11225
11226 int slotID;
11228 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11229 return false;
11230
11231 return true;
11232 }
11233
11235 {
11237 }
11238
11240 {
11241 return m_IsResultOfSplit;
11242 }
11243
11245 {
11246 m_IsResultOfSplit = value;
11247 }
11248
11250 {
11252 }
11253
11255 {
11256 float other_item_quantity = other_item.GetQuantity();
11257 float this_free_space;
11258
11260
11262
11263 if (other_item_quantity > this_free_space)
11264 {
11265 return this_free_space;
11266 }
11267 else
11268 {
11269 return other_item_quantity;
11270 }
11271 }
11272
11274 {
11276 }
11277
11279 {
11281 return;
11282
11283 if (!IsMagazine() && other_item)
11284 {
11286 if (quantity_used != 0)
11287 {
11288 float hp1 = GetHealth01("","");
11289 float hp2 = other_item.GetHealth01("","");
11290 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11291 hpResult = hpResult / (
GetQuantity() + quantity_used);
11292
11293 hpResult *= GetMaxHealth();
11294 Math.Round(hpResult);
11295 SetHealth("", "Health", hpResult);
11296
11298 other_item.AddQuantity(-quantity_used);
11299 }
11300 }
11302 }
11303
11305 {
11306 #ifdef SERVER
11307 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11308 GetHierarchyParent().IncreaseLifetimeUp();
11309 #endif
11310 };
11311
11313 {
11314 PlayerBase p = PlayerBase.Cast(player);
11315
11316 array<int> recipesIds = p.m_Recipes;
11317 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11318 if (moduleRecipesManager)
11319 {
11320 EntityAI itemInHands = player.GetEntityInHands();
11321 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11322 }
11323
11324 for (int i = 0;i < recipesIds.Count(); i++)
11325 {
11326 int key = recipesIds.Get(i);
11327 string recipeName = moduleRecipesManager.GetRecipeName(key);
11329 }
11330 }
11331
11332
11333 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11334 {
11335 super.GetDebugActions(outputList);
11336
11337
11343
11344
11349
11354
11355
11359
11360
11362 {
11366 }
11367
11370
11371
11375
11377
11378 InventoryLocation loc = new InventoryLocation();
11379 GetInventory().GetCurrentInventoryLocation(loc);
11381 {
11382 if (Gizmo_IsSupported())
11385 }
11386
11388 }
11389
11390
11391
11392
11394 {
11395 super.OnAction(action_id, player, ctx);
11396
11398 {
11399 switch (action_id)
11400 {
11404 return true;
11408 return true;
11409 }
11410 }
11411
11413 {
11414 switch (action_id)
11415 {
11417 Delete();
11418 return true;
11419 }
11420 }
11421
11422 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11423 {
11424 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11425 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11426 PlayerBase p = PlayerBase.Cast(player);
11427 if (
EActions.RECIPES_RANGE_START < 1000)
11428 {
11429 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11430 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11431 }
11432 }
11433 #ifndef SERVER
11434 else if (action_id ==
EActions.WATCH_PLAYER)
11435 {
11436 PluginDeveloper.SetDeveloperItemClientEx(player);
11437 }
11438 #endif
11440 {
11441 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11442 {
11443 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11444 OnDebugButtonPressServer(id + 1);
11445 }
11446
11447 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11448 {
11449 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11451 }
11452
11453 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11454 {
11455 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11457 }
11458
11459 else if (action_id ==
EActions.ADD_QUANTITY)
11460 {
11461 if (IsMagazine())
11462 {
11463 Magazine mag = Magazine.Cast(this);
11464 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11465 }
11466 else
11467 {
11469 }
11470
11471 if (m_EM)
11472 {
11473 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11474 }
11475
11476 }
11477
11478 else if (action_id ==
EActions.REMOVE_QUANTITY)
11479 {
11480 if (IsMagazine())
11481 {
11482 Magazine mag2 = Magazine.Cast(this);
11483 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11484 }
11485 else
11486 {
11488 }
11489 if (m_EM)
11490 {
11491 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11492 }
11493
11494 }
11495
11496 else if (action_id ==
EActions.SET_QUANTITY_0)
11497 {
11499
11500 if (m_EM)
11501 {
11502 m_EM.SetEnergy(0);
11503 }
11504 }
11505
11506 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11507 {
11509
11510 if (m_EM)
11511 {
11512 m_EM.SetEnergy(m_EM.GetEnergyMax());
11513 }
11514 }
11515
11516 else if (action_id ==
EActions.ADD_HEALTH)
11517 {
11518 AddHealth("","",GetMaxHealth("","Health")/5);
11519 }
11520 else if (action_id ==
EActions.REMOVE_HEALTH)
11521 {
11522 AddHealth("","",-GetMaxHealth("","Health")/5);
11523 }
11524 else if (action_id ==
EActions.DESTROY_HEALTH)
11525 {
11526 SetHealth01("","",0);
11527 }
11528 else if (action_id ==
EActions.WATCH_ITEM)
11529 {
11531 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11532 #ifdef DEVELOPER
11533 SetDebugDeveloper_item(this);
11534 #endif
11535 }
11536
11537 else if (action_id ==
EActions.ADD_TEMPERATURE)
11538 {
11539 AddTemperature(20);
11540
11541 }
11542
11543 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11544 {
11545 AddTemperature(-20);
11546
11547 }
11548
11549 else if (action_id ==
EActions.FLIP_FROZEN)
11550 {
11551 SetFrozen(!GetIsFrozen());
11552
11553 }
11554
11555 else if (action_id ==
EActions.ADD_WETNESS)
11556 {
11558
11559 }
11560
11561 else if (action_id ==
EActions.REMOVE_WETNESS)
11562 {
11564
11565 }
11566
11567 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11568 {
11571
11572
11573 }
11574
11575 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11576 {
11579 }
11580
11581 else if (action_id ==
EActions.MAKE_SPECIAL)
11582 {
11583 auto debugParams = DebugSpawnParams.WithPlayer(player);
11584 OnDebugSpawnEx(debugParams);
11585 }
11586
11587 }
11588
11589
11590 return false;
11591 }
11592
11593
11594
11595
11599
11602
11603
11604
11606 {
11607 return false;
11608 }
11609
11610
11612 {
11613 return true;
11614 }
11615
11616
11618 {
11619 return true;
11620 }
11621
11622
11623
11625 {
11626 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11627 return g_Game.ConfigIsExisting(config_path);
11628 }
11629
11632 {
11633 return null;
11634 }
11635
11637 {
11638 return false;
11639 }
11640
11642 {
11643 return false;
11644 }
11645
11649
11650
11652 {
11653 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11654 return module_repairing.CanRepair(this, item_repair_kit);
11655 }
11656
11657
11658 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11659 {
11660 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11661 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11662 }
11663
11664
11666 {
11667
11668
11669
11670
11671
11672
11673
11674
11675 return 1;
11676 }
11677
11678
11679
11681 {
11683 }
11684
11685
11686
11688 {
11690 }
11691
11692
11701 {
11702 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11703
11704 if (player)
11705 {
11706 player.MessageStatus(text);
11707 }
11708 }
11709
11710
11719 {
11720 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11721
11722 if (player)
11723 {
11724 player.MessageAction(text);
11725 }
11726 }
11727
11728
11737 {
11738 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11739
11740 if (player)
11741 {
11742 player.MessageFriendly(text);
11743 }
11744 }
11745
11746
11755 {
11756 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11757
11758 if (player)
11759 {
11760 player.MessageImportant(text);
11761 }
11762 }
11763
11765 {
11766 return true;
11767 }
11768
11769
11770 override bool KindOf(
string tag)
11771 {
11772 bool found = false;
11773 string item_name = this.
GetType();
11775 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11776
11777 int array_size = item_tag_array.Count();
11778 for (int i = 0; i < array_size; i++)
11779 {
11780 if (item_tag_array.Get(i) == tag)
11781 {
11782 found = true;
11783 break;
11784 }
11785 }
11786 return found;
11787 }
11788
11789
11791 {
11792
11793 super.OnRPC(sender, rpc_type,ctx);
11794
11795
11796 switch (rpc_type)
11797 {
11798 #ifndef SERVER
11799 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11800 Param2<bool, string> p = new Param2<bool, string>(false, "");
11801
11803 return;
11804
11805 bool play = p.param1;
11806 string soundSet = p.param2;
11807
11808 if (play)
11809 {
11811 {
11813 {
11815 }
11816 }
11817 else
11818 {
11820 }
11821 }
11822 else
11823 {
11825 }
11826
11827 break;
11828 #endif
11829
11830 }
11831
11833 {
11835 }
11836 }
11837
11838
11839
11840
11842 {
11843 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11844 return plugin.GetID(
name);
11845 }
11846
11848 {
11849 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11850 return plugin.GetName(id);
11851 }
11852
11855 {
11856
11857
11858 int varFlags;
11859 if (!ctx.
Read(varFlags))
11860 return;
11861
11862 if (varFlags & ItemVariableFlags.FLOAT)
11863 {
11865 }
11866 }
11867
11869 {
11870
11871 super.SerializeNumericalVars(floats_out);
11872
11873
11874
11876 {
11878 }
11879
11881 {
11883 }
11884
11886 {
11888 }
11889
11891 {
11896 }
11897
11899 {
11901 }
11902 }
11903
11905 {
11906
11907 super.DeSerializeNumericalVars(floats);
11908
11909
11910 int index = 0;
11911 int mask = Math.Round(floats.Get(index));
11912
11913 index++;
11914
11916 {
11918 {
11920 }
11921 else
11922 {
11923 float quantity = floats.Get(index);
11924 SetQuantity(quantity,
true,
false,
false,
false);
11925 }
11926 index++;
11927 }
11928
11930 {
11931 float wet = floats.Get(index);
11933 index++;
11934 }
11935
11937 {
11938 int liquidtype = Math.Round(floats.Get(index));
11940 index++;
11941 }
11942
11944 {
11946 index++;
11948 index++;
11950 index++;
11952 index++;
11953 }
11954
11956 {
11957 int cleanness = Math.Round(floats.Get(index));
11959 index++;
11960 }
11961 }
11962
11964 {
11965 super.WriteVarsToCTX(ctx);
11966
11967
11969 {
11971 }
11972
11974 {
11976 }
11977
11979 {
11981 }
11982
11984 {
11985 int r,g,b,a;
11991 }
11992
11994 {
11996 }
11997 }
11998
12000 {
12001 if (!super.ReadVarsFromCTX(ctx,version))
12002 return false;
12003
12004 int intValue;
12005 float value;
12006
12007 if (version < 140)
12008 {
12009 if (!ctx.
Read(intValue))
12010 return false;
12011
12012 m_VariablesMask = intValue;
12013 }
12014
12016 {
12017 if (!ctx.
Read(value))
12018 return false;
12019
12021 {
12023 }
12024 else
12025 {
12027 }
12028 }
12029
12030 if (version < 140)
12031 {
12033 {
12034 if (!ctx.
Read(value))
12035 return false;
12036 SetTemperatureDirect(value);
12037 }
12038 }
12039
12041 {
12042 if (!ctx.
Read(value))
12043 return false;
12045 }
12046
12048 {
12049 if (!ctx.
Read(intValue))
12050 return false;
12052 }
12053
12055 {
12056 int r,g,b,a;
12058 return false;
12060 return false;
12062 return false;
12064 return false;
12065
12067 }
12068
12070 {
12071 if (!ctx.
Read(intValue))
12072 return false;
12074 }
12075
12076 if (version >= 138 && version < 140)
12077 {
12079 {
12080 if (!ctx.
Read(intValue))
12081 return false;
12082 SetFrozen(intValue);
12083 }
12084 }
12085
12086 return true;
12087 }
12088
12089
12091 {
12094 {
12096 }
12097
12098 if (!super.OnStoreLoad(ctx, version))
12099 {
12101 return false;
12102 }
12103
12104 if (version >= 114)
12105 {
12106 bool hasQuickBarIndexSaved;
12107
12108 if (!ctx.
Read(hasQuickBarIndexSaved))
12109 {
12111 return false;
12112 }
12113
12114 if (hasQuickBarIndexSaved)
12115 {
12116 int itmQBIndex;
12117
12118
12119 if (!ctx.
Read(itmQBIndex))
12120 {
12122 return false;
12123 }
12124
12125 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12126 if (itmQBIndex != -1 && parentPlayer)
12127 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12128 }
12129 }
12130 else
12131 {
12132
12133 PlayerBase player;
12134 int itemQBIndex;
12135 if (version ==
int.
MAX)
12136 {
12137 if (!ctx.
Read(itemQBIndex))
12138 {
12140 return false;
12141 }
12142 }
12143 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12144 {
12145
12146 if (!ctx.
Read(itemQBIndex))
12147 {
12149 return false;
12150 }
12151 if (itemQBIndex != -1 && player)
12152 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12153 }
12154 }
12155
12156 if (version < 140)
12157 {
12158
12159 if (!LoadVariables(ctx, version))
12160 {
12162 return false;
12163 }
12164 }
12165
12166
12168 {
12170 return false;
12171 }
12172 if (version >= 132)
12173 {
12175 if (raib)
12176 {
12178 {
12180 return false;
12181 }
12182 }
12183 }
12184
12186 return true;
12187 }
12188
12189
12190
12192 {
12193 super.OnStoreSave(ctx);
12194
12195 PlayerBase player;
12196 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12197 {
12199
12200 int itemQBIndex = -1;
12201 itemQBIndex = player.FindQuickBarEntityIndex(this);
12202 ctx.
Write(itemQBIndex);
12203 }
12204 else
12205 {
12207 }
12208
12210
12212 if (raib)
12213 {
12215 }
12216 }
12217
12218
12220 {
12221 super.AfterStoreLoad();
12222
12224 {
12226 }
12227
12229 {
12232 }
12233 }
12234
12236 {
12237 super.EEOnAfterLoad();
12238
12240 {
12242 }
12243
12246 }
12247
12249 {
12250 return false;
12251 }
12252
12253
12254
12256 {
12258 {
12259 #ifdef PLATFORM_CONSOLE
12260
12262 {
12264 if (menu)
12265 {
12267 }
12268 }
12269 #endif
12270 }
12271
12273 {
12276 }
12277
12279 {
12280 SetWeightDirty();
12282 }
12284 {
12287 }
12288
12290 {
12293
12296 }
12298 {
12302 }
12303
12304 super.OnVariablesSynchronized();
12305 }
12306
12307
12308
12310 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12311 {
12312 if (!IsServerCheck(allow_client))
12313 return false;
12314
12316 return false;
12317
12320
12321 if (value <= (min + 0.001))
12322 value = min;
12323
12324 if (value == min)
12325 {
12326 if (destroy_config)
12327 {
12328 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12329 if (dstr)
12330 {
12332 this.Delete();
12333 return true;
12334 }
12335 }
12336 else if (destroy_forced)
12337 {
12339 this.Delete();
12340 return true;
12341 }
12342
12344 }
12345
12348
12350 {
12351 EntityAI parent = GetHierarchyRoot();
12352 InventoryLocation iLoc = new InventoryLocation();
12353 GetInventory().GetCurrentInventoryLocation(iLoc);
12355 {
12356 int iLocSlot = iLoc.
GetSlot();
12358 {
12360 }
12362 {
12364 }
12365 }
12366 }
12367
12369 {
12371
12372 if (delta)
12374 }
12375
12377
12378 return false;
12379 }
12380
12381
12383 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12384 {
12386 }
12387
12389 {
12392 }
12393
12395 {
12398 }
12399
12401 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12402 {
12403 float value_clamped = Math.Clamp(value, 0, 1);
12405 SetQuantity(result, destroy_config, destroy_forced);
12406 }
12407
12408
12411 {
12413 }
12414
12416 {
12418 }
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12430 {
12431 int slot = -1;
12432 GameInventory inventory = GetInventory();
12433 if (inventory)
12434 {
12435 InventoryLocation il = new InventoryLocation;
12438 }
12439
12441 }
12442
12444 {
12445 float quantity_max = 0;
12446
12448 {
12449 if (attSlotID != -1)
12450 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12451
12452 if (quantity_max <= 0)
12454 }
12455
12456 if (quantity_max <= 0)
12458
12459 return quantity_max;
12460 }
12461
12463 {
12465 }
12466
12468 {
12470 }
12471
12472
12474 {
12476 }
12477
12479 {
12481 }
12482
12484 {
12486 }
12487
12488
12490 {
12491
12492 float weightEx = GetWeightEx();
12493 float special = GetInventoryAndCargoWeight();
12494 return weightEx - special;
12495 }
12496
12497
12499 {
12501 }
12502
12504 {
12506 {
12507 #ifdef DEVELOPER
12508 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12509 {
12510 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12512 }
12513 #endif
12514
12515 return GetQuantity() * GetConfigWeightModified();
12516 }
12517 else if (HasEnergyManager())
12518 {
12519 #ifdef DEVELOPER
12520 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12521 {
12522 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12523 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12524 }
12525 #endif
12526 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12527 }
12528 else
12529 {
12530 #ifdef DEVELOPER
12531 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12532 {
12533 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12534 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12535 }
12536 #endif
12537 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12538 }
12539 }
12540
12543 {
12544 int item_count = 0;
12546
12547 GameInventory inventory = GetInventory();
12548 CargoBase cargo = inventory.
GetCargo();
12549 if (cargo != NULL)
12550 {
12552 }
12553
12555 for (int i = 0; i < nAttachments; ++i)
12556 {
12558 if (item)
12559 item_count += item.GetNumberOfItems();
12560 }
12561 return item_count;
12562 }
12563
12566 {
12567 float weight = 0;
12568 float wetness = 1;
12569 if (include_wetness)
12572 {
12573 weight = wetness * m_ConfigWeight;
12574 }
12576 {
12577 weight = 1;
12578 }
12579 return weight;
12580 }
12581
12582
12583
12585 {
12586 GameInventory inventory = GetInventory();
12587 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12588 {
12589 array<EntityAI> items = new array<EntityAI>;
12591 for (int i = 0; i < items.Count(); ++i)
12592 {
12594 if (item)
12595 {
12596 g_Game.ObjectDelete(item);
12597 }
12598 }
12599 }
12600 }
12601
12602
12603
12604
12606 {
12607 float energy = 0;
12608 if (HasEnergyManager())
12609 {
12610 energy = GetCompEM().GetEnergy();
12611 }
12612 return energy;
12613 }
12614
12615
12617 {
12618 super.OnEnergyConsumed();
12619
12621 }
12622
12624 {
12625 super.OnEnergyAdded();
12626
12628 }
12629
12630
12632 {
12633 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12634 {
12636 {
12637 float energy_0to1 = GetCompEM().GetEnergy0To1();
12639 }
12640 }
12641 }
12642
12643
12645 {
12646 return ConfigGetFloat("heatIsolation");
12647 }
12648
12650 {
12652 }
12653
12655 {
12656 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12657 if (
g_Game.ConfigIsExisting(paramPath))
12658 return g_Game.ConfigGetFloat(paramPath);
12659
12660 return 0.0;
12661 }
12662
12664 {
12665 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12666 if (
g_Game.ConfigIsExisting(paramPath))
12667 return g_Game.ConfigGetFloat(paramPath);
12668
12669 return 0.0;
12670 }
12671
12672 override void SetWet(
float value,
bool allow_client =
false)
12673 {
12674 if (!IsServerCheck(allow_client))
12675 return;
12676
12679
12681
12682 m_VarWet = Math.Clamp(value, min, max);
12683
12685 {
12688 }
12689 }
12690
12691 override void AddWet(
float value)
12692 {
12694 }
12695
12697 {
12699 }
12700
12702 {
12704 }
12705
12707 {
12709 }
12710
12712 {
12714 }
12715
12717 {
12719 }
12720
12721 override void OnWetChanged(
float newVal,
float oldVal)
12722 {
12725 if (newLevel != oldLevel)
12726 {
12728 }
12729 }
12730
12732 {
12733 SetWeightDirty();
12734 }
12735
12737 {
12738 return GetWetLevelInternal(
m_VarWet);
12739 }
12740
12741
12742
12744 {
12746 }
12747
12749 {
12751 }
12752
12754 {
12756 }
12757
12759 {
12761 }
12762
12763
12764
12766 {
12767 if (ConfigIsExisting("itemModelLength"))
12768 {
12769 return ConfigGetFloat("itemModelLength");
12770 }
12771 return 0;
12772 }
12773
12775 {
12776 if (ConfigIsExisting("itemAttachOffset"))
12777 {
12778 return ConfigGetFloat("itemAttachOffset");
12779 }
12780 return 0;
12781 }
12782
12783 override void SetCleanness(
int value,
bool allow_client =
false)
12784 {
12785 if (!IsServerCheck(allow_client))
12786 return;
12787
12789
12791
12794 }
12795
12797 {
12799 }
12800
12802 {
12803 return true;
12804 }
12805
12806
12807
12808
12810 {
12812 }
12813
12815 {
12817 }
12818
12819
12820
12821
12822 override void SetColor(
int r,
int g,
int b,
int a)
12823 {
12829 }
12831 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12832 {
12837 }
12838
12840 {
12842 }
12843
12846 {
12847 int r,g,b,a;
12849 r = r/255;
12850 g = g/255;
12851 b = b/255;
12852 a = a/255;
12853 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12854 }
12855
12856
12857
12858 override void SetLiquidType(
int value,
bool allow_client =
false)
12859 {
12860 if (!IsServerCheck(allow_client))
12861 return;
12862
12867 }
12868
12870 {
12871 return ConfigGetInt("varLiquidTypeInit");
12872 }
12873
12875 {
12877 }
12878
12880 {
12882 SetFrozen(false);
12883 }
12884
12887 {
12888 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12889 }
12890
12891
12894 {
12895 PlayerBase nplayer;
12896 if (PlayerBase.CastTo(nplayer, player))
12897 {
12899 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12900 }
12901 }
12902
12903
12906 {
12907 PlayerBase nplayer;
12908 if (PlayerBase.CastTo(nplayer,player))
12909 {
12910 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12911 }
12912
12913 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12914
12915 if (HasEnergyManager())
12916 {
12917 GetCompEM().UpdatePlugState();
12918 }
12919 }
12920
12921
12923 {
12924 super.OnPlacementStarted(player);
12925
12927 }
12928
12929 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12930 {
12932 {
12933 m_AdminLog.OnPlacementComplete(player,
this);
12934 }
12935
12936 super.OnPlacementComplete(player, position, orientation);
12937 }
12938
12939
12940
12941
12942
12944 {
12946 {
12947 return true;
12948 }
12949 else
12950 {
12951 return false;
12952 }
12953 }
12954
12955
12957 {
12959 {
12961 }
12962 }
12963
12964
12966 {
12968 }
12969
12971 {
12973 }
12974
12975 override void InsertAgent(
int agent,
float count = 1)
12976 {
12977 if (count < 1)
12978 return;
12979
12981 }
12982
12985 {
12987 }
12988
12989
12991 {
12993 }
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13037 {
13039 return false;
13040 return true;
13041 }
13042
13044 {
13045
13047 }
13048
13049
13052 {
13053 super.CheckForRoofLimited(timeTresholdMS);
13054
13055 float time =
g_Game.GetTime();
13056 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13057 {
13058 m_PreviousRoofTestTime = time;
13059 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13060 }
13061 }
13062
13063
13065 {
13067 {
13068 return 0;
13069 }
13070
13071 if (GetInventory().GetAttachmentSlotsCount() != 0)
13072 {
13073 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13074 if (filter)
13075 return filter.GetProtectionLevel(type, false, system);
13076 else
13077 return 0;
13078 }
13079
13080 string subclassPath, entryName;
13081
13082 switch (type)
13083 {
13085 entryName = "biological";
13086 break;
13088 entryName = "chemical";
13089 break;
13090 default:
13091 entryName = "biological";
13092 break;
13093 }
13094
13095 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13096
13097 return g_Game.ConfigGetFloat(subclassPath + entryName);
13098 }
13099
13100
13101
13104 {
13105 if (!IsMagazine())
13107
13109 }
13110
13111
13112
13113
13114
13119 {
13120 return true;
13121 }
13122
13124 {
13126 }
13127
13128
13129
13130
13131
13133 {
13134 if (parent)
13135 {
13136 if (parent.IsInherited(DayZInfected))
13137 return true;
13138
13139 if (!parent.IsRuined())
13140 return true;
13141 }
13142
13143 return true;
13144 }
13145
13147 {
13148 if (!super.CanPutAsAttachment(parent))
13149 {
13150 return false;
13151 }
13152
13153 if (!IsRuined() && !parent.IsRuined())
13154 {
13155 return true;
13156 }
13157
13158 return false;
13159 }
13160
13162 {
13163
13164
13165
13166
13167 return super.CanReceiveItemIntoCargo(item);
13168 }
13169
13171 {
13172
13173
13174
13175
13176 GameInventory attachmentInv = attachment.GetInventory();
13178 {
13179 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13180 return false;
13181 }
13182
13183 InventoryLocation loc = new InventoryLocation();
13184 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13185 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13186 return false;
13187
13188 return super.CanReceiveAttachment(attachment, slotId);
13189 }
13190
13192 {
13193 if (!super.CanReleaseAttachment(attachment))
13194 return false;
13195
13196 return GetInventory().AreChildrenAccessible();
13197 }
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13220 {
13221 int id = muzzle_owner.GetMuzzleID();
13222 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13223
13224 if (WPOF_array)
13225 {
13226 for (int i = 0; i < WPOF_array.Count(); i++)
13227 {
13228 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13229
13230 if (WPOF)
13231 {
13232 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13233 }
13234 }
13235 }
13236 }
13237
13238
13240 {
13241 int id = muzzle_owner.GetMuzzleID();
13243
13244 if (WPOBE_array)
13245 {
13246 for (int i = 0; i < WPOBE_array.Count(); i++)
13247 {
13248 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13249
13250 if (WPOBE)
13251 {
13252 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13253 }
13254 }
13255 }
13256 }
13257
13258
13260 {
13261 int id = muzzle_owner.GetMuzzleID();
13262 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13263
13264 if (WPOOH_array)
13265 {
13266 for (int i = 0; i < WPOOH_array.Count(); i++)
13267 {
13268 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13269
13270 if (WPOOH)
13271 {
13272 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13273 }
13274 }
13275 }
13276 }
13277
13278
13280 {
13281 int id = muzzle_owner.GetMuzzleID();
13282 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13283
13284 if (WPOOH_array)
13285 {
13286 for (int i = 0; i < WPOOH_array.Count(); i++)
13287 {
13288 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13289
13290 if (WPOOH)
13291 {
13292 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13293 }
13294 }
13295 }
13296 }
13297
13298
13300 {
13301 int id = muzzle_owner.GetMuzzleID();
13302 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13303
13304 if (WPOOH_array)
13305 {
13306 for (int i = 0; i < WPOOH_array.Count(); i++)
13307 {
13308 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13309
13310 if (WPOOH)
13311 {
13312 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13313 }
13314 }
13315 }
13316 }
13317
13318
13319
13321 {
13323 {
13324 return true;
13325 }
13326
13327 return false;
13328 }
13329
13331 {
13333 {
13334 return true;
13335 }
13336
13337 return false;
13338 }
13339
13341 {
13343 {
13344 return true;
13345 }
13346
13347 return false;
13348 }
13349
13351 {
13352 return false;
13353 }
13354
13357 {
13358 return UATimeSpent.DEFAULT_DEPLOY;
13359 }
13360
13361
13362
13363
13365 {
13367 SetSynchDirty();
13368 }
13369
13371 {
13373 }
13374
13375
13377 {
13378 return false;
13379 }
13380
13383 {
13384 string att_type = "None";
13385
13386 if (ConfigIsExisting("soundAttType"))
13387 {
13388 att_type = ConfigGetString("soundAttType");
13389 }
13390
13392 }
13393
13395 {
13397 }
13398
13399
13400
13401
13402
13408
13410 {
13413
13415 }
13416
13417
13419 {
13421 return;
13422
13424
13427
13430
13431 SoundParameters params = new SoundParameters();
13435 }
13436
13437
13439 {
13441 {
13444
13445 SetSynchDirty();
13446
13449 }
13450 }
13451
13453 {
13455 }
13456
13457
13459 {
13461 return;
13462
13464 SetSynchDirty();
13465
13468 }
13469
13471 {
13474 }
13475
13477 {
13479 }
13480
13481 void OnApply(PlayerBase player);
13482
13484 {
13485 return 1.0;
13486 };
13487
13489 {
13491 }
13492
13494 {
13496 }
13497
13499
13501 {
13502 SetDynamicPhysicsLifeTime(0.01);
13504 }
13505
13507 {
13508 array<string> zone_names = new array<string>;
13509 GetDamageZones(zone_names);
13510 for (int i = 0; i < zone_names.Count(); i++)
13511 {
13512 SetHealthMax(zone_names.Get(i),"Health");
13513 }
13514 SetHealthMax("","Health");
13515 }
13516
13519 {
13520 float global_health = GetHealth01("","Health");
13521 array<string> zones = new array<string>;
13522 GetDamageZones(zones);
13523
13524 for (int i = 0; i < zones.Count(); i++)
13525 {
13526 SetHealth01(zones.Get(i),"Health",global_health);
13527 }
13528 }
13529
13532 {
13533 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13534 }
13535
13537 {
13538 if (!hasRootAsPlayer)
13539 {
13540 if (refParentIB)
13541 {
13542
13543 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13544 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13545
13546 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13547 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13548
13551 }
13552 else
13553 {
13554
13557 }
13558 }
13559 }
13560
13562 {
13564 {
13565 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13566 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13567 {
13568 float heatPermCoef = 1.0;
13570 while (ent)
13571 {
13572 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13573 ent = ent.GetHierarchyParent();
13574 }
13575
13576 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13577 }
13578 }
13579 }
13580
13582 {
13583
13584 EntityAI parent = GetHierarchyParent();
13585 if (!parent)
13586 {
13587 hasParent = false;
13588 hasRootAsPlayer = false;
13589 }
13590 else
13591 {
13592 hasParent = true;
13593 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13594 refParentIB =
ItemBase.Cast(parent);
13595 }
13596 }
13597
13598 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13599 {
13600
13601 }
13602
13604 {
13605
13606 return false;
13607 }
13608
13610 {
13611
13612
13613 return false;
13614 }
13615
13617 {
13618
13619 return false;
13620 }
13621
13624 {
13625 return !GetIsFrozen() &&
IsOpen();
13626 }
13627
13629 {
13630 bool hasParent = false, hasRootAsPlayer = false;
13632
13633 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13634 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13635
13636 if (wwtu || foodDecay)
13637 {
13641
13642 if (processWetness || processTemperature || processDecay)
13643 {
13645
13646 if (processWetness)
13647 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13648
13649 if (processTemperature)
13651
13652 if (processDecay)
13653 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13654 }
13655 }
13656 }
13657
13660 {
13662 }
13663
13665 {
13668
13669 return super.GetTemperatureFreezeThreshold();
13670 }
13671
13673 {
13676
13677 return super.GetTemperatureThawThreshold();
13678 }
13679
13681 {
13684
13685 return super.GetItemOverheatThreshold();
13686 }
13687
13689 {
13691 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13692
13693 return super.GetTemperatureFreezeTime();
13694 }
13695
13697 {
13699 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13700
13701 return super.GetTemperatureThawTime();
13702 }
13703
13708
13710 {
13711 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13712 }
13713
13715 {
13716 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13717 }
13718
13721 {
13723 }
13724
13726 {
13728 }
13729
13731 {
13733 }
13734
13737 {
13738 return null;
13739 }
13740
13743 {
13744 return false;
13745 }
13746
13748 {
13750 {
13753 if (!trg)
13754 {
13756 explosive = this;
13757 }
13758
13759 explosive.PairRemote(trg);
13761
13762 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13763 trg.SetPersistentPairID(persistentID);
13764 explosive.SetPersistentPairID(persistentID);
13765
13766 return true;
13767 }
13768 return false;
13769 }
13770
13773 {
13774 float ret = 1.0;
13777 ret *= GetHealth01();
13778
13779 return ret;
13780 }
13781
13782 #ifdef DEVELOPER
13783 override void SetDebugItem()
13784 {
13785 super.SetDebugItem();
13786 _itemBase = this;
13787 }
13788
13790 {
13791 string text = super.GetDebugText();
13792
13794 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13795
13796 return text;
13797 }
13798 #endif
13799
13801 {
13802 return true;
13803 }
13804
13806
13808
13810 {
13813 }
13814
13815
13823
13839
13840 [
Obsolete(
"Use ItemSoundHandler instead")]
13843 {
13844 if (!
g_Game.IsDedicatedServer())
13845 {
13846 if (ConfigIsExisting("attachSoundSet"))
13847 {
13848 string cfg_path = "";
13849 string soundset = "";
13850 string type_name =
GetType();
13851
13854 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13855 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13856
13857 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13858 {
13859 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13860 {
13861 if (cfg_slot_array[i] == slot_type)
13862 {
13863 soundset = cfg_soundset_array[i];
13864 break;
13865 }
13866 }
13867 }
13868
13869 if (soundset != "")
13870 {
13871 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13873 }
13874 }
13875 }
13876 }
13877
13879}
13880
13882{
13884 if (entity)
13885 {
13886 bool is_item = entity.IsInherited(
ItemBase);
13887 if (is_item && full_quantity)
13888 {
13891 }
13892 }
13893 else
13894 {
13896 return NULL;
13897 }
13898 return entity;
13899}
13900
13902{
13903 if (item)
13904 {
13905 if (health > 0)
13906 item.SetHealth("", "", health);
13907
13908 if (item.CanHaveTemperature())
13909 {
13911 if (item.CanFreeze())
13912 item.SetFrozen(false);
13913 }
13914
13915 if (item.HasEnergyManager())
13916 {
13917 if (quantity >= 0)
13918 {
13919 item.GetCompEM().SetEnergy0To1(quantity);
13920 }
13921 else
13922 {
13924 }
13925 }
13926 else if (item.IsMagazine())
13927 {
13928 Magazine mag = Magazine.Cast(item);
13929 if (quantity >= 0)
13930 {
13931 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13932 }
13933 else
13934 {
13936 }
13937
13938 }
13939 else
13940 {
13941 if (quantity >= 0)
13942 {
13943 item.SetQuantityNormalized(quantity, false);
13944 }
13945 else
13946 {
13948 }
13949
13950 }
13951 }
13952}
13953
13954#ifdef DEVELOPER
13956#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.