8989{
8991 {
8992 return true;
8993 }
8994};
8995
8997{
8998
8999};
9000
9001
9002
9004{
9008
9010
9013
9014
9015
9016
9017
9026
9032
9037
9042
9063 protected bool m_IsResultOfSplit
9064
9066
9071
9072
9073
9075
9079
9080
9081
9083
9086
9087
9088
9094
9095
9103
9106
9107
9109
9110
9112
9113
9118
9119
9124
9126
9127
9129
9130
9132 {
9137
9138 if (!
g_Game.IsDedicatedServer())
9139 {
9141 {
9143
9145 {
9147 }
9148 }
9149
9152 }
9153
9154 m_OldLocation = null;
9155
9157 {
9159 }
9160
9161 if (ConfigIsExisting("headSelectionsToHide"))
9162 {
9165 }
9166
9168 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9169 {
9171 }
9172
9174
9175 m_IsResultOfSplit = false;
9176
9178 }
9179
9181 {
9182 super.InitItemVariables();
9183
9189 m_Count = ConfigGetInt(
"count");
9190
9193
9198
9201
9206
9218
9222
9223
9226 if (ConfigIsExisting("canBeSplit"))
9227 {
9230 }
9231
9233 if (ConfigIsExisting("itemBehaviour"))
9235
9236
9239 RegisterNetSyncVariableInt("m_VarLiquidType");
9240 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9241
9242 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9243 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9244 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9245
9246 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9247 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9248 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9249 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9250
9251 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9252 RegisterNetSyncVariableBool("m_IsTakeable");
9253 RegisterNetSyncVariableBool("m_IsHologram");
9254
9257 {
9260 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9261 }
9262
9264
9266 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9268
9270 }
9271
9273 {
9275 }
9276
9278 {
9281 {
9286 }
9287 }
9288
9289 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9290 {
9292 {
9295 }
9296
9298 }
9299
9301 {
9307 }
9308
9310
9312 {
9314
9315 if (!action)
9316 {
9317 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9318 return;
9319 }
9320
9322 if (!ai)
9323 {
9325 return;
9326 }
9327
9329 if (!action_array)
9330 {
9331 action_array = new array<ActionBase_Basic>;
9333 }
9334 if (LogManager.IsActionLogEnable())
9335 {
9336 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9337 }
9338
9339 if (action_array.Find(action) != -1)
9340 {
9341 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9342 }
9343 else
9344 {
9345 action_array.Insert(action);
9346 }
9347 }
9348
9350 {
9351 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9352 ActionBase action = player.GetActionManager().GetAction(actionName);
9355
9356 if (action_array)
9357 {
9358 action_array.RemoveItem(action);
9359 }
9360 }
9361
9362
9363
9365 {
9366 ActionOverrideData overrideData = new ActionOverrideData();
9370
9372 if (!actionMap)
9373 {
9376 }
9377
9378 actionMap.Insert(this.
Type(), overrideData);
9379
9380 }
9381
9383
9385
9386
9388 {
9391
9394
9395 string config_to_search = "CfgVehicles";
9396 string muzzle_owner_config;
9397
9399 {
9400 if (IsInherited(Weapon))
9401 config_to_search = "CfgWeapons";
9402
9403 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9404
9405 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9406
9407 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9408
9409 if (config_OnFire_subclass_count > 0)
9410 {
9411 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9412
9413 for (int i = 0; i < config_OnFire_subclass_count; i++)
9414 {
9415 string particle_class = "";
9416 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9417 string config_OnFire_entry = config_OnFire_class + particle_class;
9418 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9419 WPOF_array.Insert(WPOF);
9420 }
9421
9422
9424 }
9425 }
9426
9428 {
9429 config_to_search = "CfgWeapons";
9430 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9431
9432 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9433
9434 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9435
9436 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9437 {
9438 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9439
9440 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9441 {
9442 string particle_class2 = "";
9443 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9444 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9445 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9446 WPOBE_array.Insert(WPOBE);
9447 }
9448
9449
9451 }
9452 }
9453 }
9454
9455
9457 {
9460
9462 {
9463 string config_to_search = "CfgVehicles";
9464
9465 if (IsInherited(Weapon))
9466 config_to_search = "CfgWeapons";
9467
9468 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9469 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9470
9471 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9472 {
9473
9475
9477 {
9479 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9481 return;
9482 }
9483
9486
9487
9488
9489 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9490 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9491
9492 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9493 {
9494 string particle_class = "";
9495 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9496 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9497 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9498
9499 if (entry_type == CT_CLASS)
9500 {
9501 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9502 WPOOH_array.Insert(WPOF);
9503 }
9504 }
9505
9506
9508 }
9509 }
9510 }
9511
9513 {
9515 }
9516
9518 {
9520 {
9522
9525
9528
9529 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9530 }
9531 }
9532
9534 {
9536 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9537
9539 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9540
9542 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9543
9545 {
9547 }
9548 }
9549
9551 {
9553 }
9554
9556 {
9559 else
9561
9563 {
9566 }
9567 else
9568 {
9571
9574 }
9575
9577 }
9578
9580 {
9582 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9583 }
9584
9586 {
9588 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9590 }
9591
9593 {
9595 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9596 }
9597
9599 {
9602
9603 OverheatingParticle OP = new OverheatingParticle();
9608
9610 }
9611
9613 {
9616
9617 return -1;
9618 }
9619
9621 {
9623 {
9626
9627 for (int i = count; i > 0; --i)
9628 {
9629 int id = i - 1;
9632
9635
9636 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9637 {
9638 if (p)
9639 {
9642 }
9643 }
9644 }
9645 }
9646 }
9647
9649 {
9651 {
9653 {
9654 int id = i - 1;
9656
9657 if (OP)
9658 {
9660
9661 if (p)
9662 {
9664 }
9665
9666 delete OP;
9667 }
9668 }
9669
9672 }
9673 }
9674
9677 {
9678 return 0.0;
9679 }
9680
9681
9683 {
9684 return 250;
9685 }
9686
9688 {
9689 return 0;
9690 }
9691
9694 {
9696 return true;
9697
9698 return false;
9699 }
9700
9703 {
9706
9708 {
9710 }
9711 else
9712 {
9713
9715 }
9716
9718 }
9719
9726 {
9727 return -1;
9728 }
9729
9730
9731
9732
9734 {
9736 {
9737 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9738 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9739
9740 if (r_index >= 0)
9741 {
9742 InventoryLocation r_il = new InventoryLocation;
9743 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9744
9745 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9748 {
9749 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9750 }
9752 {
9753 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9754 }
9755
9756 }
9757
9758 player.GetHumanInventory().ClearUserReservedLocation(this);
9759 }
9760
9763 }
9764
9765
9766
9767
9769 {
9770 return ItemBase.m_DebugActionsMask;
9771 }
9772
9774 {
9775 return ItemBase.m_DebugActionsMask & mask;
9776 }
9777
9779 {
9780 ItemBase.m_DebugActionsMask = mask;
9781 }
9782
9784 {
9785 ItemBase.m_DebugActionsMask |= mask;
9786 }
9787
9789 {
9790 ItemBase.m_DebugActionsMask &= ~mask;
9791 }
9792
9794 {
9796 {
9798 }
9799 else
9800 {
9802 }
9803 }
9804
9805
9807 {
9808 if (GetEconomyProfile())
9809 {
9810 float q_max = GetEconomyProfile().GetQuantityMax();
9811 if (q_max > 0)
9812 {
9813 float q_min = GetEconomyProfile().GetQuantityMin();
9814 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9815
9817 {
9818 ComponentEnergyManager comp = GetCompEM();
9820 {
9822 }
9823 }
9825 {
9827
9828 }
9829
9830 }
9831 }
9832 }
9833
9836 {
9837 EntityAI parent = GetHierarchyParent();
9838
9839 if (parent)
9840 {
9841 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9842 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9843 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9844 }
9845 }
9846
9849 {
9850 EntityAI parent = GetHierarchyParent();
9851
9852 if (parent)
9853 {
9854 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9855 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9856 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9857 }
9858 }
9859
9861 {
9862
9863
9864
9865
9867
9869 {
9870 if (ScriptInputUserData.CanStoreInputUserData())
9871 {
9872 ScriptInputUserData ctx = new ScriptInputUserData;
9878 ctx.
Write(use_stack_max);
9881
9883 {
9884 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9885 }
9886 }
9887 }
9888 else if (!
g_Game.IsMultiplayer())
9889 {
9891 }
9892 }
9893
9895 {
9897 }
9898
9900 {
9902 }
9903
9905 {
9907 }
9908
9910 {
9911
9912 return false;
9913 }
9914
9916 {
9917 return false;
9918 }
9919
9923 {
9924 return false;
9925 }
9926
9928 {
9929 return "";
9930 }
9931
9933
9935 {
9936 return false;
9937 }
9938
9940 {
9941 return true;
9942 }
9943
9944
9945
9947 {
9948 return true;
9949 }
9950
9952 {
9953 return true;
9954 }
9955
9957 {
9958 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9960 }
9961
9963 {
9965 }
9966
9968 {
9970 if (!is_being_placed)
9972 SetSynchDirty();
9973 }
9974
9975
9977
9979 {
9981 }
9982
9984 {
9986 }
9987
9989 {
9990 return 1;
9991 }
9992
9994 {
9995 return false;
9996 }
9997
9999 {
10001 SetSynchDirty();
10002 }
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10039 {
10040 super.OnMovedInsideCargo(container);
10041
10042 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10043 }
10044
10045 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10046 {
10047 super.EEItemLocationChanged(oldLoc, newLoc);
10048
10049 PlayerBase newPlayer = null;
10050 PlayerBase oldPlayer = null;
10051
10052 if (newLoc.GetParent())
10053 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10054
10055 if (oldLoc.GetParent())
10056 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10057
10059 {
10060 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10061
10062 if (rIndex >= 0)
10063 {
10064 InventoryLocation rIl = new InventoryLocation;
10065 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10066
10067 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10070 {
10071 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10072 }
10074 {
10076 }
10077
10078 }
10079 }
10080
10082 {
10083 if (newPlayer)
10084 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10085
10086 if (newPlayer == oldPlayer)
10087 {
10088 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10089 {
10091 {
10092 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10093 {
10094 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10095 }
10096 }
10097 else
10098 {
10099 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10100 }
10101 }
10102
10103 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10104 {
10105 int type = oldLoc.GetType();
10107 {
10108 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10109 }
10111 {
10112 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10113 }
10114 }
10115 if (!m_OldLocation)
10116 {
10117 m_OldLocation = new InventoryLocation;
10118 }
10119 m_OldLocation.Copy(oldLoc);
10120 }
10121 else
10122 {
10123 if (m_OldLocation)
10124 {
10125 m_OldLocation.Reset();
10126 }
10127 }
10128
10129 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10130 }
10131 else
10132 {
10133 if (newPlayer)
10134 {
10135 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10136 if (resIndex >= 0)
10137 {
10138 InventoryLocation il = new InventoryLocation;
10139 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10141 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10144 {
10145 il.
GetParent().GetOnReleaseLock().Invoke(it);
10146 }
10148 {
10150 }
10151
10152 }
10153 }
10155 {
10156
10158 }
10159
10160 if (m_OldLocation)
10161 {
10162 m_OldLocation.Reset();
10163 }
10164 }
10165
10167 {
10168 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10169 }
10170
10172 {
10173 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10174 }
10175 }
10176
10177 override void EOnContact(IEntity other, Contact extra)
10178 {
10180 {
10181 int liquidType = -1;
10183 if (impactSpeed > 0.0)
10184 {
10186 #ifndef SERVER
10188 #else
10190 SetSynchDirty();
10191 #endif
10193 }
10194 }
10195
10196 #ifdef SERVER
10197 if (GetCompEM() && GetCompEM().IsPlugged())
10198 {
10199 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10200 GetCompEM().UnplugThis();
10201 }
10202 #endif
10203 }
10204
10206
10208 {
10210 }
10211
10213 {
10214
10215 }
10216
10218 {
10219 super.OnItemLocationChanged(old_owner, new_owner);
10220
10221 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10222 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10223
10224 if (!relatedPlayer && playerNew)
10225 relatedPlayer = playerNew;
10226
10227 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10228 {
10230 if (actionMgr)
10231 {
10232 ActionBase currentAction = actionMgr.GetRunningAction();
10233 if (currentAction)
10235 }
10236 }
10237
10238 Man ownerPlayerOld = null;
10239 Man ownerPlayerNew = null;
10240
10241 if (old_owner)
10242 {
10243 if (old_owner.
IsMan())
10244 {
10245 ownerPlayerOld = Man.Cast(old_owner);
10246 }
10247 else
10248 {
10249 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10250 }
10251 }
10252 else
10253 {
10255 {
10257
10258 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10259 {
10260 GetCompEM().UnplugThis();
10261 }
10262 }
10263 }
10264
10265 if (new_owner)
10266 {
10267 if (new_owner.
IsMan())
10268 {
10269 ownerPlayerNew = Man.Cast(new_owner);
10270 }
10271 else
10272 {
10273 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10274 }
10275 }
10276
10277 if (ownerPlayerOld != ownerPlayerNew)
10278 {
10279 if (ownerPlayerOld)
10280 {
10281 array<EntityAI> subItemsExit = new array<EntityAI>;
10283 for (int i = 0; i < subItemsExit.Count(); i++)
10284 {
10287 }
10288 }
10289
10290 if (ownerPlayerNew)
10291 {
10292 array<EntityAI> subItemsEnter = new array<EntityAI>;
10294 for (int j = 0; j < subItemsEnter.Count(); j++)
10295 {
10298 }
10299 }
10300 }
10301 else if (ownerPlayerNew != null)
10302 {
10303 PlayerBase nplayer;
10304 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10305 {
10306 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10308 for (int k = 0; k < subItemsUpdate.Count(); k++)
10309 {
10311 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10312 }
10313 }
10314 }
10315
10316 if (old_owner)
10317 old_owner.OnChildItemRemoved(this);
10318 if (new_owner)
10319 new_owner.OnChildItemReceived(this);
10320 }
10321
10322
10324 {
10325 super.EEDelete(parent);
10326 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10327 if (player)
10328 {
10330
10331 if (player.IsAlive())
10332 {
10333 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10334 if (r_index >= 0)
10335 {
10336 InventoryLocation r_il = new InventoryLocation;
10337 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10338
10339 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10342 {
10343 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10344 }
10346 {
10347 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10348 }
10349
10350 }
10351
10352 player.RemoveQuickBarEntityShortcut(this);
10353 }
10354 }
10355 }
10356
10358 {
10359 super.EEKilled(killer);
10360
10363 {
10364 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10365 {
10366 if (IsMagazine())
10367 {
10368 if (Magazine.Cast(this).GetAmmoCount() > 0)
10369 {
10371 }
10372 }
10373 else
10374 {
10376 }
10377 }
10378 }
10379 }
10380
10382 {
10383 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10384
10385 super.OnWasAttached(parent, slot_id);
10386
10389
10392 }
10393
10395 {
10396 super.OnWasDetached(parent, slot_id);
10397
10400
10403 }
10404
10406 {
10407 int idx;
10410
10411 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10412 if (inventory_slots.Count() < 1)
10413 {
10414 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10415 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10416 }
10417 else
10418 {
10419 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10420 }
10421
10422 idx = inventory_slots.Find(slot);
10423 if (idx < 0)
10424 return "";
10425
10426 return attach_types.Get(idx);
10427 }
10428
10430 {
10431 int idx = -1;
10432 string slot;
10433
10436
10437 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10438 if (inventory_slots.Count() < 1)
10439 {
10440 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10441 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10442 }
10443 else
10444 {
10445 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10446 if (detach_types.Count() < 1)
10447 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10448 }
10449
10450 for (int i = 0; i < inventory_slots.Count(); i++)
10451 {
10452 slot = inventory_slots.Get(i);
10453 }
10454
10455 if (slot != "")
10456 {
10457 if (detach_types.Count() == 1)
10458 idx = 0;
10459 else
10460 idx = inventory_slots.Find(slot);
10461 }
10462 if (idx < 0)
10463 return "";
10464
10465 return detach_types.Get(idx);
10466 }
10467
10469 {
10470
10472
10473
10474 float min_time = 1;
10475 float max_time = 3;
10476 float delay = Math.RandomFloat(min_time, max_time);
10477
10478 explode_timer.Run(delay, this, "DoAmmoExplosion");
10479 }
10480
10482 {
10483 Magazine magazine = Magazine.Cast(this);
10484 int pop_sounds_count = 6;
10485 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10486
10487
10488 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10489 string sound_name = pop_sounds[ sound_idx ];
10490 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10491
10492
10493 magazine.ServerAddAmmoCount(-1);
10494
10495
10496 float min_temp_to_explode = 100;
10497
10498 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10499 {
10501 }
10502 }
10503
10504
10505 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10506 {
10507 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10508
10509 const int CHANCE_DAMAGE_CARGO = 4;
10510 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10511 const int CHANCE_DAMAGE_NOTHING = 2;
10512
10514 {
10515 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10516 int chances;
10517 int rnd;
10518
10519 if (GetInventory().GetCargo())
10520 {
10521 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10522 rnd = Math.RandomInt(0,chances);
10523
10524 if (rnd < CHANCE_DAMAGE_CARGO)
10525 {
10527 }
10528 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10529 {
10531 }
10532 }
10533 else
10534 {
10535 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10536 rnd = Math.RandomInt(0,chances);
10537
10538 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10539 {
10541 }
10542 }
10543 }
10544 }
10545
10547 {
10548 CargoBase cargo = GetInventory().GetCargo();
10549 if (cargo)
10550 {
10552 if (item_count > 0)
10553 {
10554 int random_pick = Math.RandomInt(0, item_count);
10556 if (!item.IsExplosive())
10557 {
10558 item.AddHealth("","",damage);
10559 return true;
10560 }
10561 }
10562 }
10563 return false;
10564 }
10565
10567 {
10568 GameInventory inventory = GetInventory();
10570 if (attachment_count > 0)
10571 {
10572 int random_pick = Math.RandomInt(0, attachment_count);
10574 if (!attachment.IsExplosive())
10575 {
10576 attachment.AddHealth("","",damage);
10577 return true;
10578 }
10579 }
10580 return false;
10581 }
10582
10584 {
10586 }
10587
10589 {
10591 return GetInventory().CanRemoveEntity();
10592
10593 return false;
10594 }
10595
10597 {
10598
10600 return false;
10601
10602
10604 return false;
10605
10606
10607
10609 if (delta == 0)
10610 return false;
10611
10612
10613 return true;
10614 }
10615
10617 {
10619 {
10620 if (ScriptInputUserData.CanStoreInputUserData())
10621 {
10622 ScriptInputUserData ctx = new ScriptInputUserData;
10627 ctx.
Write(destination_entity);
10629 ctx.
Write(slot_id);
10631 }
10632 }
10633 else if (!
g_Game.IsMultiplayer())
10634 {
10636 }
10637 }
10638
10640 {
10641 float split_quantity_new;
10645 InventoryLocation loc = new InventoryLocation;
10646
10647 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10648 {
10650 split_quantity_new = stack_max;
10651 else
10653
10655 {
10656 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10657 if (new_item)
10658 {
10659 new_item.SetResultOfSplit(true);
10660 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10662 new_item.
SetQuantity(split_quantity_new,
false,
true);
10663 }
10664 }
10665 }
10666 else if (destination_entity && slot_id == -1)
10667 {
10668 if (quantity > stack_max)
10669 split_quantity_new = stack_max;
10670 else
10671 split_quantity_new = quantity;
10672
10674 {
10675 GameInventory destinationInventory = destination_entity.GetInventory();
10677 {
10680 }
10681
10682 if (new_item)
10683 {
10684 new_item.SetResultOfSplit(true);
10685 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10687 new_item.
SetQuantity(split_quantity_new,
false,
true);
10688 }
10689 }
10690 }
10691 else
10692 {
10693 if (stack_max != 0)
10694 {
10696 {
10698 }
10699
10700 if (split_quantity_new == 0)
10701 {
10702 if (!
g_Game.IsMultiplayer())
10703 player.PhysicalPredictiveDropItem(this);
10704 else
10705 player.ServerDropEntity(this);
10706 return;
10707 }
10708
10710 {
10712
10713 if (new_item)
10714 {
10715 new_item.SetResultOfSplit(true);
10716 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10719 new_item.PlaceOnSurface();
10720 }
10721 }
10722 }
10723 }
10724 }
10725
10727 {
10728 float split_quantity_new;
10732 InventoryLocation loc = new InventoryLocation;
10733
10734 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10735 {
10737 split_quantity_new = stack_max;
10738 else
10740
10742 {
10743 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10744 if (new_item)
10745 {
10746 new_item.SetResultOfSplit(true);
10747 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10749 new_item.
SetQuantity(split_quantity_new,
false,
true);
10750 }
10751 }
10752 }
10753 else if (destination_entity && slot_id == -1)
10754 {
10755 if (quantity > stack_max)
10756 split_quantity_new = stack_max;
10757 else
10758 split_quantity_new = quantity;
10759
10761 {
10762 GameInventory destinationInventory = destination_entity.GetInventory();
10764 {
10767 }
10768
10769 if (new_item)
10770 {
10771 new_item.SetResultOfSplit(true);
10772 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10774 new_item.
SetQuantity(split_quantity_new,
false,
true);
10775 }
10776 }
10777 }
10778 else
10779 {
10780 if (stack_max != 0)
10781 {
10783 {
10785 }
10786
10788 {
10790
10791 if (new_item)
10792 {
10793 new_item.SetResultOfSplit(true);
10794 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10797 new_item.PlaceOnSurface();
10798 }
10799 }
10800 }
10801 }
10802 }
10803
10805 {
10807 {
10808 if (ScriptInputUserData.CanStoreInputUserData())
10809 {
10810 ScriptInputUserData ctx = new ScriptInputUserData;
10815 dst.WriteToContext(ctx);
10817 }
10818 }
10819 else if (!
g_Game.IsMultiplayer())
10820 {
10822 }
10823 }
10824
10826 {
10828 {
10829 if (ScriptInputUserData.CanStoreInputUserData())
10830 {
10831 ScriptInputUserData ctx = new ScriptInputUserData;
10836 ctx.
Write(destination_entity);
10842 }
10843 }
10844 else if (!
g_Game.IsMultiplayer())
10845 {
10847 }
10848 }
10849
10851 {
10853 }
10854
10856 {
10858 float split_quantity_new;
10860 if (dst.IsValid())
10861 {
10862 int slot_id = dst.GetSlot();
10864
10865 if (quantity > stack_max)
10866 split_quantity_new = stack_max;
10867 else
10868 split_quantity_new = quantity;
10869
10871 {
10873
10874 if (new_item)
10875 {
10876 new_item.SetResultOfSplit(true);
10877 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10879 new_item.
SetQuantity(split_quantity_new,
false,
true);
10880 }
10881
10882 return new_item;
10883 }
10884 }
10885
10886 return null;
10887 }
10888
10890 {
10892 float split_quantity_new;
10894 if (destination_entity)
10895 {
10897 if (quantity > stackable)
10898 split_quantity_new = stackable;
10899 else
10900 split_quantity_new = quantity;
10901
10903 {
10904 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10905 if (new_item)
10906 {
10907 new_item.SetResultOfSplit(true);
10908 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10910 new_item.
SetQuantity(split_quantity_new,
false,
true);
10911 }
10912 }
10913 }
10914 }
10915
10917 {
10919 {
10920 if (ScriptInputUserData.CanStoreInputUserData())
10921 {
10922 ScriptInputUserData ctx = new ScriptInputUserData;
10927 ItemBase destination_entity =
this;
10928 ctx.
Write(destination_entity);
10932 }
10933 }
10934 else if (!
g_Game.IsMultiplayer())
10935 {
10937 }
10938 }
10939
10941 {
10943 float split_quantity_new;
10945 if (player)
10946 {
10948 if (quantity > stackable)
10949 split_quantity_new = stackable;
10950 else
10951 split_quantity_new = quantity;
10952
10954 {
10955 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10956 new_item =
ItemBase.Cast(in_hands);
10957 if (new_item)
10958 {
10959 new_item.SetResultOfSplit(true);
10960 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10962 new_item.SetQuantity(split_quantity_new, false, true);
10963 }
10964 }
10965 }
10966 }
10967
10969 {
10971 float split_quantity_new = Math.Floor(quantity * 0.5);
10972
10974 return;
10975
10977
10978 if (new_item)
10979 {
10980 if (new_item.GetQuantityMax() < split_quantity_new)
10981 {
10982 split_quantity_new = new_item.GetQuantityMax();
10983 }
10984
10985 new_item.SetResultOfSplit(true);
10986 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10987
10989 {
10992 }
10993 else
10994 {
10996 new_item.
SetQuantity(split_quantity_new,
false,
true);
10997 }
10998 }
10999 }
11000
11002 {
11004 float split_quantity_new = Math.Floor(quantity / 2);
11005
11007 return;
11008
11009 InventoryLocation invloc = new InventoryLocation;
11011
11013 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11014
11015 if (new_item)
11016 {
11017 if (new_item.GetQuantityMax() < split_quantity_new)
11018 {
11019 split_quantity_new = new_item.GetQuantityMax();
11020 }
11022 {
11025 }
11026 else if (split_quantity_new > 1)
11027 {
11029 new_item.
SetQuantity(split_quantity_new,
false,
true);
11030 }
11031 }
11032 }
11033
11036 {
11037 SetWeightDirty();
11039
11040 if (parent)
11041 parent.OnAttachmentQuantityChangedEx(this, delta);
11042
11044 {
11046 {
11048 }
11050 {
11051 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11053 }
11054 }
11055 }
11056
11059 {
11060
11061 }
11062
11065 {
11067 }
11068
11070 {
11071 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11072
11074 {
11075 if (newLevel == GameConstants.STATE_RUINED)
11076 {
11078 EntityAI parent = GetHierarchyParent();
11079 if (parent && parent.IsFireplace())
11080 {
11081 CargoBase cargo = GetInventory().GetCargo();
11082 if (cargo)
11083 {
11085 {
11087 }
11088 }
11089 }
11090 }
11091
11093 {
11094
11096 return;
11097 }
11098
11099 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11100 {
11102 }
11103 }
11104 }
11105
11106
11108 {
11109 super.OnRightClick();
11110
11112 {
11114 {
11115 if (ScriptInputUserData.CanStoreInputUserData())
11116 {
11117 EntityAI root = GetHierarchyRoot();
11118 Man playerOwner = GetHierarchyRootPlayer();
11119 InventoryLocation dst = new InventoryLocation;
11120
11121
11122 if (!playerOwner && root && root == this)
11123 {
11125 }
11126 else
11127 {
11128
11129 GetInventory().GetCurrentInventoryLocation(dst);
11131 {
11132 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11134 {
11136 }
11137 else
11138 {
11140
11141
11142 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11143 {
11145 }
11146 else
11147 {
11148 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11149 }
11150 }
11151 }
11152 }
11153
11154 ScriptInputUserData ctx = new ScriptInputUserData;
11162 }
11163 }
11164 else if (!
g_Game.IsMultiplayer())
11165 {
11167 }
11168 }
11169 }
11170
11172 {
11173 if (root)
11174 {
11175 vector m4[4];
11176 root.GetTransform(m4);
11177 dst.SetGround(this, m4);
11178 }
11179 else
11180 {
11181 GetInventory().GetCurrentInventoryLocation(dst);
11182 }
11183 }
11184
11185 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11186 {
11187
11188 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11189 return false;
11190
11191 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11192 return false;
11193
11194
11196 return false;
11197
11198
11199 Magazine mag = Magazine.Cast(this);
11200 if (mag)
11201 {
11202 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11203 return false;
11204
11205 if (stack_max_limit)
11206 {
11207 Magazine other_mag = Magazine.Cast(other_item);
11208 if (other_item)
11209 {
11210 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11211 return false;
11212 }
11213
11214 }
11215 }
11216 else
11217 {
11218
11220 return false;
11221
11223 return false;
11224 }
11225
11226 PlayerBase player = null;
11227 if (CastTo(player, GetHierarchyRootPlayer()))
11228 {
11229 if (player.GetInventory().HasAttachment(this))
11230 return false;
11231
11232 if (player.IsItemsToDelete())
11233 return false;
11234 }
11235
11236 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11237 return false;
11238
11239 int slotID;
11241 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11242 return false;
11243
11244 return true;
11245 }
11246
11248 {
11250 }
11251
11253 {
11254 return m_IsResultOfSplit;
11255 }
11256
11258 {
11259 m_IsResultOfSplit = value;
11260 }
11261
11263 {
11265 }
11266
11268 {
11269 float other_item_quantity = other_item.GetQuantity();
11270 float this_free_space;
11271
11273
11275
11276 if (other_item_quantity > this_free_space)
11277 {
11278 return this_free_space;
11279 }
11280 else
11281 {
11282 return other_item_quantity;
11283 }
11284 }
11285
11287 {
11289 }
11290
11292 {
11294 return;
11295
11296 if (!IsMagazine() && other_item)
11297 {
11299 if (quantity_used != 0)
11300 {
11301 float hp1 = GetHealth01("","");
11302 float hp2 = other_item.GetHealth01("","");
11303 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11304 hpResult = hpResult / (
GetQuantity() + quantity_used);
11305
11306 hpResult *= GetMaxHealth();
11307 Math.Round(hpResult);
11308 SetHealth("", "Health", hpResult);
11309
11311 other_item.AddQuantity(-quantity_used);
11312 }
11313 }
11315 }
11316
11318 {
11319 #ifdef SERVER
11320 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11321 GetHierarchyParent().IncreaseLifetimeUp();
11322 #endif
11323 };
11324
11326 {
11327 PlayerBase p = PlayerBase.Cast(player);
11328
11329 array<int> recipesIds = p.m_Recipes;
11330 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11331 if (moduleRecipesManager)
11332 {
11333 EntityAI itemInHands = player.GetEntityInHands();
11334 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11335 }
11336
11337 for (int i = 0;i < recipesIds.Count(); i++)
11338 {
11339 int key = recipesIds.Get(i);
11340 string recipeName = moduleRecipesManager.GetRecipeName(key);
11342 }
11343 }
11344
11345
11346 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11347 {
11348 super.GetDebugActions(outputList);
11349
11350
11356
11357
11362
11367
11368
11372
11373
11375 {
11379 }
11380
11383
11384
11388
11390
11391 InventoryLocation loc = new InventoryLocation();
11392 GetInventory().GetCurrentInventoryLocation(loc);
11394 {
11395 if (Gizmo_IsSupported())
11398 }
11399
11401 }
11402
11403
11404
11405
11407 {
11408 super.OnAction(action_id, player, ctx);
11409
11411 {
11412 switch (action_id)
11413 {
11417 return true;
11421 return true;
11422 }
11423 }
11424
11426 {
11427 switch (action_id)
11428 {
11430 Delete();
11431 return true;
11432 }
11433 }
11434
11435 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11436 {
11437 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11438 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11439 PlayerBase p = PlayerBase.Cast(player);
11440 if (
EActions.RECIPES_RANGE_START < 1000)
11441 {
11442 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11443 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11444 }
11445 }
11446 #ifndef SERVER
11447 else if (action_id ==
EActions.WATCH_PLAYER)
11448 {
11449 PluginDeveloper.SetDeveloperItemClientEx(player);
11450 }
11451 #endif
11453 {
11454 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11455 {
11456 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11457 OnDebugButtonPressServer(id + 1);
11458 }
11459
11460 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11461 {
11462 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11464 }
11465
11466 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11467 {
11468 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11470 }
11471
11472 else if (action_id ==
EActions.ADD_QUANTITY)
11473 {
11474 if (IsMagazine())
11475 {
11476 Magazine mag = Magazine.Cast(this);
11477 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11478 }
11479 else
11480 {
11482 }
11483
11484 if (m_EM)
11485 {
11486 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11487 }
11488
11489 }
11490
11491 else if (action_id ==
EActions.REMOVE_QUANTITY)
11492 {
11493 if (IsMagazine())
11494 {
11495 Magazine mag2 = Magazine.Cast(this);
11496 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11497 }
11498 else
11499 {
11501 }
11502 if (m_EM)
11503 {
11504 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11505 }
11506
11507 }
11508
11509 else if (action_id ==
EActions.SET_QUANTITY_0)
11510 {
11512
11513 if (m_EM)
11514 {
11515 m_EM.SetEnergy(0);
11516 }
11517 }
11518
11519 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11520 {
11522
11523 if (m_EM)
11524 {
11525 m_EM.SetEnergy(m_EM.GetEnergyMax());
11526 }
11527 }
11528
11529 else if (action_id ==
EActions.ADD_HEALTH)
11530 {
11531 AddHealth("","",GetMaxHealth("","Health")/5);
11532 }
11533 else if (action_id ==
EActions.REMOVE_HEALTH)
11534 {
11535 AddHealth("","",-GetMaxHealth("","Health")/5);
11536 }
11537 else if (action_id ==
EActions.DESTROY_HEALTH)
11538 {
11539 SetHealth01("","",0);
11540 }
11541 else if (action_id ==
EActions.WATCH_ITEM)
11542 {
11544 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11545 #ifdef DEVELOPER
11546 SetDebugDeveloper_item(this);
11547 #endif
11548 }
11549
11550 else if (action_id ==
EActions.ADD_TEMPERATURE)
11551 {
11552 AddTemperature(20);
11553
11554 }
11555
11556 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11557 {
11558 AddTemperature(-20);
11559
11560 }
11561
11562 else if (action_id ==
EActions.FLIP_FROZEN)
11563 {
11564 SetFrozen(!GetIsFrozen());
11565
11566 }
11567
11568 else if (action_id ==
EActions.ADD_WETNESS)
11569 {
11571
11572 }
11573
11574 else if (action_id ==
EActions.REMOVE_WETNESS)
11575 {
11577
11578 }
11579
11580 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11581 {
11584
11585
11586 }
11587
11588 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11589 {
11592 }
11593
11594 else if (action_id ==
EActions.MAKE_SPECIAL)
11595 {
11596 auto debugParams = DebugSpawnParams.WithPlayer(player);
11597 OnDebugSpawnEx(debugParams);
11598 }
11599
11600 }
11601
11602
11603 return false;
11604 }
11605
11606
11607
11608
11612
11615
11616
11617
11619 {
11620 return false;
11621 }
11622
11623
11625 {
11626 return true;
11627 }
11628
11629
11631 {
11632 return true;
11633 }
11634
11635
11636
11638 {
11639 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11640 return g_Game.ConfigIsExisting(config_path);
11641 }
11642
11645 {
11646 return null;
11647 }
11648
11650 {
11651 return false;
11652 }
11653
11655 {
11656 return false;
11657 }
11658
11662
11663
11665 {
11666 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11667 return module_repairing.CanRepair(this, item_repair_kit);
11668 }
11669
11670
11671 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11672 {
11673 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11674 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11675 }
11676
11677
11679 {
11680
11681
11682
11683
11684
11685
11686
11687
11688 return 1;
11689 }
11690
11691
11692
11694 {
11696 }
11697
11698
11699
11701 {
11703 }
11704
11705
11714 {
11715 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11716
11717 if (player)
11718 {
11719 player.MessageStatus(text);
11720 }
11721 }
11722
11723
11732 {
11733 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11734
11735 if (player)
11736 {
11737 player.MessageAction(text);
11738 }
11739 }
11740
11741
11750 {
11751 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11752
11753 if (player)
11754 {
11755 player.MessageFriendly(text);
11756 }
11757 }
11758
11759
11768 {
11769 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11770
11771 if (player)
11772 {
11773 player.MessageImportant(text);
11774 }
11775 }
11776
11778 {
11779 return true;
11780 }
11781
11782
11783 override bool KindOf(
string tag)
11784 {
11785 bool found = false;
11786 string item_name = this.
GetType();
11788 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11789
11790 int array_size = item_tag_array.Count();
11791 for (int i = 0; i < array_size; i++)
11792 {
11793 if (item_tag_array.Get(i) == tag)
11794 {
11795 found = true;
11796 break;
11797 }
11798 }
11799 return found;
11800 }
11801
11802
11804 {
11805
11806 super.OnRPC(sender, rpc_type,ctx);
11807
11808
11809 switch (rpc_type)
11810 {
11811 #ifndef SERVER
11812 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11813 Param2<bool, string> p = new Param2<bool, string>(false, "");
11814
11816 return;
11817
11818 bool play = p.param1;
11819 string soundSet = p.param2;
11820
11821 if (play)
11822 {
11824 {
11826 {
11828 }
11829 }
11830 else
11831 {
11833 }
11834 }
11835 else
11836 {
11838 }
11839
11840 break;
11841 #endif
11842
11843 }
11844
11846 {
11848 }
11849 }
11850
11851
11852
11853
11855 {
11856 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11857 return plugin.GetID(
name);
11858 }
11859
11861 {
11862 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11863 return plugin.GetName(id);
11864 }
11865
11868 {
11869
11870
11871 int varFlags;
11872 if (!ctx.
Read(varFlags))
11873 return;
11874
11875 if (varFlags & ItemVariableFlags.FLOAT)
11876 {
11878 }
11879 }
11880
11882 {
11883
11884 super.SerializeNumericalVars(floats_out);
11885
11886
11887
11889 {
11891 }
11892
11894 {
11896 }
11897
11899 {
11901 }
11902
11904 {
11909 }
11910
11912 {
11914 }
11915 }
11916
11918 {
11919
11920 super.DeSerializeNumericalVars(floats);
11921
11922
11923 int index = 0;
11924 int mask = Math.Round(floats.Get(index));
11925
11926 index++;
11927
11929 {
11931 {
11933 }
11934 else
11935 {
11936 float quantity = floats.Get(index);
11937 SetQuantity(quantity,
true,
false,
false,
false);
11938 }
11939 index++;
11940 }
11941
11943 {
11944 float wet = floats.Get(index);
11946 index++;
11947 }
11948
11950 {
11951 int liquidtype = Math.Round(floats.Get(index));
11953 index++;
11954 }
11955
11957 {
11959 index++;
11961 index++;
11963 index++;
11965 index++;
11966 }
11967
11969 {
11970 int cleanness = Math.Round(floats.Get(index));
11972 index++;
11973 }
11974 }
11975
11977 {
11978 super.WriteVarsToCTX(ctx);
11979
11980
11982 {
11984 }
11985
11987 {
11989 }
11990
11992 {
11994 }
11995
11997 {
11998 int r,g,b,a;
12004 }
12005
12007 {
12009 }
12010 }
12011
12013 {
12014 if (!super.ReadVarsFromCTX(ctx,version))
12015 return false;
12016
12017 int intValue;
12018 float value;
12019
12020 if (version < 140)
12021 {
12022 if (!ctx.
Read(intValue))
12023 return false;
12024
12025 m_VariablesMask = intValue;
12026 }
12027
12029 {
12030 if (!ctx.
Read(value))
12031 return false;
12032
12034 {
12036 }
12037 else
12038 {
12040 }
12041 }
12042
12043 if (version < 140)
12044 {
12046 {
12047 if (!ctx.
Read(value))
12048 return false;
12049 SetTemperatureDirect(value);
12050 }
12051 }
12052
12054 {
12055 if (!ctx.
Read(value))
12056 return false;
12058 }
12059
12061 {
12062 if (!ctx.
Read(intValue))
12063 return false;
12065 }
12066
12068 {
12069 int r,g,b,a;
12071 return false;
12073 return false;
12075 return false;
12077 return false;
12078
12080 }
12081
12083 {
12084 if (!ctx.
Read(intValue))
12085 return false;
12087 }
12088
12089 if (version >= 138 && version < 140)
12090 {
12092 {
12093 if (!ctx.
Read(intValue))
12094 return false;
12095 SetFrozen(intValue);
12096 }
12097 }
12098
12099 return true;
12100 }
12101
12102
12104 {
12107 {
12109 }
12110
12111 if (!super.OnStoreLoad(ctx, version))
12112 {
12114 return false;
12115 }
12116
12117 if (version >= 114)
12118 {
12119 bool hasQuickBarIndexSaved;
12120
12121 if (!ctx.
Read(hasQuickBarIndexSaved))
12122 {
12124 return false;
12125 }
12126
12127 if (hasQuickBarIndexSaved)
12128 {
12129 int itmQBIndex;
12130
12131
12132 if (!ctx.
Read(itmQBIndex))
12133 {
12135 return false;
12136 }
12137
12138 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12139 if (itmQBIndex != -1 && parentPlayer)
12140 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12141 }
12142 }
12143 else
12144 {
12145
12146 PlayerBase player;
12147 int itemQBIndex;
12148 if (version ==
int.
MAX)
12149 {
12150 if (!ctx.
Read(itemQBIndex))
12151 {
12153 return false;
12154 }
12155 }
12156 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12157 {
12158
12159 if (!ctx.
Read(itemQBIndex))
12160 {
12162 return false;
12163 }
12164 if (itemQBIndex != -1 && player)
12165 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12166 }
12167 }
12168
12169 if (version < 140)
12170 {
12171
12172 if (!LoadVariables(ctx, version))
12173 {
12175 return false;
12176 }
12177 }
12178
12179
12181 {
12183 return false;
12184 }
12185 if (version >= 132)
12186 {
12188 if (raib)
12189 {
12191 {
12193 return false;
12194 }
12195 }
12196 }
12197
12199 return true;
12200 }
12201
12202
12203
12205 {
12206 super.OnStoreSave(ctx);
12207
12208 PlayerBase player;
12209 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12210 {
12212
12213 int itemQBIndex = -1;
12214 itemQBIndex = player.FindQuickBarEntityIndex(this);
12215 ctx.
Write(itemQBIndex);
12216 }
12217 else
12218 {
12220 }
12221
12223
12225 if (raib)
12226 {
12228 }
12229 }
12230
12231
12233 {
12234 super.AfterStoreLoad();
12235
12237 {
12239 }
12240
12242 {
12245 }
12246 }
12247
12249 {
12250 super.EEOnAfterLoad();
12251
12253 {
12255 }
12256
12259 }
12260
12262 {
12263 return false;
12264 }
12265
12266
12267
12269 {
12271 {
12272 #ifdef PLATFORM_CONSOLE
12273
12275 {
12277 if (menu)
12278 {
12280 }
12281 }
12282 #endif
12283 }
12284
12286 {
12289 }
12290
12292 {
12293 SetWeightDirty();
12295 }
12297 {
12300 }
12301
12303 {
12306
12309 }
12311 {
12315 }
12316
12317 super.OnVariablesSynchronized();
12318 }
12319
12320
12321
12323 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12324 {
12325 if (!IsServerCheck(allow_client))
12326 return false;
12327
12329 return false;
12330
12333
12334 if (value <= (min + 0.001))
12335 value = min;
12336
12337 if (value == min)
12338 {
12339 if (destroy_config)
12340 {
12341 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12342 if (dstr)
12343 {
12345 this.Delete();
12346 return true;
12347 }
12348 }
12349 else if (destroy_forced)
12350 {
12352 this.Delete();
12353 return true;
12354 }
12355
12357 }
12358
12361
12363 {
12364 EntityAI parent = GetHierarchyRoot();
12365 InventoryLocation iLoc = new InventoryLocation();
12366 GetInventory().GetCurrentInventoryLocation(iLoc);
12368 {
12369 int iLocSlot = iLoc.
GetSlot();
12371 {
12373 }
12375 {
12377 }
12378 }
12379 }
12380
12382 {
12384
12385 if (delta)
12387 }
12388
12390
12391 return false;
12392 }
12393
12394
12396 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12397 {
12399 }
12400
12402 {
12405 }
12406
12408 {
12411 }
12412
12414 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12415 {
12416 float value_clamped = Math.Clamp(value, 0, 1);
12418 SetQuantity(result, destroy_config, destroy_forced);
12419 }
12420
12421
12424 {
12426 }
12427
12429 {
12431 }
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12443 {
12444 int slot = -1;
12445 GameInventory inventory = GetInventory();
12446 if (inventory)
12447 {
12448 InventoryLocation il = new InventoryLocation;
12451 }
12452
12454 }
12455
12457 {
12458 float quantity_max = 0;
12459
12461 {
12462 if (attSlotID != -1)
12463 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12464
12465 if (quantity_max <= 0)
12467 }
12468
12469 if (quantity_max <= 0)
12471
12472 return quantity_max;
12473 }
12474
12476 {
12478 }
12479
12481 {
12483 }
12484
12485
12487 {
12489 }
12490
12492 {
12494 }
12495
12497 {
12499 }
12500
12501
12503 {
12504
12505 float weightEx = GetWeightEx();
12506 float special = GetInventoryAndCargoWeight();
12507 return weightEx - special;
12508 }
12509
12510
12512 {
12514 }
12515
12517 {
12519 {
12520 #ifdef DEVELOPER
12521 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12522 {
12523 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12525 }
12526 #endif
12527
12528 return GetQuantity() * GetConfigWeightModified();
12529 }
12530 else if (HasEnergyManager())
12531 {
12532 #ifdef DEVELOPER
12533 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12534 {
12535 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12536 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12537 }
12538 #endif
12539 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12540 }
12541 else
12542 {
12543 #ifdef DEVELOPER
12544 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12545 {
12546 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12547 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12548 }
12549 #endif
12550 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12551 }
12552 }
12553
12556 {
12557 int item_count = 0;
12559
12560 GameInventory inventory = GetInventory();
12561 CargoBase cargo = inventory.
GetCargo();
12562 if (cargo != NULL)
12563 {
12565 }
12566
12568 for (int i = 0; i < nAttachments; ++i)
12569 {
12571 if (item)
12572 item_count += item.GetNumberOfItems();
12573 }
12574 return item_count;
12575 }
12576
12579 {
12580 float weight = 0;
12581 float wetness = 1;
12582 if (include_wetness)
12585 {
12586 weight = wetness * m_ConfigWeight;
12587 }
12589 {
12590 weight = 1;
12591 }
12592 return weight;
12593 }
12594
12595
12596
12598 {
12599 GameInventory inventory = GetInventory();
12600 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12601 {
12602 array<EntityAI> items = new array<EntityAI>;
12604 for (int i = 0; i < items.Count(); ++i)
12605 {
12607 if (item)
12608 {
12609 g_Game.ObjectDelete(item);
12610 }
12611 }
12612 }
12613 }
12614
12615
12616
12617
12619 {
12620 float energy = 0;
12621 if (HasEnergyManager())
12622 {
12623 energy = GetCompEM().GetEnergy();
12624 }
12625 return energy;
12626 }
12627
12628
12630 {
12631 super.OnEnergyConsumed();
12632
12634 }
12635
12637 {
12638 super.OnEnergyAdded();
12639
12641 }
12642
12643
12645 {
12646 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12647 {
12649 {
12650 float energy_0to1 = GetCompEM().GetEnergy0To1();
12652 }
12653 }
12654 }
12655
12656
12658 {
12659 return ConfigGetFloat("heatIsolation");
12660 }
12661
12663 {
12665 }
12666
12668 {
12669 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12670 if (
g_Game.ConfigIsExisting(paramPath))
12671 return g_Game.ConfigGetFloat(paramPath);
12672
12673 return 0.0;
12674 }
12675
12677 {
12678 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12679 if (
g_Game.ConfigIsExisting(paramPath))
12680 return g_Game.ConfigGetFloat(paramPath);
12681
12682 return 0.0;
12683 }
12684
12685 override void SetWet(
float value,
bool allow_client =
false)
12686 {
12687 if (!IsServerCheck(allow_client))
12688 return;
12689
12692
12694
12695 m_VarWet = Math.Clamp(value, min, max);
12696
12698 {
12701 }
12702 }
12703
12704 override void AddWet(
float value)
12705 {
12707 }
12708
12710 {
12712 }
12713
12715 {
12717 }
12718
12720 {
12722 }
12723
12725 {
12727 }
12728
12730 {
12732 }
12733
12734 override void OnWetChanged(
float newVal,
float oldVal)
12735 {
12738 if (newLevel != oldLevel)
12739 {
12741 }
12742 }
12743
12745 {
12746 SetWeightDirty();
12747 }
12748
12750 {
12751 return GetWetLevelInternal(
m_VarWet);
12752 }
12753
12754
12755
12757 {
12759 }
12760
12762 {
12764 }
12765
12767 {
12769 }
12770
12772 {
12774 }
12775
12776
12777
12779 {
12780 if (ConfigIsExisting("itemModelLength"))
12781 {
12782 return ConfigGetFloat("itemModelLength");
12783 }
12784 return 0;
12785 }
12786
12788 {
12789 if (ConfigIsExisting("itemAttachOffset"))
12790 {
12791 return ConfigGetFloat("itemAttachOffset");
12792 }
12793 return 0;
12794 }
12795
12796 override void SetCleanness(
int value,
bool allow_client =
false)
12797 {
12798 if (!IsServerCheck(allow_client))
12799 return;
12800
12802
12804
12807 }
12808
12810 {
12812 }
12813
12815 {
12816 return true;
12817 }
12818
12819
12820
12821
12823 {
12825 }
12826
12828 {
12830 }
12831
12832
12833
12834
12835 override void SetColor(
int r,
int g,
int b,
int a)
12836 {
12842 }
12844 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12845 {
12850 }
12851
12853 {
12855 }
12856
12859 {
12860 int r,g,b,a;
12862 r = r/255;
12863 g = g/255;
12864 b = b/255;
12865 a = a/255;
12866 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12867 }
12868
12869
12870
12871 override void SetLiquidType(
int value,
bool allow_client =
false)
12872 {
12873 if (!IsServerCheck(allow_client))
12874 return;
12875
12880 }
12881
12883 {
12884 return ConfigGetInt("varLiquidTypeInit");
12885 }
12886
12888 {
12890 }
12891
12893 {
12895 SetFrozen(false);
12896 }
12897
12900 {
12901 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12902 }
12903
12904
12907 {
12908 PlayerBase nplayer;
12909 if (PlayerBase.CastTo(nplayer, player))
12910 {
12912 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12913 }
12914 }
12915
12916
12919 {
12920 PlayerBase nplayer;
12921 if (PlayerBase.CastTo(nplayer,player))
12922 {
12923 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12924 }
12925
12926 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12927
12928 if (HasEnergyManager())
12929 {
12930 GetCompEM().UpdatePlugState();
12931 }
12932 }
12933
12934
12936 {
12937 super.OnPlacementStarted(player);
12938
12940 }
12941
12942 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12943 {
12945 {
12946 m_AdminLog.OnPlacementComplete(player,
this);
12947 }
12948
12949 super.OnPlacementComplete(player, position, orientation);
12950 }
12951
12952
12953
12954
12955
12957 {
12959 {
12960 return true;
12961 }
12962 else
12963 {
12964 return false;
12965 }
12966 }
12967
12968
12970 {
12972 {
12974 }
12975 }
12976
12977
12979 {
12981 }
12982
12984 {
12986 }
12987
12988 override void InsertAgent(
int agent,
float count = 1)
12989 {
12990 if (count < 1)
12991 return;
12992
12994 }
12995
12998 {
13000 }
13001
13002
13004 {
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
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13050 {
13052 return false;
13053 return true;
13054 }
13055
13057 {
13058
13060 }
13061
13062
13065 {
13066 super.CheckForRoofLimited(timeTresholdMS);
13067
13068 float time =
g_Game.GetTime();
13069 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13070 {
13071 m_PreviousRoofTestTime = time;
13072 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13073 }
13074 }
13075
13076
13078 {
13080 {
13081 return 0;
13082 }
13083
13084 if (GetInventory().GetAttachmentSlotsCount() != 0)
13085 {
13086 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13087 if (filter)
13088 return filter.GetProtectionLevel(type, false, system);
13089 else
13090 return 0;
13091 }
13092
13093 string subclassPath, entryName;
13094
13095 switch (type)
13096 {
13098 entryName = "biological";
13099 break;
13101 entryName = "chemical";
13102 break;
13103 default:
13104 entryName = "biological";
13105 break;
13106 }
13107
13108 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13109
13110 return g_Game.ConfigGetFloat(subclassPath + entryName);
13111 }
13112
13113
13114
13117 {
13118 if (!IsMagazine())
13120
13122 }
13123
13124
13125
13126
13127
13132 {
13133 return true;
13134 }
13135
13137 {
13139 }
13140
13141
13142
13143
13144
13146 {
13147 if (parent)
13148 {
13149 if (parent.IsInherited(DayZInfected))
13150 return true;
13151
13152 if (!parent.IsRuined())
13153 return true;
13154 }
13155
13156 return true;
13157 }
13158
13160 {
13161 if (!super.CanPutAsAttachment(parent))
13162 {
13163 return false;
13164 }
13165
13166 if (!IsRuined() && !parent.IsRuined())
13167 {
13168 return true;
13169 }
13170
13171 return false;
13172 }
13173
13175 {
13176
13177
13178
13179
13180 return super.CanReceiveItemIntoCargo(item);
13181 }
13182
13184 {
13185
13186
13187
13188
13189 GameInventory attachmentInv = attachment.GetInventory();
13191 {
13192 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13193 return false;
13194 }
13195
13196 InventoryLocation loc = new InventoryLocation();
13197 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13198 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13199 return false;
13200
13201 return super.CanReceiveAttachment(attachment, slotId);
13202 }
13203
13205 {
13206 if (!super.CanReleaseAttachment(attachment))
13207 return false;
13208
13209 return GetInventory().AreChildrenAccessible();
13210 }
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13233 {
13234 int id = muzzle_owner.GetMuzzleID();
13235 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13236
13237 if (WPOF_array)
13238 {
13239 for (int i = 0; i < WPOF_array.Count(); i++)
13240 {
13241 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13242
13243 if (WPOF)
13244 {
13245 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13246 }
13247 }
13248 }
13249 }
13250
13251
13253 {
13254 int id = muzzle_owner.GetMuzzleID();
13256
13257 if (WPOBE_array)
13258 {
13259 for (int i = 0; i < WPOBE_array.Count(); i++)
13260 {
13261 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13262
13263 if (WPOBE)
13264 {
13265 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13266 }
13267 }
13268 }
13269 }
13270
13271
13273 {
13274 int id = muzzle_owner.GetMuzzleID();
13275 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13276
13277 if (WPOOH_array)
13278 {
13279 for (int i = 0; i < WPOOH_array.Count(); i++)
13280 {
13281 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13282
13283 if (WPOOH)
13284 {
13285 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13286 }
13287 }
13288 }
13289 }
13290
13291
13293 {
13294 int id = muzzle_owner.GetMuzzleID();
13295 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13296
13297 if (WPOOH_array)
13298 {
13299 for (int i = 0; i < WPOOH_array.Count(); i++)
13300 {
13301 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13302
13303 if (WPOOH)
13304 {
13305 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13306 }
13307 }
13308 }
13309 }
13310
13311
13313 {
13314 int id = muzzle_owner.GetMuzzleID();
13315 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13316
13317 if (WPOOH_array)
13318 {
13319 for (int i = 0; i < WPOOH_array.Count(); i++)
13320 {
13321 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13322
13323 if (WPOOH)
13324 {
13325 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13326 }
13327 }
13328 }
13329 }
13330
13331
13332
13334 {
13336 {
13337 return true;
13338 }
13339
13340 return false;
13341 }
13342
13344 {
13346 {
13347 return true;
13348 }
13349
13350 return false;
13351 }
13352
13354 {
13356 {
13357 return true;
13358 }
13359
13360 return false;
13361 }
13362
13364 {
13365 return false;
13366 }
13367
13370 {
13371 return UATimeSpent.DEFAULT_DEPLOY;
13372 }
13373
13374
13375
13376
13378 {
13380 SetSynchDirty();
13381 }
13382
13384 {
13386 }
13387
13388
13390 {
13391 return false;
13392 }
13393
13396 {
13397 string att_type = "None";
13398
13399 if (ConfigIsExisting("soundAttType"))
13400 {
13401 att_type = ConfigGetString("soundAttType");
13402 }
13403
13405 }
13406
13408 {
13410 }
13411
13412
13413
13414
13415
13421
13423 {
13426
13428 }
13429
13430
13432 {
13434 return;
13435
13437
13440
13443
13444 SoundParameters params = new SoundParameters();
13448 }
13449
13450
13452 {
13454 {
13457
13458 SetSynchDirty();
13459
13462 }
13463 }
13464
13466 {
13468 }
13469
13470
13472 {
13474 return;
13475
13477 SetSynchDirty();
13478
13481 }
13482
13484 {
13487 }
13488
13490 {
13492 }
13493
13494 void OnApply(PlayerBase player);
13495
13497 {
13498 return 1.0;
13499 };
13500
13502 {
13504 }
13505
13507 {
13509 }
13510
13512
13514 {
13515 SetDynamicPhysicsLifeTime(0.01);
13517 }
13518
13520 {
13521 array<string> zone_names = new array<string>;
13522 GetDamageZones(zone_names);
13523 for (int i = 0; i < zone_names.Count(); i++)
13524 {
13525 SetHealthMax(zone_names.Get(i),"Health");
13526 }
13527 SetHealthMax("","Health");
13528 }
13529
13532 {
13533 float global_health = GetHealth01("","Health");
13534 array<string> zones = new array<string>;
13535 GetDamageZones(zones);
13536
13537 for (int i = 0; i < zones.Count(); i++)
13538 {
13539 SetHealth01(zones.Get(i),"Health",global_health);
13540 }
13541 }
13542
13545 {
13546 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13547 }
13548
13550 {
13551 if (!hasRootAsPlayer)
13552 {
13553 if (refParentIB)
13554 {
13555
13556 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13557 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13558
13559 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13560 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13561
13564 }
13565 else
13566 {
13567
13570 }
13571 }
13572 }
13573
13575 {
13577 {
13578 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13579 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13580 {
13581 float heatPermCoef = 1.0;
13583 while (ent)
13584 {
13585 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13586 ent = ent.GetHierarchyParent();
13587 }
13588
13589 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13590 }
13591 }
13592 }
13593
13595 {
13596
13597 EntityAI parent = GetHierarchyParent();
13598 if (!parent)
13599 {
13600 hasParent = false;
13601 hasRootAsPlayer = false;
13602 }
13603 else
13604 {
13605 hasParent = true;
13606 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13607 refParentIB =
ItemBase.Cast(parent);
13608 }
13609 }
13610
13611 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13612 {
13613
13614 }
13615
13617 {
13618
13619 return false;
13620 }
13621
13623 {
13624
13625
13626 return false;
13627 }
13628
13630 {
13631
13632 return false;
13633 }
13634
13637 {
13638 return !GetIsFrozen() &&
IsOpen();
13639 }
13640
13642 {
13643 bool hasParent = false, hasRootAsPlayer = false;
13645
13646 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13647 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13648
13649 if (wwtu || foodDecay)
13650 {
13654
13655 if (processWetness || processTemperature || processDecay)
13656 {
13658
13659 if (processWetness)
13660 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13661
13662 if (processTemperature)
13664
13665 if (processDecay)
13666 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13667 }
13668 }
13669 }
13670
13673 {
13675 }
13676
13678 {
13681
13682 return super.GetTemperatureFreezeThreshold();
13683 }
13684
13686 {
13689
13690 return super.GetTemperatureThawThreshold();
13691 }
13692
13694 {
13697
13698 return super.GetItemOverheatThreshold();
13699 }
13700
13702 {
13704 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13705
13706 return super.GetTemperatureFreezeTime();
13707 }
13708
13710 {
13712 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13713
13714 return super.GetTemperatureThawTime();
13715 }
13716
13721
13723 {
13724 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13725 }
13726
13728 {
13729 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13730 }
13731
13734 {
13736 }
13737
13739 {
13741 }
13742
13744 {
13746 }
13747
13750 {
13751 return null;
13752 }
13753
13756 {
13757 return false;
13758 }
13759
13761 {
13763 {
13766 if (!trg)
13767 {
13769 explosive = this;
13770 }
13771
13772 explosive.PairRemote(trg);
13774
13775 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13776 trg.SetPersistentPairID(persistentID);
13777 explosive.SetPersistentPairID(persistentID);
13778
13779 return true;
13780 }
13781 return false;
13782 }
13783
13786 {
13787 float ret = 1.0;
13790 ret *= GetHealth01();
13791
13792 return ret;
13793 }
13794
13795 #ifdef DEVELOPER
13796 override void SetDebugItem()
13797 {
13798 super.SetDebugItem();
13799 _itemBase = this;
13800 }
13801
13803 {
13804 string text = super.GetDebugText();
13805
13807 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13808
13809 return text;
13810 }
13811 #endif
13812
13814 {
13815 return true;
13816 }
13817
13819
13821
13823 {
13826 }
13827
13828
13836
13852
13853 [
Obsolete(
"Use ItemSoundHandler instead")]
13856 {
13857 if (!
g_Game.IsDedicatedServer())
13858 {
13859 if (ConfigIsExisting("attachSoundSet"))
13860 {
13861 string cfg_path = "";
13862 string soundset = "";
13863 string type_name =
GetType();
13864
13867 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13868 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13869
13870 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13871 {
13872 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13873 {
13874 if (cfg_slot_array[i] == slot_type)
13875 {
13876 soundset = cfg_soundset_array[i];
13877 break;
13878 }
13879 }
13880 }
13881
13882 if (soundset != "")
13883 {
13884 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13886 }
13887 }
13888 }
13889 }
13890
13892}
13893
13895{
13897 if (entity)
13898 {
13899 bool is_item = entity.IsInherited(
ItemBase);
13900 if (is_item && full_quantity)
13901 {
13904 }
13905 }
13906 else
13907 {
13909 return NULL;
13910 }
13911 return entity;
13912}
13913
13915{
13916 if (item)
13917 {
13918 if (health > 0)
13919 item.SetHealth("", "", health);
13920
13921 if (item.CanHaveTemperature())
13922 {
13924 if (item.CanFreeze())
13925 item.SetFrozen(false);
13926 }
13927
13928 if (item.HasEnergyManager())
13929 {
13930 if (quantity >= 0)
13931 {
13932 item.GetCompEM().SetEnergy0To1(quantity);
13933 }
13934 else
13935 {
13937 }
13938 }
13939 else if (item.IsMagazine())
13940 {
13941 Magazine mag = Magazine.Cast(item);
13942 if (quantity >= 0)
13943 {
13944 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13945 }
13946 else
13947 {
13949 }
13950
13951 }
13952 else
13953 {
13954 if (quantity >= 0)
13955 {
13956 item.SetQuantityNormalized(quantity, false);
13957 }
13958 else
13959 {
13961 }
13962
13963 }
13964 }
13965}
13966
13967#ifdef DEVELOPER
13969#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.