9095{
9097 {
9098 return true;
9099 }
9100};
9101
9103{
9104
9105};
9106
9107
9108
9110{
9114
9116
9119
9120
9121
9122
9123
9132
9138
9143
9148
9169 protected bool m_IsResultOfSplit
9170
9172
9177
9178
9179
9181
9185
9186
9187
9189
9192
9193
9194
9200
9201
9209
9212
9213
9215
9216
9218
9219
9224
9225
9230
9232
9233
9235
9236
9238 {
9243
9244 if (!
g_Game.IsDedicatedServer())
9245 {
9247 {
9249
9251 {
9253 }
9254 }
9255
9258 }
9259
9260 m_OldLocation = null;
9261
9263 {
9265 }
9266
9267 if (ConfigIsExisting("headSelectionsToHide"))
9268 {
9271 }
9272
9274 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9275 {
9277 }
9278
9280
9281 m_IsResultOfSplit = false;
9282
9284 }
9285
9287 {
9288 super.InitItemVariables();
9289
9295 m_Count = ConfigGetInt(
"count");
9296
9299
9304
9307
9312
9324
9328
9329
9332 if (ConfigIsExisting("canBeSplit"))
9333 {
9336 }
9337
9339 if (ConfigIsExisting("itemBehaviour"))
9341
9342
9345 RegisterNetSyncVariableInt("m_VarLiquidType");
9346 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9347
9348 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9349 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9350 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9351
9352 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9353 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9354 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9355 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9356
9357 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9358 RegisterNetSyncVariableBool("m_IsTakeable");
9359 RegisterNetSyncVariableBool("m_IsHologram");
9360
9363 {
9366 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9367 }
9368
9370
9372 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9374
9376 }
9377
9379 {
9381 }
9382
9384 {
9387 {
9392 }
9393 }
9394
9395 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9396 {
9398 {
9401 }
9402
9404 }
9405
9407 {
9413 }
9414
9416
9418 {
9420
9421 if (!action)
9422 {
9423 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9424 return;
9425 }
9426
9428 if (!ai)
9429 {
9431 return;
9432 }
9433
9435 if (!action_array)
9436 {
9437 action_array = new array<ActionBase_Basic>;
9439 }
9440 if (LogManager.IsActionLogEnable())
9441 {
9442 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9443 }
9444
9445 if (action_array.Find(action) != -1)
9446 {
9447 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9448 }
9449 else
9450 {
9451 action_array.Insert(action);
9452 }
9453 }
9454
9456 {
9457 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9458 ActionBase action = player.GetActionManager().GetAction(actionName);
9461
9462 if (action_array)
9463 {
9464 action_array.RemoveItem(action);
9465 }
9466 }
9467
9468
9469
9471 {
9472 ActionOverrideData overrideData = new ActionOverrideData();
9476
9478 if (!actionMap)
9479 {
9482 }
9483
9484 actionMap.Insert(this.
Type(), overrideData);
9485
9486 }
9487
9489
9491
9492
9494 {
9497
9500
9501 string config_to_search = "CfgVehicles";
9502 string muzzle_owner_config;
9503
9505 {
9506 if (IsInherited(Weapon))
9507 config_to_search = "CfgWeapons";
9508
9509 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9510
9511 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9512
9513 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9514
9515 if (config_OnFire_subclass_count > 0)
9516 {
9517 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9518
9519 for (int i = 0; i < config_OnFire_subclass_count; i++)
9520 {
9521 string particle_class = "";
9522 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9523 string config_OnFire_entry = config_OnFire_class + particle_class;
9524 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9525 WPOF_array.Insert(WPOF);
9526 }
9527
9528
9530 }
9531 }
9532
9534 {
9535 config_to_search = "CfgWeapons";
9536 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9537
9538 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9539
9540 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9541
9542 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9543 {
9544 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9545
9546 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9547 {
9548 string particle_class2 = "";
9549 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9550 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9551 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9552 WPOBE_array.Insert(WPOBE);
9553 }
9554
9555
9557 }
9558 }
9559 }
9560
9561
9563 {
9566
9568 {
9569 string config_to_search = "CfgVehicles";
9570
9571 if (IsInherited(Weapon))
9572 config_to_search = "CfgWeapons";
9573
9574 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9575 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9576
9577 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9578 {
9579
9581
9583 {
9585 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9587 return;
9588 }
9589
9592
9593
9594
9595 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9596 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9597
9598 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9599 {
9600 string particle_class = "";
9601 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9602 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9603 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9604
9605 if (entry_type == CT_CLASS)
9606 {
9607 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9608 WPOOH_array.Insert(WPOF);
9609 }
9610 }
9611
9612
9614 }
9615 }
9616 }
9617
9619 {
9621 }
9622
9624 {
9626 {
9628
9631
9634
9635 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9636 }
9637 }
9638
9640 {
9642 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9643
9645 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9646
9648 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9649
9651 {
9653 }
9654 }
9655
9657 {
9659 }
9660
9662 {
9665 else
9667
9669 {
9672 }
9673 else
9674 {
9677
9680 }
9681
9683 }
9684
9686 {
9688 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9689 }
9690
9692 {
9694 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9696 }
9697
9699 {
9701 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9702 }
9703
9705 {
9708
9709 OverheatingParticle OP = new OverheatingParticle();
9714
9716 }
9717
9719 {
9722
9723 return -1;
9724 }
9725
9727 {
9729 {
9732
9733 for (int i = count; i > 0; --i)
9734 {
9735 int id = i - 1;
9738
9741
9742 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9743 {
9744 if (p)
9745 {
9748 }
9749 }
9750 }
9751 }
9752 }
9753
9755 {
9757 {
9759 {
9760 int id = i - 1;
9762
9763 if (OP)
9764 {
9766
9767 if (p)
9768 {
9770 }
9771
9772 delete OP;
9773 }
9774 }
9775
9778 }
9779 }
9780
9783 {
9784 return 0.0;
9785 }
9786
9787
9789 {
9790 return 250;
9791 }
9792
9794 {
9795 return 0;
9796 }
9797
9800 {
9802 return true;
9803
9804 return false;
9805 }
9806
9809 {
9812
9814 {
9816 }
9817 else
9818 {
9819
9821 }
9822
9824 }
9825
9832 {
9833 return -1;
9834 }
9835
9836
9837
9838
9840 {
9842 {
9843 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9844 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9845
9846 if (r_index >= 0)
9847 {
9848 InventoryLocation r_il = new InventoryLocation;
9849 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9850
9851 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9854 {
9855 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9856 }
9858 {
9859 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9860 }
9861
9862 }
9863
9864 player.GetHumanInventory().ClearUserReservedLocation(this);
9865 }
9866
9869 }
9870
9871
9872
9873
9875 {
9876 return ItemBase.m_DebugActionsMask;
9877 }
9878
9880 {
9881 return ItemBase.m_DebugActionsMask & mask;
9882 }
9883
9885 {
9886 ItemBase.m_DebugActionsMask = mask;
9887 }
9888
9890 {
9891 ItemBase.m_DebugActionsMask |= mask;
9892 }
9893
9895 {
9896 ItemBase.m_DebugActionsMask &= ~mask;
9897 }
9898
9900 {
9902 {
9904 }
9905 else
9906 {
9908 }
9909 }
9910
9911
9913 {
9914 if (GetEconomyProfile())
9915 {
9916 float q_max = GetEconomyProfile().GetQuantityMax();
9917 if (q_max > 0)
9918 {
9919 float q_min = GetEconomyProfile().GetQuantityMin();
9920 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9921
9923 {
9924 ComponentEnergyManager comp = GetCompEM();
9926 {
9928 }
9929 }
9931 {
9933
9934 }
9935
9936 }
9937 }
9938 }
9939
9942 {
9943 EntityAI parent = GetHierarchyParent();
9944
9945 if (parent)
9946 {
9947 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9948 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9949 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9950 }
9951 }
9952
9955 {
9956 EntityAI parent = GetHierarchyParent();
9957
9958 if (parent)
9959 {
9960 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9961 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9962 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9963 }
9964 }
9965
9967 {
9968
9969
9970
9971
9973
9975 {
9976 if (ScriptInputUserData.CanStoreInputUserData())
9977 {
9978 ScriptInputUserData ctx = new ScriptInputUserData;
9984 ctx.
Write(use_stack_max);
9987
9989 {
9990 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9991 }
9992 }
9993 }
9994 else if (!
g_Game.IsMultiplayer())
9995 {
9997 }
9998 }
9999
10001 {
10003 }
10004
10006 {
10008 }
10009
10011 {
10013 }
10014
10016 {
10017
10018 return false;
10019 }
10020
10022 {
10023 return false;
10024 }
10025
10029 {
10030 return false;
10031 }
10032
10034 {
10035 return "";
10036 }
10037
10039
10041 {
10042 return false;
10043 }
10044
10046 {
10047 return true;
10048 }
10049
10050
10051
10053 {
10054 return true;
10055 }
10056
10058 {
10059 return true;
10060 }
10061
10063 {
10064 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10066 }
10067
10069 {
10071 }
10072
10074 {
10076 if (!is_being_placed)
10078 SetSynchDirty();
10079 }
10080
10081
10083
10085 {
10087 }
10088
10090 {
10092 }
10093
10095 {
10096 return 1;
10097 }
10098
10100 {
10101 return false;
10102 }
10103
10105 {
10107 SetSynchDirty();
10108 }
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10145 {
10146 super.OnMovedInsideCargo(container);
10147
10148 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10149 }
10150
10151 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10152 {
10153 super.EEItemLocationChanged(oldLoc, newLoc);
10154
10155 PlayerBase newPlayer = null;
10156 PlayerBase oldPlayer = null;
10157
10158 if (newLoc.GetParent())
10159 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10160
10161 if (oldLoc.GetParent())
10162 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10163
10165 {
10166 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10167
10168 if (rIndex >= 0)
10169 {
10170 InventoryLocation rIl = new InventoryLocation;
10171 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10172
10173 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10176 {
10177 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10178 }
10180 {
10182 }
10183
10184 }
10185 }
10186
10188 {
10189 if (newPlayer)
10190 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10191
10192 if (newPlayer == oldPlayer)
10193 {
10194 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10195 {
10197 {
10198 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10199 {
10200 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10201 }
10202 }
10203 else
10204 {
10205 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10206 }
10207 }
10208
10209 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10210 {
10211 int type = oldLoc.GetType();
10213 {
10214 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10215 }
10217 {
10218 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10219 }
10220 }
10221 if (!m_OldLocation)
10222 {
10223 m_OldLocation = new InventoryLocation;
10224 }
10225 m_OldLocation.Copy(oldLoc);
10226 }
10227 else
10228 {
10229 if (m_OldLocation)
10230 {
10231 m_OldLocation.Reset();
10232 }
10233 }
10234
10235 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10236 }
10237 else
10238 {
10239 if (newPlayer)
10240 {
10241 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10242 if (resIndex >= 0)
10243 {
10244 InventoryLocation il = new InventoryLocation;
10245 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10247 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10250 {
10251 il.
GetParent().GetOnReleaseLock().Invoke(it);
10252 }
10254 {
10256 }
10257
10258 }
10259 }
10261 {
10262
10264 }
10265
10266 if (m_OldLocation)
10267 {
10268 m_OldLocation.Reset();
10269 }
10270 }
10271
10273 {
10274 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10275 }
10276
10278 {
10279 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10280 }
10281 }
10282
10283 override void EOnContact(IEntity other, Contact extra)
10284 {
10286 {
10287 int liquidType = -1;
10289 if (impactSpeed > 0.0)
10290 {
10292 #ifndef SERVER
10294 #else
10296 SetSynchDirty();
10297 #endif
10299 }
10300 }
10301
10302 #ifdef SERVER
10303 if (GetCompEM() && GetCompEM().IsPlugged())
10304 {
10305 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10306 GetCompEM().UnplugThis();
10307 }
10308 #endif
10309 }
10310
10312
10314 {
10316 }
10317
10319 {
10320
10321 }
10322
10324 {
10325 super.OnItemLocationChanged(old_owner, new_owner);
10326
10327 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10328 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10329
10330 if (!relatedPlayer && playerNew)
10331 relatedPlayer = playerNew;
10332
10333 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10334 {
10336 if (actionMgr)
10337 {
10338 ActionBase currentAction = actionMgr.GetRunningAction();
10339 if (currentAction)
10341 }
10342 }
10343
10344 Man ownerPlayerOld = null;
10345 Man ownerPlayerNew = null;
10346
10347 if (old_owner)
10348 {
10349 if (old_owner.
IsMan())
10350 {
10351 ownerPlayerOld = Man.Cast(old_owner);
10352 }
10353 else
10354 {
10355 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10356 }
10357 }
10358 else
10359 {
10361 {
10363
10364 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10365 {
10366 GetCompEM().UnplugThis();
10367 }
10368 }
10369 }
10370
10371 if (new_owner)
10372 {
10373 if (new_owner.
IsMan())
10374 {
10375 ownerPlayerNew = Man.Cast(new_owner);
10376 }
10377 else
10378 {
10379 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10380 }
10381 }
10382
10383 if (ownerPlayerOld != ownerPlayerNew)
10384 {
10385 if (ownerPlayerOld)
10386 {
10387 array<EntityAI> subItemsExit = new array<EntityAI>;
10389 for (int i = 0; i < subItemsExit.Count(); i++)
10390 {
10393 }
10394 }
10395
10396 if (ownerPlayerNew)
10397 {
10398 array<EntityAI> subItemsEnter = new array<EntityAI>;
10400 for (int j = 0; j < subItemsEnter.Count(); j++)
10401 {
10404 }
10405 }
10406 }
10407 else if (ownerPlayerNew != null)
10408 {
10409 PlayerBase nplayer;
10410 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10411 {
10412 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10414 for (int k = 0; k < subItemsUpdate.Count(); k++)
10415 {
10417 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10418 }
10419 }
10420 }
10421
10422 if (old_owner)
10423 old_owner.OnChildItemRemoved(this);
10424 if (new_owner)
10425 new_owner.OnChildItemReceived(this);
10426 }
10427
10428
10430 {
10431 super.EEDelete(parent);
10432 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10433 if (player)
10434 {
10436
10437 if (player.IsAlive())
10438 {
10439 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10440 if (r_index >= 0)
10441 {
10442 InventoryLocation r_il = new InventoryLocation;
10443 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10444
10445 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10448 {
10449 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10450 }
10452 {
10453 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10454 }
10455
10456 }
10457
10458 player.RemoveQuickBarEntityShortcut(this);
10459 }
10460 }
10461 }
10462
10464 {
10465 super.EEKilled(killer);
10466
10469 {
10470 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10471 {
10472 if (IsMagazine())
10473 {
10474 if (Magazine.Cast(this).GetAmmoCount() > 0)
10475 {
10477 }
10478 }
10479 else
10480 {
10482 }
10483 }
10484 }
10485 }
10486
10488 {
10489 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10490
10491 super.OnWasAttached(parent, slot_id);
10492
10495
10498 }
10499
10501 {
10502 super.OnWasDetached(parent, slot_id);
10503
10506
10509 }
10510
10512 {
10513 int idx;
10516
10517 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10518 if (inventory_slots.Count() < 1)
10519 {
10520 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10521 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10522 }
10523 else
10524 {
10525 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10526 }
10527
10528 idx = inventory_slots.Find(slot);
10529 if (idx < 0)
10530 return "";
10531
10532 return attach_types.Get(idx);
10533 }
10534
10536 {
10537 int idx = -1;
10538 string slot;
10539
10542
10543 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10544 if (inventory_slots.Count() < 1)
10545 {
10546 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10547 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10548 }
10549 else
10550 {
10551 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10552 if (detach_types.Count() < 1)
10553 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10554 }
10555
10556 for (int i = 0; i < inventory_slots.Count(); i++)
10557 {
10558 slot = inventory_slots.Get(i);
10559 }
10560
10561 if (slot != "")
10562 {
10563 if (detach_types.Count() == 1)
10564 idx = 0;
10565 else
10566 idx = inventory_slots.Find(slot);
10567 }
10568 if (idx < 0)
10569 return "";
10570
10571 return detach_types.Get(idx);
10572 }
10573
10575 {
10576
10578
10579
10580 float min_time = 1;
10581 float max_time = 3;
10582 float delay = Math.RandomFloat(min_time, max_time);
10583
10584 explode_timer.Run(delay, this, "DoAmmoExplosion");
10585 }
10586
10588 {
10589 Magazine magazine = Magazine.Cast(this);
10590 int pop_sounds_count = 6;
10591 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10592
10593
10594 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10595 string sound_name = pop_sounds[ sound_idx ];
10596 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10597
10598
10599 magazine.ServerAddAmmoCount(-1);
10600
10601
10602 float min_temp_to_explode = 100;
10603
10604 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10605 {
10607 }
10608 }
10609
10610
10611 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10612 {
10613 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10614
10615 const int CHANCE_DAMAGE_CARGO = 4;
10616 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10617 const int CHANCE_DAMAGE_NOTHING = 2;
10618
10620 {
10621 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10622 int chances;
10623 int rnd;
10624
10625 if (GetInventory().GetCargo())
10626 {
10627 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10628 rnd = Math.RandomInt(0,chances);
10629
10630 if (rnd < CHANCE_DAMAGE_CARGO)
10631 {
10633 }
10634 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10635 {
10637 }
10638 }
10639 else
10640 {
10641 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10642 rnd = Math.RandomInt(0,chances);
10643
10644 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10645 {
10647 }
10648 }
10649 }
10650 }
10651
10653 {
10654 CargoBase cargo = GetInventory().GetCargo();
10655 if (cargo)
10656 {
10658 if (item_count > 0)
10659 {
10660 int random_pick = Math.RandomInt(0, item_count);
10662 if (!item.IsExplosive())
10663 {
10664 item.AddHealth("","",damage);
10665 return true;
10666 }
10667 }
10668 }
10669 return false;
10670 }
10671
10673 {
10674 GameInventory inventory = GetInventory();
10676 if (attachment_count > 0)
10677 {
10678 int random_pick = Math.RandomInt(0, attachment_count);
10680 if (!attachment.IsExplosive())
10681 {
10682 attachment.AddHealth("","",damage);
10683 return true;
10684 }
10685 }
10686 return false;
10687 }
10688
10690 {
10692 }
10693
10695 {
10697 return GetInventory().CanRemoveEntity();
10698
10699 return false;
10700 }
10701
10703 {
10704
10706 return false;
10707
10708
10710 return false;
10711
10712
10713
10715 if (delta == 0)
10716 return false;
10717
10718
10719 return true;
10720 }
10721
10723 {
10725 {
10726 if (ScriptInputUserData.CanStoreInputUserData())
10727 {
10728 ScriptInputUserData ctx = new ScriptInputUserData;
10733 ctx.
Write(destination_entity);
10735 ctx.
Write(slot_id);
10737 }
10738 }
10739 else if (!
g_Game.IsMultiplayer())
10740 {
10742 }
10743 }
10744
10746 {
10747 float split_quantity_new;
10751 InventoryLocation loc = new InventoryLocation;
10752
10753 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10754 {
10756 split_quantity_new = stack_max;
10757 else
10759
10761 {
10762 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10763 if (new_item)
10764 {
10765 new_item.SetResultOfSplit(true);
10766 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10768 new_item.
SetQuantity(split_quantity_new,
false,
true);
10769 }
10770 }
10771 }
10772 else if (destination_entity && slot_id == -1)
10773 {
10774 if (quantity > stack_max)
10775 split_quantity_new = stack_max;
10776 else
10777 split_quantity_new = quantity;
10778
10780 {
10781 GameInventory destinationInventory = destination_entity.GetInventory();
10783 {
10786 }
10787
10788 if (new_item)
10789 {
10790 new_item.SetResultOfSplit(true);
10791 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10793 new_item.
SetQuantity(split_quantity_new,
false,
true);
10794 }
10795 }
10796 }
10797 else
10798 {
10799 if (stack_max != 0)
10800 {
10802 {
10804 }
10805
10806 if (split_quantity_new == 0)
10807 {
10808 if (!
g_Game.IsMultiplayer())
10809 player.PhysicalPredictiveDropItem(this);
10810 else
10811 player.ServerDropEntity(this);
10812 return;
10813 }
10814
10816 {
10818
10819 if (new_item)
10820 {
10821 new_item.SetResultOfSplit(true);
10822 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10825 new_item.PlaceOnSurface();
10826 }
10827 }
10828 }
10829 }
10830 }
10831
10833 {
10834 float split_quantity_new;
10838 InventoryLocation loc = new InventoryLocation;
10839
10840 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10841 {
10843 split_quantity_new = stack_max;
10844 else
10846
10848 {
10849 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10850 if (new_item)
10851 {
10852 new_item.SetResultOfSplit(true);
10853 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10855 new_item.
SetQuantity(split_quantity_new,
false,
true);
10856 }
10857 }
10858 }
10859 else if (destination_entity && slot_id == -1)
10860 {
10861 if (quantity > stack_max)
10862 split_quantity_new = stack_max;
10863 else
10864 split_quantity_new = quantity;
10865
10867 {
10868 GameInventory destinationInventory = destination_entity.GetInventory();
10870 {
10873 }
10874
10875 if (new_item)
10876 {
10877 new_item.SetResultOfSplit(true);
10878 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10880 new_item.
SetQuantity(split_quantity_new,
false,
true);
10881 }
10882 }
10883 }
10884 else
10885 {
10886 if (stack_max != 0)
10887 {
10889 {
10891 }
10892
10894 {
10896
10897 if (new_item)
10898 {
10899 new_item.SetResultOfSplit(true);
10900 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10903 new_item.PlaceOnSurface();
10904 }
10905 }
10906 }
10907 }
10908 }
10909
10911 {
10913 {
10914 if (ScriptInputUserData.CanStoreInputUserData())
10915 {
10916 ScriptInputUserData ctx = new ScriptInputUserData;
10921 dst.WriteToContext(ctx);
10923 }
10924 }
10925 else if (!
g_Game.IsMultiplayer())
10926 {
10928 }
10929 }
10930
10932 {
10934 {
10935 if (ScriptInputUserData.CanStoreInputUserData())
10936 {
10937 ScriptInputUserData ctx = new ScriptInputUserData;
10942 ctx.
Write(destination_entity);
10948 }
10949 }
10950 else if (!
g_Game.IsMultiplayer())
10951 {
10953 }
10954 }
10955
10957 {
10959 }
10960
10962 {
10964 float split_quantity_new;
10966 if (dst.IsValid())
10967 {
10968 int slot_id = dst.GetSlot();
10970
10971 if (quantity > stack_max)
10972 split_quantity_new = stack_max;
10973 else
10974 split_quantity_new = quantity;
10975
10977 {
10979
10980 if (new_item)
10981 {
10982 new_item.SetResultOfSplit(true);
10983 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10985 new_item.
SetQuantity(split_quantity_new,
false,
true);
10986 }
10987
10988 return new_item;
10989 }
10990 }
10991
10992 return null;
10993 }
10994
10996 {
10998 float split_quantity_new;
11000 if (destination_entity)
11001 {
11003 if (quantity > stackable)
11004 split_quantity_new = stackable;
11005 else
11006 split_quantity_new = quantity;
11007
11009 {
11010 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11011 if (new_item)
11012 {
11013 new_item.SetResultOfSplit(true);
11014 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11016 new_item.
SetQuantity(split_quantity_new,
false,
true);
11017 }
11018 }
11019 }
11020 }
11021
11023 {
11025 {
11026 if (ScriptInputUserData.CanStoreInputUserData())
11027 {
11028 ScriptInputUserData ctx = new ScriptInputUserData;
11033 ItemBase destination_entity =
this;
11034 ctx.
Write(destination_entity);
11038 }
11039 }
11040 else if (!
g_Game.IsMultiplayer())
11041 {
11043 }
11044 }
11045
11047 {
11049 float split_quantity_new;
11051 if (player)
11052 {
11054 if (quantity > stackable)
11055 split_quantity_new = stackable;
11056 else
11057 split_quantity_new = quantity;
11058
11060 {
11061 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11062 new_item =
ItemBase.Cast(in_hands);
11063 if (new_item)
11064 {
11065 new_item.SetResultOfSplit(true);
11066 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11068 new_item.SetQuantity(split_quantity_new, false, true);
11069 }
11070 }
11071 }
11072 }
11073
11075 {
11077 float split_quantity_new = Math.Floor(quantity * 0.5);
11078
11080 return;
11081
11083
11084 if (new_item)
11085 {
11086 if (new_item.GetQuantityMax() < split_quantity_new)
11087 {
11088 split_quantity_new = new_item.GetQuantityMax();
11089 }
11090
11091 new_item.SetResultOfSplit(true);
11092 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11093
11095 {
11098 }
11099 else
11100 {
11102 new_item.
SetQuantity(split_quantity_new,
false,
true);
11103 }
11104 }
11105 }
11106
11108 {
11110 float split_quantity_new = Math.Floor(quantity / 2);
11111
11113 return;
11114
11115 InventoryLocation invloc = new InventoryLocation;
11117
11119 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11120
11121 if (new_item)
11122 {
11123 if (new_item.GetQuantityMax() < split_quantity_new)
11124 {
11125 split_quantity_new = new_item.GetQuantityMax();
11126 }
11128 {
11131 }
11132 else if (split_quantity_new > 1)
11133 {
11135 new_item.
SetQuantity(split_quantity_new,
false,
true);
11136 }
11137 }
11138 }
11139
11142 {
11143 SetWeightDirty();
11145
11146 if (parent)
11147 parent.OnAttachmentQuantityChangedEx(this, delta);
11148
11150 {
11152 {
11154 }
11156 {
11157 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11159 }
11160 }
11161 }
11162
11165 {
11166
11167 }
11168
11171 {
11173 }
11174
11176 {
11177 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11178
11180 {
11181 if (newLevel == GameConstants.STATE_RUINED)
11182 {
11184 EntityAI parent = GetHierarchyParent();
11185 if (parent && parent.IsFireplace())
11186 {
11187 CargoBase cargo = GetInventory().GetCargo();
11188 if (cargo)
11189 {
11191 {
11193 }
11194 }
11195 }
11196 }
11197
11199 {
11200
11202 return;
11203 }
11204
11205 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11206 {
11208 }
11209 }
11210 }
11211
11212
11214 {
11215 super.OnRightClick();
11216
11218 {
11220 {
11221 if (ScriptInputUserData.CanStoreInputUserData())
11222 {
11223 EntityAI root = GetHierarchyRoot();
11224 Man playerOwner = GetHierarchyRootPlayer();
11225 InventoryLocation dst = new InventoryLocation;
11226
11227
11228 if (!playerOwner && root && root == this)
11229 {
11231 }
11232 else
11233 {
11234
11235 GetInventory().GetCurrentInventoryLocation(dst);
11237 {
11238 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11240 {
11242 }
11243 else
11244 {
11246
11247
11248 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11249 {
11251 }
11252 else
11253 {
11254 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11255 }
11256 }
11257 }
11258 }
11259
11260 ScriptInputUserData ctx = new ScriptInputUserData;
11268 }
11269 }
11270 else if (!
g_Game.IsMultiplayer())
11271 {
11273 }
11274 }
11275 }
11276
11278 {
11279 if (root)
11280 {
11281 vector m4[4];
11282 root.GetTransform(m4);
11283 dst.SetGround(this, m4);
11284 }
11285 else
11286 {
11287 GetInventory().GetCurrentInventoryLocation(dst);
11288 }
11289 }
11290
11291 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11292 {
11293
11294 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11295 return false;
11296
11297 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11298 return false;
11299
11300
11302 return false;
11303
11304
11305 Magazine mag = Magazine.Cast(this);
11306 if (mag)
11307 {
11308 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11309 return false;
11310
11311 if (stack_max_limit)
11312 {
11313 Magazine other_mag = Magazine.Cast(other_item);
11314 if (other_item)
11315 {
11316 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11317 return false;
11318 }
11319
11320 }
11321 }
11322 else
11323 {
11324
11326 return false;
11327
11329 return false;
11330 }
11331
11332 PlayerBase player = null;
11333 if (CastTo(player, GetHierarchyRootPlayer()))
11334 {
11335 if (player.GetInventory().HasAttachment(this))
11336 return false;
11337
11338 if (player.IsItemsToDelete())
11339 return false;
11340 }
11341
11342 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11343 return false;
11344
11345 int slotID;
11347 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11348 return false;
11349
11350 return true;
11351 }
11352
11354 {
11356 }
11357
11359 {
11360 return m_IsResultOfSplit;
11361 }
11362
11364 {
11365 m_IsResultOfSplit = value;
11366 }
11367
11369 {
11371 }
11372
11374 {
11375 float other_item_quantity = other_item.GetQuantity();
11376 float this_free_space;
11377
11379
11381
11382 if (other_item_quantity > this_free_space)
11383 {
11384 return this_free_space;
11385 }
11386 else
11387 {
11388 return other_item_quantity;
11389 }
11390 }
11391
11393 {
11395 }
11396
11398 {
11400 return;
11401
11402 if (!IsMagazine() && other_item)
11403 {
11405 if (quantity_used != 0)
11406 {
11407 float hp1 = GetHealth01("","");
11408 float hp2 = other_item.GetHealth01("","");
11409 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11410 hpResult = hpResult / (
GetQuantity() + quantity_used);
11411
11412 hpResult *= GetMaxHealth();
11413 Math.Round(hpResult);
11414 SetHealth("", "Health", hpResult);
11415
11417 other_item.AddQuantity(-quantity_used);
11418 }
11419 }
11421 }
11422
11424 {
11425 #ifdef SERVER
11426 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11427 GetHierarchyParent().IncreaseLifetimeUp();
11428 #endif
11429 };
11430
11432 {
11433 PlayerBase p = PlayerBase.Cast(player);
11434
11435 array<int> recipesIds = p.m_Recipes;
11436 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11437 if (moduleRecipesManager)
11438 {
11439 EntityAI itemInHands = player.GetEntityInHands();
11440 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11441 }
11442
11443 for (int i = 0;i < recipesIds.Count(); i++)
11444 {
11445 int key = recipesIds.Get(i);
11446 string recipeName = moduleRecipesManager.GetRecipeName(key);
11448 }
11449 }
11450
11451
11452 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11453 {
11454 super.GetDebugActions(outputList);
11455
11456
11462
11463
11468
11473
11474
11478
11479
11481 {
11485 }
11486
11489
11490
11494
11496
11497 InventoryLocation loc = new InventoryLocation();
11498 GetInventory().GetCurrentInventoryLocation(loc);
11500 {
11501 if (Gizmo_IsSupported())
11504 }
11505
11507 }
11508
11509
11510
11511
11513 {
11514 super.OnAction(action_id, player, ctx);
11515
11517 {
11518 switch (action_id)
11519 {
11523 return true;
11527 return true;
11528 }
11529 }
11530
11532 {
11533 switch (action_id)
11534 {
11536 Delete();
11537 return true;
11538 }
11539 }
11540
11541 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11542 {
11543 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11544 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11545 PlayerBase p = PlayerBase.Cast(player);
11546 if (
EActions.RECIPES_RANGE_START < 1000)
11547 {
11548 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11549 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11550 }
11551 }
11552 #ifndef SERVER
11553 else if (action_id ==
EActions.WATCH_PLAYER)
11554 {
11555 PluginDeveloper.SetDeveloperItemClientEx(player);
11556 }
11557 #endif
11559 {
11560 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11561 {
11562 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11563 OnDebugButtonPressServer(id + 1);
11564 }
11565
11566 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11567 {
11568 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11570 }
11571
11572 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11573 {
11574 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11576 }
11577
11578 else if (action_id ==
EActions.ADD_QUANTITY)
11579 {
11580 if (IsMagazine())
11581 {
11582 Magazine mag = Magazine.Cast(this);
11583 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11584 }
11585 else
11586 {
11588 }
11589
11590 if (m_EM)
11591 {
11592 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11593 }
11594
11595 }
11596
11597 else if (action_id ==
EActions.REMOVE_QUANTITY)
11598 {
11599 if (IsMagazine())
11600 {
11601 Magazine mag2 = Magazine.Cast(this);
11602 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11603 }
11604 else
11605 {
11607 }
11608 if (m_EM)
11609 {
11610 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11611 }
11612
11613 }
11614
11615 else if (action_id ==
EActions.SET_QUANTITY_0)
11616 {
11618
11619 if (m_EM)
11620 {
11621 m_EM.SetEnergy(0);
11622 }
11623 }
11624
11625 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11626 {
11628
11629 if (m_EM)
11630 {
11631 m_EM.SetEnergy(m_EM.GetEnergyMax());
11632 }
11633 }
11634
11635 else if (action_id ==
EActions.ADD_HEALTH)
11636 {
11637 AddHealth("","",GetMaxHealth("","Health")/5);
11638 }
11639 else if (action_id ==
EActions.REMOVE_HEALTH)
11640 {
11641 AddHealth("","",-GetMaxHealth("","Health")/5);
11642 }
11643 else if (action_id ==
EActions.DESTROY_HEALTH)
11644 {
11645 SetHealth01("","",0);
11646 }
11647 else if (action_id ==
EActions.WATCH_ITEM)
11648 {
11650 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11651 #ifdef DEVELOPER
11652 SetDebugDeveloper_item(this);
11653 #endif
11654 }
11655
11656 else if (action_id ==
EActions.ADD_TEMPERATURE)
11657 {
11658 AddTemperature(20);
11659
11660 }
11661
11662 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11663 {
11664 AddTemperature(-20);
11665
11666 }
11667
11668 else if (action_id ==
EActions.FLIP_FROZEN)
11669 {
11670 SetFrozen(!GetIsFrozen());
11671
11672 }
11673
11674 else if (action_id ==
EActions.ADD_WETNESS)
11675 {
11677
11678 }
11679
11680 else if (action_id ==
EActions.REMOVE_WETNESS)
11681 {
11683
11684 }
11685
11686 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11687 {
11690
11691
11692 }
11693
11694 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11695 {
11698 }
11699
11700 else if (action_id ==
EActions.MAKE_SPECIAL)
11701 {
11702 auto debugParams = DebugSpawnParams.WithPlayer(player);
11703 OnDebugSpawnEx(debugParams);
11704 }
11705
11706 }
11707
11708
11709 return false;
11710 }
11711
11712
11713
11714
11718
11721
11722
11723
11725 {
11726 return false;
11727 }
11728
11729
11731 {
11732 return true;
11733 }
11734
11735
11737 {
11738 return true;
11739 }
11740
11741
11742
11744 {
11745 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11746 return g_Game.ConfigIsExisting(config_path);
11747 }
11748
11751 {
11752 return null;
11753 }
11754
11756 {
11757 return false;
11758 }
11759
11761 {
11762 return false;
11763 }
11764
11768
11769
11771 {
11772 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11773 return module_repairing.CanRepair(this, item_repair_kit);
11774 }
11775
11776
11777 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11778 {
11779 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11780 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11781 }
11782
11783
11785 {
11786
11787
11788
11789
11790
11791
11792
11793
11794 return 1;
11795 }
11796
11797
11798
11800 {
11802 }
11803
11804
11805
11807 {
11809 }
11810
11811
11820 {
11821 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11822
11823 if (player)
11824 {
11825 player.MessageStatus(text);
11826 }
11827 }
11828
11829
11838 {
11839 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11840
11841 if (player)
11842 {
11843 player.MessageAction(text);
11844 }
11845 }
11846
11847
11856 {
11857 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11858
11859 if (player)
11860 {
11861 player.MessageFriendly(text);
11862 }
11863 }
11864
11865
11874 {
11875 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11876
11877 if (player)
11878 {
11879 player.MessageImportant(text);
11880 }
11881 }
11882
11884 {
11885 return true;
11886 }
11887
11888
11889 override bool KindOf(
string tag)
11890 {
11891 bool found = false;
11892 string item_name = this.
GetType();
11894 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11895
11896 int array_size = item_tag_array.Count();
11897 for (int i = 0; i < array_size; i++)
11898 {
11899 if (item_tag_array.Get(i) == tag)
11900 {
11901 found = true;
11902 break;
11903 }
11904 }
11905 return found;
11906 }
11907
11908
11910 {
11911
11912 super.OnRPC(sender, rpc_type,ctx);
11913
11914
11915 switch (rpc_type)
11916 {
11917 #ifndef SERVER
11918 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11919 Param2<bool, string> p = new Param2<bool, string>(false, "");
11920
11922 return;
11923
11924 bool play = p.param1;
11925 string soundSet = p.param2;
11926
11927 if (play)
11928 {
11930 {
11932 {
11934 }
11935 }
11936 else
11937 {
11939 }
11940 }
11941 else
11942 {
11944 }
11945
11946 break;
11947 #endif
11948
11949 }
11950
11952 {
11954 }
11955 }
11956
11957
11958
11959
11961 {
11962 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11963 return plugin.GetID(
name);
11964 }
11965
11967 {
11968 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11969 return plugin.GetName(id);
11970 }
11971
11974 {
11975
11976
11977 int varFlags;
11978 if (!ctx.
Read(varFlags))
11979 return;
11980
11981 if (varFlags & ItemVariableFlags.FLOAT)
11982 {
11984 }
11985 }
11986
11988 {
11989
11990 super.SerializeNumericalVars(floats_out);
11991
11992
11993
11995 {
11997 }
11998
12000 {
12002 }
12003
12005 {
12007 }
12008
12010 {
12015 }
12016
12018 {
12020 }
12021 }
12022
12024 {
12025
12026 super.DeSerializeNumericalVars(floats);
12027
12028
12029 int index = 0;
12030 int mask = Math.Round(floats.Get(index));
12031
12032 index++;
12033
12035 {
12037 {
12039 }
12040 else
12041 {
12042 float quantity = floats.Get(index);
12043 SetQuantity(quantity,
true,
false,
false,
false);
12044 }
12045 index++;
12046 }
12047
12049 {
12050 float wet = floats.Get(index);
12052 index++;
12053 }
12054
12056 {
12057 int liquidtype = Math.Round(floats.Get(index));
12059 index++;
12060 }
12061
12063 {
12065 index++;
12067 index++;
12069 index++;
12071 index++;
12072 }
12073
12075 {
12076 int cleanness = Math.Round(floats.Get(index));
12078 index++;
12079 }
12080 }
12081
12083 {
12084 super.WriteVarsToCTX(ctx);
12085
12086
12088 {
12090 }
12091
12093 {
12095 }
12096
12098 {
12100 }
12101
12103 {
12104 int r,g,b,a;
12110 }
12111
12113 {
12115 }
12116 }
12117
12119 {
12120 if (!super.ReadVarsFromCTX(ctx,version))
12121 return false;
12122
12123 int intValue;
12124 float value;
12125
12126 if (version < 140)
12127 {
12128 if (!ctx.
Read(intValue))
12129 return false;
12130
12131 m_VariablesMask = intValue;
12132 }
12133
12135 {
12136 if (!ctx.
Read(value))
12137 return false;
12138
12140 {
12142 }
12143 else
12144 {
12146 }
12147 }
12148
12149 if (version < 140)
12150 {
12152 {
12153 if (!ctx.
Read(value))
12154 return false;
12155 SetTemperatureDirect(value);
12156 }
12157 }
12158
12160 {
12161 if (!ctx.
Read(value))
12162 return false;
12164 }
12165
12167 {
12168 if (!ctx.
Read(intValue))
12169 return false;
12171 }
12172
12174 {
12175 int r,g,b,a;
12177 return false;
12179 return false;
12181 return false;
12183 return false;
12184
12186 }
12187
12189 {
12190 if (!ctx.
Read(intValue))
12191 return false;
12193 }
12194
12195 if (version >= 138 && version < 140)
12196 {
12198 {
12199 if (!ctx.
Read(intValue))
12200 return false;
12201 SetFrozen(intValue);
12202 }
12203 }
12204
12205 return true;
12206 }
12207
12208
12210 {
12213 {
12215 }
12216
12217 if (!super.OnStoreLoad(ctx, version))
12218 {
12220 return false;
12221 }
12222
12223 if (version >= 114)
12224 {
12225 bool hasQuickBarIndexSaved;
12226
12227 if (!ctx.
Read(hasQuickBarIndexSaved))
12228 {
12230 return false;
12231 }
12232
12233 if (hasQuickBarIndexSaved)
12234 {
12235 int itmQBIndex;
12236
12237
12238 if (!ctx.
Read(itmQBIndex))
12239 {
12241 return false;
12242 }
12243
12244 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12245 if (itmQBIndex != -1 && parentPlayer)
12246 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12247 }
12248 }
12249 else
12250 {
12251
12252 PlayerBase player;
12253 int itemQBIndex;
12254 if (version ==
int.
MAX)
12255 {
12256 if (!ctx.
Read(itemQBIndex))
12257 {
12259 return false;
12260 }
12261 }
12262 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12263 {
12264
12265 if (!ctx.
Read(itemQBIndex))
12266 {
12268 return false;
12269 }
12270 if (itemQBIndex != -1 && player)
12271 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12272 }
12273 }
12274
12275 if (version < 140)
12276 {
12277
12278 if (!LoadVariables(ctx, version))
12279 {
12281 return false;
12282 }
12283 }
12284
12285
12287 {
12289 return false;
12290 }
12291 if (version >= 132)
12292 {
12294 if (raib)
12295 {
12297 {
12299 return false;
12300 }
12301 }
12302 }
12303
12305 return true;
12306 }
12307
12308
12309
12311 {
12312 super.OnStoreSave(ctx);
12313
12314 PlayerBase player;
12315 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12316 {
12318
12319 int itemQBIndex = -1;
12320 itemQBIndex = player.FindQuickBarEntityIndex(this);
12321 ctx.
Write(itemQBIndex);
12322 }
12323 else
12324 {
12326 }
12327
12329
12331 if (raib)
12332 {
12334 }
12335 }
12336
12337
12339 {
12340 super.AfterStoreLoad();
12341
12343 {
12345 }
12346
12348 {
12351 }
12352 }
12353
12355 {
12356 super.EEOnAfterLoad();
12357
12359 {
12361 }
12362
12365 }
12366
12368 {
12369 return false;
12370 }
12371
12372
12373
12375 {
12377 {
12378 #ifdef PLATFORM_CONSOLE
12379
12381 {
12383 if (menu)
12384 {
12386 }
12387 }
12388 #endif
12389 }
12390
12392 {
12395 }
12396
12398 {
12399 SetWeightDirty();
12401 }
12403 {
12406 }
12407
12409 {
12412
12415 }
12417 {
12421 }
12422
12423 super.OnVariablesSynchronized();
12424 }
12425
12426
12427
12429 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12430 {
12431 if (!IsServerCheck(allow_client))
12432 return false;
12433
12435 return false;
12436
12439
12440 if (value <= (min + 0.001))
12441 value = min;
12442
12443 if (value == min)
12444 {
12445 if (destroy_config)
12446 {
12447 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12448 if (dstr)
12449 {
12451 this.Delete();
12452 return true;
12453 }
12454 }
12455 else if (destroy_forced)
12456 {
12458 this.Delete();
12459 return true;
12460 }
12461
12463 }
12464
12467
12469 {
12470 EntityAI parent = GetHierarchyRoot();
12471 InventoryLocation iLoc = new InventoryLocation();
12472 GetInventory().GetCurrentInventoryLocation(iLoc);
12474 {
12475 int iLocSlot = iLoc.
GetSlot();
12477 {
12479 }
12481 {
12483 }
12484 }
12485 }
12486
12488 {
12490
12491 if (delta)
12493 }
12494
12496
12497 return false;
12498 }
12499
12500
12502 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12503 {
12505 }
12506
12508 {
12511 }
12512
12514 {
12517 }
12518
12520 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12521 {
12522 float value_clamped = Math.Clamp(value, 0, 1);
12524 SetQuantity(result, destroy_config, destroy_forced);
12525 }
12526
12527
12530 {
12532 }
12533
12535 {
12537 }
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12549 {
12550 int slot = -1;
12551 GameInventory inventory = GetInventory();
12552 if (inventory)
12553 {
12554 InventoryLocation il = new InventoryLocation;
12557 }
12558
12560 }
12561
12563 {
12564 float quantity_max = 0;
12565
12567 {
12568 if (attSlotID != -1)
12569 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12570
12571 if (quantity_max <= 0)
12573 }
12574
12575 if (quantity_max <= 0)
12577
12578 return quantity_max;
12579 }
12580
12582 {
12584 }
12585
12587 {
12589 }
12590
12591
12593 {
12595 }
12596
12598 {
12600 }
12601
12603 {
12605 }
12606
12607
12609 {
12610
12611 float weightEx = GetWeightEx();
12612 float special = GetInventoryAndCargoWeight();
12613 return weightEx - special;
12614 }
12615
12616
12618 {
12620 }
12621
12623 {
12625 {
12626 #ifdef DEVELOPER
12627 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12628 {
12629 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12631 }
12632 #endif
12633
12634 return GetQuantity() * GetConfigWeightModified();
12635 }
12636 else if (HasEnergyManager())
12637 {
12638 #ifdef DEVELOPER
12639 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12640 {
12641 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12642 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12643 }
12644 #endif
12645 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12646 }
12647 else
12648 {
12649 #ifdef DEVELOPER
12650 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12651 {
12652 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12653 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12654 }
12655 #endif
12656 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12657 }
12658 }
12659
12662 {
12663 int item_count = 0;
12665
12666 GameInventory inventory = GetInventory();
12667 CargoBase cargo = inventory.
GetCargo();
12668 if (cargo != NULL)
12669 {
12671 }
12672
12674 for (int i = 0; i < nAttachments; ++i)
12675 {
12677 if (item)
12678 item_count += item.GetNumberOfItems();
12679 }
12680 return item_count;
12681 }
12682
12685 {
12686 float weight = 0;
12687 float wetness = 1;
12688 if (include_wetness)
12691 {
12692 weight = wetness * m_ConfigWeight;
12693 }
12695 {
12696 weight = 1;
12697 }
12698 return weight;
12699 }
12700
12701
12702
12704 {
12705 GameInventory inventory = GetInventory();
12706 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12707 {
12708 array<EntityAI> items = new array<EntityAI>;
12710 for (int i = 0; i < items.Count(); ++i)
12711 {
12713 if (item)
12714 {
12715 g_Game.ObjectDelete(item);
12716 }
12717 }
12718 }
12719 }
12720
12721
12722
12723
12725 {
12726 float energy = 0;
12727 if (HasEnergyManager())
12728 {
12729 energy = GetCompEM().GetEnergy();
12730 }
12731 return energy;
12732 }
12733
12734
12736 {
12737 super.OnEnergyConsumed();
12738
12740 }
12741
12743 {
12744 super.OnEnergyAdded();
12745
12747 }
12748
12749
12751 {
12752 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12753 {
12755 {
12756 float energy_0to1 = GetCompEM().GetEnergy0To1();
12758 }
12759 }
12760 }
12761
12762
12764 {
12765 return ConfigGetFloat("heatIsolation");
12766 }
12767
12769 {
12771 }
12772
12774 {
12775 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12776 if (
g_Game.ConfigIsExisting(paramPath))
12777 return g_Game.ConfigGetFloat(paramPath);
12778
12779 return 0.0;
12780 }
12781
12783 {
12784 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12785 if (
g_Game.ConfigIsExisting(paramPath))
12786 return g_Game.ConfigGetFloat(paramPath);
12787
12788 return 0.0;
12789 }
12790
12791 override void SetWet(
float value,
bool allow_client =
false)
12792 {
12793 if (!IsServerCheck(allow_client))
12794 return;
12795
12798
12800
12801 m_VarWet = Math.Clamp(value, min, max);
12802
12804 {
12807 }
12808 }
12809
12810 override void AddWet(
float value)
12811 {
12813 }
12814
12816 {
12818 }
12819
12821 {
12823 }
12824
12826 {
12828 }
12829
12831 {
12833 }
12834
12836 {
12838 }
12839
12840 override void OnWetChanged(
float newVal,
float oldVal)
12841 {
12844 if (newLevel != oldLevel)
12845 {
12847 }
12848 }
12849
12851 {
12852 SetWeightDirty();
12853 }
12854
12856 {
12857 return GetWetLevelInternal(
m_VarWet);
12858 }
12859
12860
12861
12863 {
12865 }
12866
12868 {
12870 }
12871
12873 {
12875 }
12876
12878 {
12880 }
12881
12882
12883
12885 {
12886 if (ConfigIsExisting("itemModelLength"))
12887 {
12888 return ConfigGetFloat("itemModelLength");
12889 }
12890 return 0;
12891 }
12892
12894 {
12895 if (ConfigIsExisting("itemAttachOffset"))
12896 {
12897 return ConfigGetFloat("itemAttachOffset");
12898 }
12899 return 0;
12900 }
12901
12902 override void SetCleanness(
int value,
bool allow_client =
false)
12903 {
12904 if (!IsServerCheck(allow_client))
12905 return;
12906
12908
12910
12913 }
12914
12916 {
12918 }
12919
12921 {
12922 return true;
12923 }
12924
12925
12926
12927
12929 {
12931 }
12932
12934 {
12936 }
12937
12938
12939
12940
12941 override void SetColor(
int r,
int g,
int b,
int a)
12942 {
12948 }
12950 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12951 {
12956 }
12957
12959 {
12961 }
12962
12965 {
12966 int r,g,b,a;
12968 r = r/255;
12969 g = g/255;
12970 b = b/255;
12971 a = a/255;
12972 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12973 }
12974
12975
12976
12977 override void SetLiquidType(
int value,
bool allow_client =
false)
12978 {
12979 if (!IsServerCheck(allow_client))
12980 return;
12981
12986 }
12987
12989 {
12990 return ConfigGetInt("varLiquidTypeInit");
12991 }
12992
12994 {
12996 }
12997
12999 {
13001 SetFrozen(false);
13002 }
13003
13006 {
13007 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13008 }
13009
13010
13013 {
13014 PlayerBase nplayer;
13015 if (PlayerBase.CastTo(nplayer, player))
13016 {
13018 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13019 }
13020 }
13021
13022
13025 {
13026 PlayerBase nplayer;
13027 if (PlayerBase.CastTo(nplayer,player))
13028 {
13029 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13030 }
13031
13032 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13033
13034 if (HasEnergyManager())
13035 {
13036 GetCompEM().UpdatePlugState();
13037 }
13038 }
13039
13040
13042 {
13043 super.OnPlacementStarted(player);
13044
13046 }
13047
13048 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13049 {
13051 {
13052 m_AdminLog.OnPlacementComplete(player,
this);
13053 }
13054
13055 super.OnPlacementComplete(player, position, orientation);
13056 }
13057
13058
13059
13060
13061
13063 {
13065 {
13066 return true;
13067 }
13068 else
13069 {
13070 return false;
13071 }
13072 }
13073
13074
13076 {
13078 {
13080 }
13081 }
13082
13083
13085 {
13087 }
13088
13090 {
13092 }
13093
13094 override void InsertAgent(
int agent,
float count = 1)
13095 {
13096 if (count < 1)
13097 return;
13098
13100 }
13101
13104 {
13106 }
13107
13108
13110 {
13112 }
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13156 {
13158 return false;
13159 return true;
13160 }
13161
13163 {
13164
13166 }
13167
13168
13171 {
13172 super.CheckForRoofLimited(timeTresholdMS);
13173
13174 float time =
g_Game.GetTime();
13175 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13176 {
13177 m_PreviousRoofTestTime = time;
13178 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13179 }
13180 }
13181
13182
13184 {
13186 {
13187 return 0;
13188 }
13189
13190 if (GetInventory().GetAttachmentSlotsCount() != 0)
13191 {
13192 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13193 if (filter)
13194 return filter.GetProtectionLevel(type, false, system);
13195 else
13196 return 0;
13197 }
13198
13199 string subclassPath, entryName;
13200
13201 switch (type)
13202 {
13204 entryName = "biological";
13205 break;
13207 entryName = "chemical";
13208 break;
13209 default:
13210 entryName = "biological";
13211 break;
13212 }
13213
13214 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13215
13216 return g_Game.ConfigGetFloat(subclassPath + entryName);
13217 }
13218
13219
13220
13223 {
13224 if (!IsMagazine())
13226
13228 }
13229
13230
13231
13232
13233
13238 {
13239 return true;
13240 }
13241
13243 {
13245 }
13246
13247
13248
13249
13250
13252 {
13253 if (parent)
13254 {
13255 if (parent.IsInherited(DayZInfected))
13256 return true;
13257
13258 if (!parent.IsRuined())
13259 return true;
13260 }
13261
13262 return true;
13263 }
13264
13266 {
13267 if (!super.CanPutAsAttachment(parent))
13268 {
13269 return false;
13270 }
13271
13272 if (!IsRuined() && !parent.IsRuined())
13273 {
13274 return true;
13275 }
13276
13277 return false;
13278 }
13279
13281 {
13282
13283
13284
13285
13286 return super.CanReceiveItemIntoCargo(item);
13287 }
13288
13290 {
13291
13292
13293
13294
13295 GameInventory attachmentInv = attachment.GetInventory();
13297 {
13298 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13299 return false;
13300 }
13301
13302 InventoryLocation loc = new InventoryLocation();
13303 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13304 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13305 return false;
13306
13307 return super.CanReceiveAttachment(attachment, slotId);
13308 }
13309
13311 {
13312 if (!super.CanReleaseAttachment(attachment))
13313 return false;
13314
13315 return GetInventory().AreChildrenAccessible();
13316 }
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13339 {
13340 int id = muzzle_owner.GetMuzzleID();
13341 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13342
13343 if (WPOF_array)
13344 {
13345 for (int i = 0; i < WPOF_array.Count(); i++)
13346 {
13347 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13348
13349 if (WPOF)
13350 {
13351 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13352 }
13353 }
13354 }
13355 }
13356
13357
13359 {
13360 int id = muzzle_owner.GetMuzzleID();
13362
13363 if (WPOBE_array)
13364 {
13365 for (int i = 0; i < WPOBE_array.Count(); i++)
13366 {
13367 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13368
13369 if (WPOBE)
13370 {
13371 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13372 }
13373 }
13374 }
13375 }
13376
13377
13379 {
13380 int id = muzzle_owner.GetMuzzleID();
13381 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13382
13383 if (WPOOH_array)
13384 {
13385 for (int i = 0; i < WPOOH_array.Count(); i++)
13386 {
13387 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13388
13389 if (WPOOH)
13390 {
13391 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13392 }
13393 }
13394 }
13395 }
13396
13397
13399 {
13400 int id = muzzle_owner.GetMuzzleID();
13401 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13402
13403 if (WPOOH_array)
13404 {
13405 for (int i = 0; i < WPOOH_array.Count(); i++)
13406 {
13407 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13408
13409 if (WPOOH)
13410 {
13411 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13412 }
13413 }
13414 }
13415 }
13416
13417
13419 {
13420 int id = muzzle_owner.GetMuzzleID();
13421 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13422
13423 if (WPOOH_array)
13424 {
13425 for (int i = 0; i < WPOOH_array.Count(); i++)
13426 {
13427 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13428
13429 if (WPOOH)
13430 {
13431 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13432 }
13433 }
13434 }
13435 }
13436
13437
13438
13440 {
13442 {
13443 return true;
13444 }
13445
13446 return false;
13447 }
13448
13450 {
13452 {
13453 return true;
13454 }
13455
13456 return false;
13457 }
13458
13460 {
13462 {
13463 return true;
13464 }
13465
13466 return false;
13467 }
13468
13470 {
13471 return false;
13472 }
13473
13476 {
13477 return UATimeSpent.DEFAULT_DEPLOY;
13478 }
13479
13480
13481
13482
13484 {
13486 SetSynchDirty();
13487 }
13488
13490 {
13492 }
13493
13494
13496 {
13497 return false;
13498 }
13499
13502 {
13503 string att_type = "None";
13504
13505 if (ConfigIsExisting("soundAttType"))
13506 {
13507 att_type = ConfigGetString("soundAttType");
13508 }
13509
13511 }
13512
13514 {
13516 }
13517
13518
13519
13520
13521
13527
13529 {
13532
13534 }
13535
13536
13538 {
13540 return;
13541
13543
13546
13549
13550 SoundParameters params = new SoundParameters();
13554 }
13555
13556
13558 {
13560 {
13563
13564 SetSynchDirty();
13565
13568 }
13569 }
13570
13572 {
13574 }
13575
13576
13578 {
13580 return;
13581
13583 SetSynchDirty();
13584
13587 }
13588
13590 {
13593 }
13594
13596 {
13598 }
13599
13600 void OnApply(PlayerBase player);
13601
13603 {
13604 return 1.0;
13605 };
13606
13608 {
13610 }
13611
13613 {
13615 }
13616
13618
13620 {
13621 SetDynamicPhysicsLifeTime(0.01);
13623 }
13624
13626 {
13627 array<string> zone_names = new array<string>;
13628 GetDamageZones(zone_names);
13629 for (int i = 0; i < zone_names.Count(); i++)
13630 {
13631 SetHealthMax(zone_names.Get(i),"Health");
13632 }
13633 SetHealthMax("","Health");
13634 }
13635
13638 {
13639 float global_health = GetHealth01("","Health");
13640 array<string> zones = new array<string>;
13641 GetDamageZones(zones);
13642
13643 for (int i = 0; i < zones.Count(); i++)
13644 {
13645 SetHealth01(zones.Get(i),"Health",global_health);
13646 }
13647 }
13648
13651 {
13652 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13653 }
13654
13656 {
13657 if (!hasRootAsPlayer)
13658 {
13659 if (refParentIB)
13660 {
13661
13662 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13663 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13664
13665 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13666 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13667
13670 }
13671 else
13672 {
13673
13676 }
13677 }
13678 }
13679
13681 {
13683 {
13684 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13685 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13686 {
13687 float heatPermCoef = 1.0;
13689 while (ent)
13690 {
13691 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13692 ent = ent.GetHierarchyParent();
13693 }
13694
13695 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13696 }
13697 }
13698 }
13699
13701 {
13702
13703 EntityAI parent = GetHierarchyParent();
13704 if (!parent)
13705 {
13706 hasParent = false;
13707 hasRootAsPlayer = false;
13708 }
13709 else
13710 {
13711 hasParent = true;
13712 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13713 refParentIB =
ItemBase.Cast(parent);
13714 }
13715 }
13716
13717 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13718 {
13719
13720 }
13721
13723 {
13724
13725 return false;
13726 }
13727
13729 {
13730
13731
13732 return false;
13733 }
13734
13736 {
13737
13738 return false;
13739 }
13740
13743 {
13744 return !GetIsFrozen() &&
IsOpen();
13745 }
13746
13748 {
13749 bool hasParent = false, hasRootAsPlayer = false;
13751
13752 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13753 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13754
13755 if (wwtu || foodDecay)
13756 {
13760
13761 if (processWetness || processTemperature || processDecay)
13762 {
13764
13765 if (processWetness)
13766 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13767
13768 if (processTemperature)
13770
13771 if (processDecay)
13772 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13773 }
13774 }
13775 }
13776
13779 {
13781 }
13782
13784 {
13787
13788 return super.GetTemperatureFreezeThreshold();
13789 }
13790
13792 {
13795
13796 return super.GetTemperatureThawThreshold();
13797 }
13798
13800 {
13803
13804 return super.GetItemOverheatThreshold();
13805 }
13806
13808 {
13810 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13811
13812 return super.GetTemperatureFreezeTime();
13813 }
13814
13816 {
13818 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13819
13820 return super.GetTemperatureThawTime();
13821 }
13822
13827
13829 {
13830 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13831 }
13832
13834 {
13835 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13836 }
13837
13840 {
13842 }
13843
13845 {
13847 }
13848
13850 {
13852 }
13853
13856 {
13857 return null;
13858 }
13859
13862 {
13863 return false;
13864 }
13865
13867 {
13869 {
13872 if (!trg)
13873 {
13875 explosive = this;
13876 }
13877
13878 explosive.PairRemote(trg);
13880
13881 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13882 trg.SetPersistentPairID(persistentID);
13883 explosive.SetPersistentPairID(persistentID);
13884
13885 return true;
13886 }
13887 return false;
13888 }
13889
13892 {
13893 float ret = 1.0;
13896 ret *= GetHealth01();
13897
13898 return ret;
13899 }
13900
13901 #ifdef DEVELOPER
13902 override void SetDebugItem()
13903 {
13904 super.SetDebugItem();
13905 _itemBase = this;
13906 }
13907
13909 {
13910 string text = super.GetDebugText();
13911
13913 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13914
13915 return text;
13916 }
13917 #endif
13918
13920 {
13921 return true;
13922 }
13923
13925
13927
13929 {
13932 }
13933
13934
13942
13958
13959 [
Obsolete(
"Use ItemSoundHandler instead")]
13962 {
13963 if (!
g_Game.IsDedicatedServer())
13964 {
13965 if (ConfigIsExisting("attachSoundSet"))
13966 {
13967 string cfg_path = "";
13968 string soundset = "";
13969 string type_name =
GetType();
13970
13973 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13974 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13975
13976 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13977 {
13978 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13979 {
13980 if (cfg_slot_array[i] == slot_type)
13981 {
13982 soundset = cfg_soundset_array[i];
13983 break;
13984 }
13985 }
13986 }
13987
13988 if (soundset != "")
13989 {
13990 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13992 }
13993 }
13994 }
13995 }
13996
13998}
13999
14001{
14003 if (entity)
14004 {
14005 bool is_item = entity.IsInherited(
ItemBase);
14006 if (is_item && full_quantity)
14007 {
14010 }
14011 }
14012 else
14013 {
14015 return NULL;
14016 }
14017 return entity;
14018}
14019
14021{
14022 if (item)
14023 {
14024 if (health > 0)
14025 item.SetHealth("", "", health);
14026
14027 if (item.CanHaveTemperature())
14028 {
14030 if (item.CanFreeze())
14031 item.SetFrozen(false);
14032 }
14033
14034 if (item.HasEnergyManager())
14035 {
14036 if (quantity >= 0)
14037 {
14038 item.GetCompEM().SetEnergy0To1(quantity);
14039 }
14040 else
14041 {
14043 }
14044 }
14045 else if (item.IsMagazine())
14046 {
14047 Magazine mag = Magazine.Cast(item);
14048 if (quantity >= 0)
14049 {
14050 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14051 }
14052 else
14053 {
14055 }
14056
14057 }
14058 else
14059 {
14060 if (quantity >= 0)
14061 {
14062 item.SetQuantityNormalized(quantity, false);
14063 }
14064 else
14065 {
14067 }
14068
14069 }
14070 }
14071}
14072
14073#ifdef DEVELOPER
14075#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.