8868{
8870 {
8871 return true;
8872 }
8873};
8874
8876{
8877
8878};
8879
8880
8881
8883{
8887
8889
8892
8893
8894
8895
8896
8905
8911
8916
8921
8942 protected bool m_IsResultOfSplit
8943
8945
8950
8951
8952
8954
8958
8959
8960
8962
8965
8966
8967
8973
8974
8982
8985
8986
8988
8989
8991
8992
8997
8998
9003
9005
9006
9008
9009
9011 {
9016
9017 if (!
g_Game.IsDedicatedServer())
9018 {
9020 {
9022
9024 {
9026 }
9027 }
9028
9031 }
9032
9033 m_OldLocation = null;
9034
9036 {
9038 }
9039
9040 if (ConfigIsExisting("headSelectionsToHide"))
9041 {
9044 }
9045
9047 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9048 {
9050 }
9051
9053
9054 m_IsResultOfSplit = false;
9055
9057 }
9058
9060 {
9061 super.InitItemVariables();
9062
9068 m_Count = ConfigGetInt(
"count");
9069
9072
9077
9080
9085
9097
9101
9102
9105 if (ConfigIsExisting("canBeSplit"))
9106 {
9109 }
9110
9112 if (ConfigIsExisting("itemBehaviour"))
9114
9115
9118 RegisterNetSyncVariableInt("m_VarLiquidType");
9119 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9120
9121 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9122 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9123 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9124
9125 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9126 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9127 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9128 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9129
9130 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9131 RegisterNetSyncVariableBool("m_IsTakeable");
9132 RegisterNetSyncVariableBool("m_IsHologram");
9133
9136 {
9139 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9140 }
9141
9143
9145 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9147
9149 }
9150
9152 {
9154 }
9155
9157 {
9160 {
9165 }
9166 }
9167
9168 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9169 {
9171 {
9174 }
9175
9177 }
9178
9180 {
9186 }
9187
9189
9191 {
9193
9194 if (!action)
9195 {
9196 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9197 return;
9198 }
9199
9201 if (!ai)
9202 {
9204 return;
9205 }
9206
9208 if (!action_array)
9209 {
9210 action_array = new array<ActionBase_Basic>;
9212 }
9213 if (LogManager.IsActionLogEnable())
9214 {
9215 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9216 }
9217
9218 if (action_array.Find(action) != -1)
9219 {
9220 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9221 }
9222 else
9223 {
9224 action_array.Insert(action);
9225 }
9226 }
9227
9229 {
9230 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9231 ActionBase action = player.GetActionManager().GetAction(actionName);
9234
9235 if (action_array)
9236 {
9237 action_array.RemoveItem(action);
9238 }
9239 }
9240
9241
9242
9244 {
9245 ActionOverrideData overrideData = new ActionOverrideData();
9249
9251 if (!actionMap)
9252 {
9255 }
9256
9257 actionMap.Insert(this.
Type(), overrideData);
9258
9259 }
9260
9262
9264
9265
9267 {
9270
9273
9274 string config_to_search = "CfgVehicles";
9275 string muzzle_owner_config;
9276
9278 {
9279 if (IsInherited(Weapon))
9280 config_to_search = "CfgWeapons";
9281
9282 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9283
9284 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9285
9286 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9287
9288 if (config_OnFire_subclass_count > 0)
9289 {
9290 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9291
9292 for (int i = 0; i < config_OnFire_subclass_count; i++)
9293 {
9294 string particle_class = "";
9295 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9296 string config_OnFire_entry = config_OnFire_class + particle_class;
9297 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9298 WPOF_array.Insert(WPOF);
9299 }
9300
9301
9303 }
9304 }
9305
9307 {
9308 config_to_search = "CfgWeapons";
9309 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9310
9311 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9312
9313 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9314
9315 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9316 {
9317 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9318
9319 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9320 {
9321 string particle_class2 = "";
9322 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9323 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9324 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9325 WPOBE_array.Insert(WPOBE);
9326 }
9327
9328
9330 }
9331 }
9332 }
9333
9334
9336 {
9339
9341 {
9342 string config_to_search = "CfgVehicles";
9343
9344 if (IsInherited(Weapon))
9345 config_to_search = "CfgWeapons";
9346
9347 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9348 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9349
9350 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9351 {
9352
9354
9356 {
9358 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9360 return;
9361 }
9362
9365
9366
9367
9368 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9369 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9370
9371 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9372 {
9373 string particle_class = "";
9374 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9375 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9376 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9377
9378 if (entry_type == CT_CLASS)
9379 {
9380 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9381 WPOOH_array.Insert(WPOF);
9382 }
9383 }
9384
9385
9387 }
9388 }
9389 }
9390
9392 {
9394 }
9395
9397 {
9399 {
9401
9404
9407
9408 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9409 }
9410 }
9411
9413 {
9415 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9416
9418 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9419
9421 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9422
9424 {
9426 }
9427 }
9428
9430 {
9432 }
9433
9435 {
9438 else
9440
9442 {
9445 }
9446 else
9447 {
9450
9453 }
9454
9456 }
9457
9459 {
9461 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9462 }
9463
9465 {
9467 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9469 }
9470
9472 {
9474 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9475 }
9476
9478 {
9481
9482 OverheatingParticle OP = new OverheatingParticle();
9487
9489 }
9490
9492 {
9495
9496 return -1;
9497 }
9498
9500 {
9502 {
9505
9506 for (int i = count; i > 0; --i)
9507 {
9508 int id = i - 1;
9511
9514
9515 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9516 {
9517 if (p)
9518 {
9521 }
9522 }
9523 }
9524 }
9525 }
9526
9528 {
9530 {
9532 {
9533 int id = i - 1;
9535
9536 if (OP)
9537 {
9539
9540 if (p)
9541 {
9543 }
9544
9545 delete OP;
9546 }
9547 }
9548
9551 }
9552 }
9553
9556 {
9557 return 0.0;
9558 }
9559
9560
9562 {
9563 return 250;
9564 }
9565
9567 {
9568 return 0;
9569 }
9570
9573 {
9575 return true;
9576
9577 return false;
9578 }
9579
9582 {
9585
9587 {
9589 }
9590 else
9591 {
9592
9594 }
9595
9597 }
9598
9605 {
9606 return -1;
9607 }
9608
9609
9610
9611
9613 {
9615 {
9616 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9617 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9618
9619 if (r_index >= 0)
9620 {
9621 InventoryLocation r_il = new InventoryLocation;
9622 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9623
9624 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9627 {
9628 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9629 }
9631 {
9632 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9633 }
9634
9635 }
9636
9637 player.GetHumanInventory().ClearUserReservedLocation(this);
9638 }
9639
9642 }
9643
9644
9645
9646
9648 {
9649 return ItemBase.m_DebugActionsMask;
9650 }
9651
9653 {
9654 return ItemBase.m_DebugActionsMask & mask;
9655 }
9656
9658 {
9659 ItemBase.m_DebugActionsMask = mask;
9660 }
9661
9663 {
9664 ItemBase.m_DebugActionsMask |= mask;
9665 }
9666
9668 {
9669 ItemBase.m_DebugActionsMask &= ~mask;
9670 }
9671
9673 {
9675 {
9677 }
9678 else
9679 {
9681 }
9682 }
9683
9684
9686 {
9687 if (GetEconomyProfile())
9688 {
9689 float q_max = GetEconomyProfile().GetQuantityMax();
9690 if (q_max > 0)
9691 {
9692 float q_min = GetEconomyProfile().GetQuantityMin();
9693 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9694
9696 {
9697 ComponentEnergyManager comp = GetCompEM();
9699 {
9701 }
9702 }
9704 {
9706
9707 }
9708
9709 }
9710 }
9711 }
9712
9715 {
9716 EntityAI parent = GetHierarchyParent();
9717
9718 if (parent)
9719 {
9720 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9721 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9722 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9723 }
9724 }
9725
9728 {
9729 EntityAI parent = GetHierarchyParent();
9730
9731 if (parent)
9732 {
9733 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9734 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9735 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9736 }
9737 }
9738
9740 {
9741
9742
9743
9744
9746
9748 {
9749 if (ScriptInputUserData.CanStoreInputUserData())
9750 {
9751 ScriptInputUserData ctx = new ScriptInputUserData;
9757 ctx.
Write(use_stack_max);
9760
9762 {
9763 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9764 }
9765 }
9766 }
9767 else if (!
g_Game.IsMultiplayer())
9768 {
9770 }
9771 }
9772
9774 {
9776 }
9777
9779 {
9781 }
9782
9784 {
9786 }
9787
9789 {
9790
9791 return false;
9792 }
9793
9795 {
9796 return false;
9797 }
9798
9802 {
9803 return false;
9804 }
9805
9807 {
9808 return "";
9809 }
9810
9812
9814 {
9815 return false;
9816 }
9817
9819 {
9820 return true;
9821 }
9822
9823
9824
9826 {
9827 return true;
9828 }
9829
9831 {
9832 return true;
9833 }
9834
9836 {
9837 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9839 }
9840
9842 {
9844 }
9845
9847 {
9849 if (!is_being_placed)
9851 SetSynchDirty();
9852 }
9853
9854
9856
9858 {
9860 }
9861
9863 {
9865 }
9866
9868 {
9869 return 1;
9870 }
9871
9873 {
9874 return false;
9875 }
9876
9878 {
9880 SetSynchDirty();
9881 }
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9918 {
9919 super.OnMovedInsideCargo(container);
9920
9921 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9922 }
9923
9924 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9925 {
9926 super.EEItemLocationChanged(oldLoc, newLoc);
9927
9928 PlayerBase newPlayer = null;
9929 PlayerBase oldPlayer = null;
9930
9931 if (newLoc.GetParent())
9932 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9933
9934 if (oldLoc.GetParent())
9935 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9936
9938 {
9939 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9940
9941 if (rIndex >= 0)
9942 {
9943 InventoryLocation rIl = new InventoryLocation;
9944 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9945
9946 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9949 {
9950 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9951 }
9953 {
9955 }
9956
9957 }
9958 }
9959
9961 {
9962 if (newPlayer)
9963 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9964
9965 if (newPlayer == oldPlayer)
9966 {
9967 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9968 {
9970 {
9971 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9972 {
9973 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9974 }
9975 }
9976 else
9977 {
9978 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9979 }
9980 }
9981
9982 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9983 {
9984 int type = oldLoc.GetType();
9986 {
9987 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9988 }
9990 {
9991 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9992 }
9993 }
9994 if (!m_OldLocation)
9995 {
9996 m_OldLocation = new InventoryLocation;
9997 }
9998 m_OldLocation.Copy(oldLoc);
9999 }
10000 else
10001 {
10002 if (m_OldLocation)
10003 {
10004 m_OldLocation.Reset();
10005 }
10006 }
10007
10008 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10009 }
10010 else
10011 {
10012 if (newPlayer)
10013 {
10014 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10015 if (resIndex >= 0)
10016 {
10017 InventoryLocation il = new InventoryLocation;
10018 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10020 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10023 {
10024 il.
GetParent().GetOnReleaseLock().Invoke(it);
10025 }
10027 {
10029 }
10030
10031 }
10032 }
10034 {
10035
10037 }
10038
10039 if (m_OldLocation)
10040 {
10041 m_OldLocation.Reset();
10042 }
10043 }
10044
10046 {
10047 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10048 }
10049
10051 {
10052 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10053 }
10054 }
10055
10056 override void EOnContact(IEntity other, Contact extra)
10057 {
10059 {
10060 int liquidType = -1;
10062 if (impactSpeed > 0.0)
10063 {
10065 #ifndef SERVER
10067 #else
10069 SetSynchDirty();
10070 #endif
10072 }
10073 }
10074
10075 #ifdef SERVER
10076 if (GetCompEM() && GetCompEM().IsPlugged())
10077 {
10078 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10079 GetCompEM().UnplugThis();
10080 }
10081 #endif
10082 }
10083
10085
10087 {
10089 }
10090
10092 {
10093
10094 }
10095
10097 {
10098 super.OnItemLocationChanged(old_owner, new_owner);
10099
10100 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10101 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10102
10103 if (!relatedPlayer && playerNew)
10104 relatedPlayer = playerNew;
10105
10106 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10107 {
10109 if (actionMgr)
10110 {
10111 ActionBase currentAction = actionMgr.GetRunningAction();
10112 if (currentAction)
10114 }
10115 }
10116
10117 Man ownerPlayerOld = null;
10118 Man ownerPlayerNew = null;
10119
10120 if (old_owner)
10121 {
10122 if (old_owner.
IsMan())
10123 {
10124 ownerPlayerOld = Man.Cast(old_owner);
10125 }
10126 else
10127 {
10128 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10129 }
10130 }
10131 else
10132 {
10134 {
10136
10137 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10138 {
10139 GetCompEM().UnplugThis();
10140 }
10141 }
10142 }
10143
10144 if (new_owner)
10145 {
10146 if (new_owner.
IsMan())
10147 {
10148 ownerPlayerNew = Man.Cast(new_owner);
10149 }
10150 else
10151 {
10152 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10153 }
10154 }
10155
10156 if (ownerPlayerOld != ownerPlayerNew)
10157 {
10158 if (ownerPlayerOld)
10159 {
10160 array<EntityAI> subItemsExit = new array<EntityAI>;
10162 for (int i = 0; i < subItemsExit.Count(); i++)
10163 {
10166 }
10167 }
10168
10169 if (ownerPlayerNew)
10170 {
10171 array<EntityAI> subItemsEnter = new array<EntityAI>;
10173 for (int j = 0; j < subItemsEnter.Count(); j++)
10174 {
10177 }
10178 }
10179 }
10180 else if (ownerPlayerNew != null)
10181 {
10182 PlayerBase nplayer;
10183 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10184 {
10185 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10187 for (int k = 0; k < subItemsUpdate.Count(); k++)
10188 {
10190 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10191 }
10192 }
10193 }
10194
10195 if (old_owner)
10196 old_owner.OnChildItemRemoved(this);
10197 if (new_owner)
10198 new_owner.OnChildItemReceived(this);
10199 }
10200
10201
10203 {
10204 super.EEDelete(parent);
10205 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10206 if (player)
10207 {
10209
10210 if (player.IsAlive())
10211 {
10212 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10213 if (r_index >= 0)
10214 {
10215 InventoryLocation r_il = new InventoryLocation;
10216 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10217
10218 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10221 {
10222 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10223 }
10225 {
10226 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10227 }
10228
10229 }
10230
10231 player.RemoveQuickBarEntityShortcut(this);
10232 }
10233 }
10234 }
10235
10237 {
10238 super.EEKilled(killer);
10239
10242 {
10243 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10244 {
10245 if (IsMagazine())
10246 {
10247 if (Magazine.Cast(this).GetAmmoCount() > 0)
10248 {
10250 }
10251 }
10252 else
10253 {
10255 }
10256 }
10257 }
10258 }
10259
10261 {
10262 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10263
10264 super.OnWasAttached(parent, slot_id);
10265
10268
10271 }
10272
10274 {
10275 super.OnWasDetached(parent, slot_id);
10276
10279
10282 }
10283
10285 {
10286 int idx;
10289
10290 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10291 if (inventory_slots.Count() < 1)
10292 {
10293 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10294 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10295 }
10296 else
10297 {
10298 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10299 }
10300
10301 idx = inventory_slots.Find(slot);
10302 if (idx < 0)
10303 return "";
10304
10305 return attach_types.Get(idx);
10306 }
10307
10309 {
10310 int idx = -1;
10311 string slot;
10312
10315
10316 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10317 if (inventory_slots.Count() < 1)
10318 {
10319 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10320 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10321 }
10322 else
10323 {
10324 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10325 if (detach_types.Count() < 1)
10326 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10327 }
10328
10329 for (int i = 0; i < inventory_slots.Count(); i++)
10330 {
10331 slot = inventory_slots.Get(i);
10332 }
10333
10334 if (slot != "")
10335 {
10336 if (detach_types.Count() == 1)
10337 idx = 0;
10338 else
10339 idx = inventory_slots.Find(slot);
10340 }
10341 if (idx < 0)
10342 return "";
10343
10344 return detach_types.Get(idx);
10345 }
10346
10348 {
10349
10351
10352
10353 float min_time = 1;
10354 float max_time = 3;
10355 float delay = Math.RandomFloat(min_time, max_time);
10356
10357 explode_timer.Run(delay, this, "DoAmmoExplosion");
10358 }
10359
10361 {
10362 Magazine magazine = Magazine.Cast(this);
10363 int pop_sounds_count = 6;
10364 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10365
10366
10367 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10368 string sound_name = pop_sounds[ sound_idx ];
10369 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10370
10371
10372 magazine.ServerAddAmmoCount(-1);
10373
10374
10375 float min_temp_to_explode = 100;
10376
10377 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10378 {
10380 }
10381 }
10382
10383
10384 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10385 {
10386 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10387
10388 const int CHANCE_DAMAGE_CARGO = 4;
10389 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10390 const int CHANCE_DAMAGE_NOTHING = 2;
10391
10393 {
10394 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10395 int chances;
10396 int rnd;
10397
10398 if (GetInventory().GetCargo())
10399 {
10400 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10401 rnd = Math.RandomInt(0,chances);
10402
10403 if (rnd < CHANCE_DAMAGE_CARGO)
10404 {
10406 }
10407 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10408 {
10410 }
10411 }
10412 else
10413 {
10414 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10415 rnd = Math.RandomInt(0,chances);
10416
10417 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10418 {
10420 }
10421 }
10422 }
10423 }
10424
10426 {
10427 CargoBase cargo = GetInventory().GetCargo();
10428 if (cargo)
10429 {
10431 if (item_count > 0)
10432 {
10433 int random_pick = Math.RandomInt(0, item_count);
10435 if (!item.IsExplosive())
10436 {
10437 item.AddHealth("","",damage);
10438 return true;
10439 }
10440 }
10441 }
10442 return false;
10443 }
10444
10446 {
10447 GameInventory inventory = GetInventory();
10449 if (attachment_count > 0)
10450 {
10451 int random_pick = Math.RandomInt(0, attachment_count);
10453 if (!attachment.IsExplosive())
10454 {
10455 attachment.AddHealth("","",damage);
10456 return true;
10457 }
10458 }
10459 return false;
10460 }
10461
10463 {
10465 }
10466
10468 {
10470 return GetInventory().CanRemoveEntity();
10471
10472 return false;
10473 }
10474
10476 {
10477
10479 return false;
10480
10481
10483 return false;
10484
10485
10486
10488 if (delta == 0)
10489 return false;
10490
10491
10492 return true;
10493 }
10494
10496 {
10498 {
10499 if (ScriptInputUserData.CanStoreInputUserData())
10500 {
10501 ScriptInputUserData ctx = new ScriptInputUserData;
10506 ctx.
Write(destination_entity);
10508 ctx.
Write(slot_id);
10510 }
10511 }
10512 else if (!
g_Game.IsMultiplayer())
10513 {
10515 }
10516 }
10517
10519 {
10520 float split_quantity_new;
10524 InventoryLocation loc = new InventoryLocation;
10525
10526 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10527 {
10529 split_quantity_new = stack_max;
10530 else
10532
10534 {
10535 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10536 if (new_item)
10537 {
10538 new_item.SetResultOfSplit(true);
10539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10541 new_item.
SetQuantity(split_quantity_new,
false,
true);
10542 }
10543 }
10544 }
10545 else if (destination_entity && slot_id == -1)
10546 {
10547 if (quantity > stack_max)
10548 split_quantity_new = stack_max;
10549 else
10550 split_quantity_new = quantity;
10551
10553 {
10554 GameInventory destinationInventory = destination_entity.GetInventory();
10556 {
10559 }
10560
10561 if (new_item)
10562 {
10563 new_item.SetResultOfSplit(true);
10564 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10566 new_item.
SetQuantity(split_quantity_new,
false,
true);
10567 }
10568 }
10569 }
10570 else
10571 {
10572 if (stack_max != 0)
10573 {
10575 {
10577 }
10578
10579 if (split_quantity_new == 0)
10580 {
10581 if (!
g_Game.IsMultiplayer())
10582 player.PhysicalPredictiveDropItem(this);
10583 else
10584 player.ServerDropEntity(this);
10585 return;
10586 }
10587
10589 {
10591
10592 if (new_item)
10593 {
10594 new_item.SetResultOfSplit(true);
10595 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10598 new_item.PlaceOnSurface();
10599 }
10600 }
10601 }
10602 }
10603 }
10604
10606 {
10607 float split_quantity_new;
10611 InventoryLocation loc = new InventoryLocation;
10612
10613 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10614 {
10616 split_quantity_new = stack_max;
10617 else
10619
10621 {
10622 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10623 if (new_item)
10624 {
10625 new_item.SetResultOfSplit(true);
10626 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10628 new_item.
SetQuantity(split_quantity_new,
false,
true);
10629 }
10630 }
10631 }
10632 else if (destination_entity && slot_id == -1)
10633 {
10634 if (quantity > stack_max)
10635 split_quantity_new = stack_max;
10636 else
10637 split_quantity_new = quantity;
10638
10640 {
10641 GameInventory destinationInventory = destination_entity.GetInventory();
10643 {
10646 }
10647
10648 if (new_item)
10649 {
10650 new_item.SetResultOfSplit(true);
10651 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10653 new_item.
SetQuantity(split_quantity_new,
false,
true);
10654 }
10655 }
10656 }
10657 else
10658 {
10659 if (stack_max != 0)
10660 {
10662 {
10664 }
10665
10667 {
10669
10670 if (new_item)
10671 {
10672 new_item.SetResultOfSplit(true);
10673 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10676 new_item.PlaceOnSurface();
10677 }
10678 }
10679 }
10680 }
10681 }
10682
10684 {
10686 {
10687 if (ScriptInputUserData.CanStoreInputUserData())
10688 {
10689 ScriptInputUserData ctx = new ScriptInputUserData;
10694 dst.WriteToContext(ctx);
10696 }
10697 }
10698 else if (!
g_Game.IsMultiplayer())
10699 {
10701 }
10702 }
10703
10705 {
10707 {
10708 if (ScriptInputUserData.CanStoreInputUserData())
10709 {
10710 ScriptInputUserData ctx = new ScriptInputUserData;
10715 ctx.
Write(destination_entity);
10721 }
10722 }
10723 else if (!
g_Game.IsMultiplayer())
10724 {
10726 }
10727 }
10728
10730 {
10732 }
10733
10735 {
10737 float split_quantity_new;
10739 if (dst.IsValid())
10740 {
10741 int slot_id = dst.GetSlot();
10743
10744 if (quantity > stack_max)
10745 split_quantity_new = stack_max;
10746 else
10747 split_quantity_new = quantity;
10748
10750 {
10752
10753 if (new_item)
10754 {
10755 new_item.SetResultOfSplit(true);
10756 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10758 new_item.
SetQuantity(split_quantity_new,
false,
true);
10759 }
10760
10761 return new_item;
10762 }
10763 }
10764
10765 return null;
10766 }
10767
10769 {
10771 float split_quantity_new;
10773 if (destination_entity)
10774 {
10776 if (quantity > stackable)
10777 split_quantity_new = stackable;
10778 else
10779 split_quantity_new = quantity;
10780
10782 {
10783 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10784 if (new_item)
10785 {
10786 new_item.SetResultOfSplit(true);
10787 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10789 new_item.
SetQuantity(split_quantity_new,
false,
true);
10790 }
10791 }
10792 }
10793 }
10794
10796 {
10798 {
10799 if (ScriptInputUserData.CanStoreInputUserData())
10800 {
10801 ScriptInputUserData ctx = new ScriptInputUserData;
10806 ItemBase destination_entity =
this;
10807 ctx.
Write(destination_entity);
10811 }
10812 }
10813 else if (!
g_Game.IsMultiplayer())
10814 {
10816 }
10817 }
10818
10820 {
10822 float split_quantity_new;
10824 if (player)
10825 {
10827 if (quantity > stackable)
10828 split_quantity_new = stackable;
10829 else
10830 split_quantity_new = quantity;
10831
10833 {
10834 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10835 new_item =
ItemBase.Cast(in_hands);
10836 if (new_item)
10837 {
10838 new_item.SetResultOfSplit(true);
10839 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10841 new_item.SetQuantity(split_quantity_new, false, true);
10842 }
10843 }
10844 }
10845 }
10846
10848 {
10850 float split_quantity_new = Math.Floor(quantity * 0.5);
10851
10853 return;
10854
10856
10857 if (new_item)
10858 {
10859 if (new_item.GetQuantityMax() < split_quantity_new)
10860 {
10861 split_quantity_new = new_item.GetQuantityMax();
10862 }
10863
10864 new_item.SetResultOfSplit(true);
10865 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10866
10868 {
10871 }
10872 else
10873 {
10875 new_item.
SetQuantity(split_quantity_new,
false,
true);
10876 }
10877 }
10878 }
10879
10881 {
10883 float split_quantity_new = Math.Floor(quantity / 2);
10884
10886 return;
10887
10888 InventoryLocation invloc = new InventoryLocation;
10890
10892 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10893
10894 if (new_item)
10895 {
10896 if (new_item.GetQuantityMax() < split_quantity_new)
10897 {
10898 split_quantity_new = new_item.GetQuantityMax();
10899 }
10901 {
10904 }
10905 else if (split_quantity_new > 1)
10906 {
10908 new_item.
SetQuantity(split_quantity_new,
false,
true);
10909 }
10910 }
10911 }
10912
10915 {
10916 SetWeightDirty();
10918
10919 if (parent)
10920 parent.OnAttachmentQuantityChangedEx(this, delta);
10921
10923 {
10925 {
10927 }
10929 {
10930 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10932 }
10933 }
10934 }
10935
10938 {
10939
10940 }
10941
10944 {
10946 }
10947
10949 {
10950 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10951
10953 {
10954 if (newLevel == GameConstants.STATE_RUINED)
10955 {
10957 EntityAI parent = GetHierarchyParent();
10958 if (parent && parent.IsFireplace())
10959 {
10960 CargoBase cargo = GetInventory().GetCargo();
10961 if (cargo)
10962 {
10964 {
10966 }
10967 }
10968 }
10969 }
10970
10972 {
10973
10975 return;
10976 }
10977
10978 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10979 {
10981 }
10982 }
10983 }
10984
10985
10987 {
10988 super.OnRightClick();
10989
10991 {
10993 {
10994 if (ScriptInputUserData.CanStoreInputUserData())
10995 {
10996 EntityAI root = GetHierarchyRoot();
10997 Man playerOwner = GetHierarchyRootPlayer();
10998 InventoryLocation dst = new InventoryLocation;
10999
11000
11001 if (!playerOwner && root && root == this)
11002 {
11004 }
11005 else
11006 {
11007
11008 GetInventory().GetCurrentInventoryLocation(dst);
11010 {
11011 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11013 {
11015 }
11016 else
11017 {
11019
11020
11021 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11022 {
11024 }
11025 else
11026 {
11027 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11028 }
11029 }
11030 }
11031 }
11032
11033 ScriptInputUserData ctx = new ScriptInputUserData;
11041 }
11042 }
11043 else if (!
g_Game.IsMultiplayer())
11044 {
11046 }
11047 }
11048 }
11049
11051 {
11052 if (root)
11053 {
11054 vector m4[4];
11055 root.GetTransform(m4);
11056 dst.SetGround(this, m4);
11057 }
11058 else
11059 {
11060 GetInventory().GetCurrentInventoryLocation(dst);
11061 }
11062 }
11063
11064 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11065 {
11066
11067 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11068 return false;
11069
11070 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11071 return false;
11072
11073
11075 return false;
11076
11077
11078 Magazine mag = Magazine.Cast(this);
11079 if (mag)
11080 {
11081 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11082 return false;
11083
11084 if (stack_max_limit)
11085 {
11086 Magazine other_mag = Magazine.Cast(other_item);
11087 if (other_item)
11088 {
11089 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11090 return false;
11091 }
11092
11093 }
11094 }
11095 else
11096 {
11097
11099 return false;
11100
11102 return false;
11103 }
11104
11105 PlayerBase player = null;
11106 if (CastTo(player, GetHierarchyRootPlayer()))
11107 {
11108 if (player.GetInventory().HasAttachment(this))
11109 return false;
11110
11111 if (player.IsItemsToDelete())
11112 return false;
11113 }
11114
11115 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11116 return false;
11117
11118 int slotID;
11120 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11121 return false;
11122
11123 return true;
11124 }
11125
11127 {
11129 }
11130
11132 {
11133 return m_IsResultOfSplit;
11134 }
11135
11137 {
11138 m_IsResultOfSplit = value;
11139 }
11140
11142 {
11144 }
11145
11147 {
11148 float other_item_quantity = other_item.GetQuantity();
11149 float this_free_space;
11150
11152
11154
11155 if (other_item_quantity > this_free_space)
11156 {
11157 return this_free_space;
11158 }
11159 else
11160 {
11161 return other_item_quantity;
11162 }
11163 }
11164
11166 {
11168 }
11169
11171 {
11173 return;
11174
11175 if (!IsMagazine() && other_item)
11176 {
11178 if (quantity_used != 0)
11179 {
11180 float hp1 = GetHealth01("","");
11181 float hp2 = other_item.GetHealth01("","");
11182 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11183 hpResult = hpResult / (
GetQuantity() + quantity_used);
11184
11185 hpResult *= GetMaxHealth();
11186 Math.Round(hpResult);
11187 SetHealth("", "Health", hpResult);
11188
11190 other_item.AddQuantity(-quantity_used);
11191 }
11192 }
11194 }
11195
11197 {
11198 #ifdef SERVER
11199 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11200 GetHierarchyParent().IncreaseLifetimeUp();
11201 #endif
11202 };
11203
11205 {
11206 PlayerBase p = PlayerBase.Cast(player);
11207
11208 array<int> recipesIds = p.m_Recipes;
11209 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11210 if (moduleRecipesManager)
11211 {
11212 EntityAI itemInHands = player.GetEntityInHands();
11213 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11214 }
11215
11216 for (int i = 0;i < recipesIds.Count(); i++)
11217 {
11218 int key = recipesIds.Get(i);
11219 string recipeName = moduleRecipesManager.GetRecipeName(key);
11221 }
11222 }
11223
11224
11225 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11226 {
11227 super.GetDebugActions(outputList);
11228
11229
11235
11236
11241
11246
11247
11251
11252
11254 {
11258 }
11259
11262
11263
11267
11269
11270 InventoryLocation loc = new InventoryLocation();
11271 GetInventory().GetCurrentInventoryLocation(loc);
11273 {
11274 if (Gizmo_IsSupported())
11277 }
11278
11280 }
11281
11282
11283
11284
11286 {
11287 super.OnAction(action_id, player, ctx);
11288
11290 {
11291 switch (action_id)
11292 {
11296 return true;
11300 return true;
11301 }
11302 }
11303
11305 {
11306 switch (action_id)
11307 {
11309 Delete();
11310 return true;
11311 }
11312 }
11313
11314 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11315 {
11316 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11317 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11318 PlayerBase p = PlayerBase.Cast(player);
11319 if (
EActions.RECIPES_RANGE_START < 1000)
11320 {
11321 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11322 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11323 }
11324 }
11325 #ifndef SERVER
11326 else if (action_id ==
EActions.WATCH_PLAYER)
11327 {
11328 PluginDeveloper.SetDeveloperItemClientEx(player);
11329 }
11330 #endif
11332 {
11333 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11334 {
11335 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11336 OnDebugButtonPressServer(id + 1);
11337 }
11338
11339 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11340 {
11341 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11343 }
11344
11345 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11346 {
11347 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11349 }
11350
11351 else if (action_id ==
EActions.ADD_QUANTITY)
11352 {
11353 if (IsMagazine())
11354 {
11355 Magazine mag = Magazine.Cast(this);
11356 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11357 }
11358 else
11359 {
11361 }
11362
11363 if (m_EM)
11364 {
11365 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11366 }
11367
11368 }
11369
11370 else if (action_id ==
EActions.REMOVE_QUANTITY)
11371 {
11372 if (IsMagazine())
11373 {
11374 Magazine mag2 = Magazine.Cast(this);
11375 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11376 }
11377 else
11378 {
11380 }
11381 if (m_EM)
11382 {
11383 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11384 }
11385
11386 }
11387
11388 else if (action_id ==
EActions.SET_QUANTITY_0)
11389 {
11391
11392 if (m_EM)
11393 {
11394 m_EM.SetEnergy(0);
11395 }
11396 }
11397
11398 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11399 {
11401
11402 if (m_EM)
11403 {
11404 m_EM.SetEnergy(m_EM.GetEnergyMax());
11405 }
11406 }
11407
11408 else if (action_id ==
EActions.ADD_HEALTH)
11409 {
11410 AddHealth("","",GetMaxHealth("","Health")/5);
11411 }
11412 else if (action_id ==
EActions.REMOVE_HEALTH)
11413 {
11414 AddHealth("","",-GetMaxHealth("","Health")/5);
11415 }
11416 else if (action_id ==
EActions.DESTROY_HEALTH)
11417 {
11418 SetHealth01("","",0);
11419 }
11420 else if (action_id ==
EActions.WATCH_ITEM)
11421 {
11423 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11424 #ifdef DEVELOPER
11425 SetDebugDeveloper_item(this);
11426 #endif
11427 }
11428
11429 else if (action_id ==
EActions.ADD_TEMPERATURE)
11430 {
11431 AddTemperature(20);
11432
11433 }
11434
11435 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11436 {
11437 AddTemperature(-20);
11438
11439 }
11440
11441 else if (action_id ==
EActions.FLIP_FROZEN)
11442 {
11443 SetFrozen(!GetIsFrozen());
11444
11445 }
11446
11447 else if (action_id ==
EActions.ADD_WETNESS)
11448 {
11450
11451 }
11452
11453 else if (action_id ==
EActions.REMOVE_WETNESS)
11454 {
11456
11457 }
11458
11459 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11460 {
11463
11464
11465 }
11466
11467 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11468 {
11471 }
11472
11473 else if (action_id ==
EActions.MAKE_SPECIAL)
11474 {
11475 auto debugParams = DebugSpawnParams.WithPlayer(player);
11476 OnDebugSpawnEx(debugParams);
11477 }
11478
11479 }
11480
11481
11482 return false;
11483 }
11484
11485
11486
11487
11491
11494
11495
11496
11498 {
11499 return false;
11500 }
11501
11502
11504 {
11505 return true;
11506 }
11507
11508
11510 {
11511 return true;
11512 }
11513
11514
11515
11517 {
11518 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11519 return g_Game.ConfigIsExisting(config_path);
11520 }
11521
11524 {
11525 return null;
11526 }
11527
11529 {
11530 return false;
11531 }
11532
11534 {
11535 return false;
11536 }
11537
11541
11542
11544 {
11545 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11546 return module_repairing.CanRepair(this, item_repair_kit);
11547 }
11548
11549
11550 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11551 {
11552 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11553 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11554 }
11555
11556
11558 {
11559
11560
11561
11562
11563
11564
11565
11566
11567 return 1;
11568 }
11569
11570
11571
11573 {
11575 }
11576
11577
11578
11580 {
11582 }
11583
11584
11593 {
11594 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11595
11596 if (player)
11597 {
11598 player.MessageStatus(text);
11599 }
11600 }
11601
11602
11611 {
11612 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11613
11614 if (player)
11615 {
11616 player.MessageAction(text);
11617 }
11618 }
11619
11620
11629 {
11630 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11631
11632 if (player)
11633 {
11634 player.MessageFriendly(text);
11635 }
11636 }
11637
11638
11647 {
11648 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11649
11650 if (player)
11651 {
11652 player.MessageImportant(text);
11653 }
11654 }
11655
11657 {
11658 return true;
11659 }
11660
11661
11662 override bool KindOf(
string tag)
11663 {
11664 bool found = false;
11665 string item_name = this.
GetType();
11667 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11668
11669 int array_size = item_tag_array.Count();
11670 for (int i = 0; i < array_size; i++)
11671 {
11672 if (item_tag_array.Get(i) == tag)
11673 {
11674 found = true;
11675 break;
11676 }
11677 }
11678 return found;
11679 }
11680
11681
11683 {
11684
11685 super.OnRPC(sender, rpc_type,ctx);
11686
11687
11688 switch (rpc_type)
11689 {
11690 #ifndef SERVER
11691 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11692 Param2<bool, string> p = new Param2<bool, string>(false, "");
11693
11695 return;
11696
11697 bool play = p.param1;
11698 string soundSet = p.param2;
11699
11700 if (play)
11701 {
11703 {
11705 {
11707 }
11708 }
11709 else
11710 {
11712 }
11713 }
11714 else
11715 {
11717 }
11718
11719 break;
11720 #endif
11721
11722 }
11723
11725 {
11727 }
11728 }
11729
11730
11731
11732
11734 {
11735 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11736 return plugin.GetID(
name);
11737 }
11738
11740 {
11741 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11742 return plugin.GetName(id);
11743 }
11744
11747 {
11748
11749
11750 int varFlags;
11751 if (!ctx.
Read(varFlags))
11752 return;
11753
11754 if (varFlags & ItemVariableFlags.FLOAT)
11755 {
11757 }
11758 }
11759
11761 {
11762
11763 super.SerializeNumericalVars(floats_out);
11764
11765
11766
11768 {
11770 }
11771
11773 {
11775 }
11776
11778 {
11780 }
11781
11783 {
11788 }
11789
11791 {
11793 }
11794 }
11795
11797 {
11798
11799 super.DeSerializeNumericalVars(floats);
11800
11801
11802 int index = 0;
11803 int mask = Math.Round(floats.Get(index));
11804
11805 index++;
11806
11808 {
11810 {
11812 }
11813 else
11814 {
11815 float quantity = floats.Get(index);
11816 SetQuantity(quantity,
true,
false,
false,
false);
11817 }
11818 index++;
11819 }
11820
11822 {
11823 float wet = floats.Get(index);
11825 index++;
11826 }
11827
11829 {
11830 int liquidtype = Math.Round(floats.Get(index));
11832 index++;
11833 }
11834
11836 {
11838 index++;
11840 index++;
11842 index++;
11844 index++;
11845 }
11846
11848 {
11849 int cleanness = Math.Round(floats.Get(index));
11851 index++;
11852 }
11853 }
11854
11856 {
11857 super.WriteVarsToCTX(ctx);
11858
11859
11861 {
11863 }
11864
11866 {
11868 }
11869
11871 {
11873 }
11874
11876 {
11877 int r,g,b,a;
11883 }
11884
11886 {
11888 }
11889 }
11890
11892 {
11893 if (!super.ReadVarsFromCTX(ctx,version))
11894 return false;
11895
11896 int intValue;
11897 float value;
11898
11899 if (version < 140)
11900 {
11901 if (!ctx.
Read(intValue))
11902 return false;
11903
11904 m_VariablesMask = intValue;
11905 }
11906
11908 {
11909 if (!ctx.
Read(value))
11910 return false;
11911
11913 {
11915 }
11916 else
11917 {
11919 }
11920 }
11921
11922 if (version < 140)
11923 {
11925 {
11926 if (!ctx.
Read(value))
11927 return false;
11928 SetTemperatureDirect(value);
11929 }
11930 }
11931
11933 {
11934 if (!ctx.
Read(value))
11935 return false;
11937 }
11938
11940 {
11941 if (!ctx.
Read(intValue))
11942 return false;
11944 }
11945
11947 {
11948 int r,g,b,a;
11950 return false;
11952 return false;
11954 return false;
11956 return false;
11957
11959 }
11960
11962 {
11963 if (!ctx.
Read(intValue))
11964 return false;
11966 }
11967
11968 if (version >= 138 && version < 140)
11969 {
11971 {
11972 if (!ctx.
Read(intValue))
11973 return false;
11974 SetFrozen(intValue);
11975 }
11976 }
11977
11978 return true;
11979 }
11980
11981
11983 {
11986 {
11988 }
11989
11990 if (!super.OnStoreLoad(ctx, version))
11991 {
11993 return false;
11994 }
11995
11996 if (version >= 114)
11997 {
11998 bool hasQuickBarIndexSaved;
11999
12000 if (!ctx.
Read(hasQuickBarIndexSaved))
12001 {
12003 return false;
12004 }
12005
12006 if (hasQuickBarIndexSaved)
12007 {
12008 int itmQBIndex;
12009
12010
12011 if (!ctx.
Read(itmQBIndex))
12012 {
12014 return false;
12015 }
12016
12017 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12018 if (itmQBIndex != -1 && parentPlayer)
12019 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12020 }
12021 }
12022 else
12023 {
12024
12025 PlayerBase player;
12026 int itemQBIndex;
12027 if (version ==
int.
MAX)
12028 {
12029 if (!ctx.
Read(itemQBIndex))
12030 {
12032 return false;
12033 }
12034 }
12035 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12036 {
12037
12038 if (!ctx.
Read(itemQBIndex))
12039 {
12041 return false;
12042 }
12043 if (itemQBIndex != -1 && player)
12044 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12045 }
12046 }
12047
12048 if (version < 140)
12049 {
12050
12051 if (!LoadVariables(ctx, version))
12052 {
12054 return false;
12055 }
12056 }
12057
12058
12060 {
12062 return false;
12063 }
12064 if (version >= 132)
12065 {
12067 if (raib)
12068 {
12070 {
12072 return false;
12073 }
12074 }
12075 }
12076
12078 return true;
12079 }
12080
12081
12082
12084 {
12085 super.OnStoreSave(ctx);
12086
12087 PlayerBase player;
12088 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12089 {
12091
12092 int itemQBIndex = -1;
12093 itemQBIndex = player.FindQuickBarEntityIndex(this);
12094 ctx.
Write(itemQBIndex);
12095 }
12096 else
12097 {
12099 }
12100
12102
12104 if (raib)
12105 {
12107 }
12108 }
12109
12110
12112 {
12113 super.AfterStoreLoad();
12114
12116 {
12118 }
12119
12121 {
12124 }
12125 }
12126
12128 {
12129 super.EEOnAfterLoad();
12130
12132 {
12134 }
12135
12138 }
12139
12141 {
12142 return false;
12143 }
12144
12145
12146
12148 {
12150 {
12151 #ifdef PLATFORM_CONSOLE
12152
12154 {
12156 if (menu)
12157 {
12159 }
12160 }
12161 #endif
12162 }
12163
12165 {
12168 }
12169
12171 {
12172 SetWeightDirty();
12174 }
12176 {
12179 }
12180
12182 {
12185
12188 }
12190 {
12194 }
12195
12196 super.OnVariablesSynchronized();
12197 }
12198
12199
12200
12202 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12203 {
12204 if (!IsServerCheck(allow_client))
12205 return false;
12206
12208 return false;
12209
12212
12213 if (value <= (min + 0.001))
12214 value = min;
12215
12216 if (value == min)
12217 {
12218 if (destroy_config)
12219 {
12220 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12221 if (dstr)
12222 {
12224 this.Delete();
12225 return true;
12226 }
12227 }
12228 else if (destroy_forced)
12229 {
12231 this.Delete();
12232 return true;
12233 }
12234
12236 }
12237
12240
12242 {
12243 EntityAI parent = GetHierarchyRoot();
12244 InventoryLocation iLoc = new InventoryLocation();
12245 GetInventory().GetCurrentInventoryLocation(iLoc);
12247 {
12248 int iLocSlot = iLoc.
GetSlot();
12250 {
12252 }
12254 {
12256 }
12257 }
12258 }
12259
12261 {
12263
12264 if (delta)
12266 }
12267
12269
12270 return false;
12271 }
12272
12273
12275 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12276 {
12278 }
12279
12281 {
12284 }
12285
12287 {
12290 }
12291
12293 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12294 {
12295 float value_clamped = Math.Clamp(value, 0, 1);
12297 SetQuantity(result, destroy_config, destroy_forced);
12298 }
12299
12300
12303 {
12305 }
12306
12308 {
12310 }
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12322 {
12323 int slot = -1;
12324 GameInventory inventory = GetInventory();
12325 if (inventory)
12326 {
12327 InventoryLocation il = new InventoryLocation;
12330 }
12331
12333 }
12334
12336 {
12337 float quantity_max = 0;
12338
12340 {
12341 if (attSlotID != -1)
12342 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12343
12344 if (quantity_max <= 0)
12346 }
12347
12348 if (quantity_max <= 0)
12350
12351 return quantity_max;
12352 }
12353
12355 {
12357 }
12358
12360 {
12362 }
12363
12364
12366 {
12368 }
12369
12371 {
12373 }
12374
12376 {
12378 }
12379
12380
12382 {
12383
12384 float weightEx = GetWeightEx();
12385 float special = GetInventoryAndCargoWeight();
12386 return weightEx - special;
12387 }
12388
12389
12391 {
12393 }
12394
12396 {
12398 {
12399 #ifdef DEVELOPER
12400 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12401 {
12402 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12404 }
12405 #endif
12406
12407 return GetQuantity() * GetConfigWeightModified();
12408 }
12409 else if (HasEnergyManager())
12410 {
12411 #ifdef DEVELOPER
12412 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12413 {
12414 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12415 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12416 }
12417 #endif
12418 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12419 }
12420 else
12421 {
12422 #ifdef DEVELOPER
12423 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12424 {
12425 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12426 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12427 }
12428 #endif
12429 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12430 }
12431 }
12432
12435 {
12436 int item_count = 0;
12438
12439 GameInventory inventory = GetInventory();
12440 CargoBase cargo = inventory.
GetCargo();
12441 if (cargo != NULL)
12442 {
12444 }
12445
12447 for (int i = 0; i < nAttachments; ++i)
12448 {
12450 if (item)
12451 item_count += item.GetNumberOfItems();
12452 }
12453 return item_count;
12454 }
12455
12458 {
12459 float weight = 0;
12460 float wetness = 1;
12461 if (include_wetness)
12464 {
12465 weight = wetness * m_ConfigWeight;
12466 }
12468 {
12469 weight = 1;
12470 }
12471 return weight;
12472 }
12473
12474
12475
12477 {
12478 GameInventory inventory = GetInventory();
12479 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12480 {
12481 array<EntityAI> items = new array<EntityAI>;
12483 for (int i = 0; i < items.Count(); ++i)
12484 {
12486 if (item)
12487 {
12488 g_Game.ObjectDelete(item);
12489 }
12490 }
12491 }
12492 }
12493
12494
12495
12496
12498 {
12499 float energy = 0;
12500 if (HasEnergyManager())
12501 {
12502 energy = GetCompEM().GetEnergy();
12503 }
12504 return energy;
12505 }
12506
12507
12509 {
12510 super.OnEnergyConsumed();
12511
12513 }
12514
12516 {
12517 super.OnEnergyAdded();
12518
12520 }
12521
12522
12524 {
12525 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12526 {
12528 {
12529 float energy_0to1 = GetCompEM().GetEnergy0To1();
12531 }
12532 }
12533 }
12534
12535
12537 {
12538 return ConfigGetFloat("heatIsolation");
12539 }
12540
12542 {
12544 }
12545
12547 {
12548 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12549 if (
g_Game.ConfigIsExisting(paramPath))
12550 return g_Game.ConfigGetFloat(paramPath);
12551
12552 return 0.0;
12553 }
12554
12556 {
12557 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12558 if (
g_Game.ConfigIsExisting(paramPath))
12559 return g_Game.ConfigGetFloat(paramPath);
12560
12561 return 0.0;
12562 }
12563
12564 override void SetWet(
float value,
bool allow_client =
false)
12565 {
12566 if (!IsServerCheck(allow_client))
12567 return;
12568
12571
12573
12574 m_VarWet = Math.Clamp(value, min, max);
12575
12577 {
12580 }
12581 }
12582
12583 override void AddWet(
float value)
12584 {
12586 }
12587
12589 {
12591 }
12592
12594 {
12596 }
12597
12599 {
12601 }
12602
12604 {
12606 }
12607
12609 {
12611 }
12612
12613 override void OnWetChanged(
float newVal,
float oldVal)
12614 {
12617 if (newLevel != oldLevel)
12618 {
12620 }
12621 }
12622
12624 {
12625 SetWeightDirty();
12626 }
12627
12629 {
12630 return GetWetLevelInternal(
m_VarWet);
12631 }
12632
12633
12634
12636 {
12638 }
12639
12641 {
12643 }
12644
12646 {
12648 }
12649
12651 {
12653 }
12654
12655
12656
12658 {
12659 if (ConfigIsExisting("itemModelLength"))
12660 {
12661 return ConfigGetFloat("itemModelLength");
12662 }
12663 return 0;
12664 }
12665
12667 {
12668 if (ConfigIsExisting("itemAttachOffset"))
12669 {
12670 return ConfigGetFloat("itemAttachOffset");
12671 }
12672 return 0;
12673 }
12674
12675 override void SetCleanness(
int value,
bool allow_client =
false)
12676 {
12677 if (!IsServerCheck(allow_client))
12678 return;
12679
12681
12683
12686 }
12687
12689 {
12691 }
12692
12694 {
12695 return true;
12696 }
12697
12698
12699
12700
12702 {
12704 }
12705
12707 {
12709 }
12710
12711
12712
12713
12714 override void SetColor(
int r,
int g,
int b,
int a)
12715 {
12721 }
12723 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12724 {
12729 }
12730
12732 {
12734 }
12735
12738 {
12739 int r,g,b,a;
12741 r = r/255;
12742 g = g/255;
12743 b = b/255;
12744 a = a/255;
12745 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12746 }
12747
12748
12749
12750 override void SetLiquidType(
int value,
bool allow_client =
false)
12751 {
12752 if (!IsServerCheck(allow_client))
12753 return;
12754
12759 }
12760
12762 {
12763 return ConfigGetInt("varLiquidTypeInit");
12764 }
12765
12767 {
12769 }
12770
12772 {
12774 SetFrozen(false);
12775 }
12776
12779 {
12780 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12781 }
12782
12783
12786 {
12787 PlayerBase nplayer;
12788 if (PlayerBase.CastTo(nplayer, player))
12789 {
12791 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12792 }
12793 }
12794
12795
12798 {
12799 PlayerBase nplayer;
12800 if (PlayerBase.CastTo(nplayer,player))
12801 {
12802 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12803 }
12804
12805 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12806
12807 if (HasEnergyManager())
12808 {
12809 GetCompEM().UpdatePlugState();
12810 }
12811 }
12812
12813
12815 {
12816 super.OnPlacementStarted(player);
12817
12819 }
12820
12821 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12822 {
12824 {
12825 m_AdminLog.OnPlacementComplete(player,
this);
12826 }
12827
12828 super.OnPlacementComplete(player, position, orientation);
12829 }
12830
12831
12832
12833
12834
12836 {
12838 {
12839 return true;
12840 }
12841 else
12842 {
12843 return false;
12844 }
12845 }
12846
12847
12849 {
12851 {
12853 }
12854 }
12855
12856
12858 {
12860 }
12861
12863 {
12865 }
12866
12867 override void InsertAgent(
int agent,
float count = 1)
12868 {
12869 if (count < 1)
12870 return;
12871
12873 }
12874
12877 {
12879 }
12880
12881
12883 {
12885 }
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12929 {
12931 return false;
12932 return true;
12933 }
12934
12936 {
12937
12939 }
12940
12941
12944 {
12945 super.CheckForRoofLimited(timeTresholdMS);
12946
12947 float time =
g_Game.GetTime();
12948 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12949 {
12950 m_PreviousRoofTestTime = time;
12951 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12952 }
12953 }
12954
12955
12957 {
12959 {
12960 return 0;
12961 }
12962
12963 if (GetInventory().GetAttachmentSlotsCount() != 0)
12964 {
12965 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12966 if (filter)
12967 return filter.GetProtectionLevel(type, false, system);
12968 else
12969 return 0;
12970 }
12971
12972 string subclassPath, entryName;
12973
12974 switch (type)
12975 {
12977 entryName = "biological";
12978 break;
12980 entryName = "chemical";
12981 break;
12982 default:
12983 entryName = "biological";
12984 break;
12985 }
12986
12987 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12988
12989 return g_Game.ConfigGetFloat(subclassPath + entryName);
12990 }
12991
12992
12993
12996 {
12997 if (!IsMagazine())
12999
13001 }
13002
13003
13004
13005
13006
13011 {
13012 return true;
13013 }
13014
13016 {
13018 }
13019
13020
13021
13022
13023
13025 {
13026 if (parent)
13027 {
13028 if (parent.IsInherited(DayZInfected))
13029 return true;
13030
13031 if (!parent.IsRuined())
13032 return true;
13033 }
13034
13035 return true;
13036 }
13037
13039 {
13040 if (!super.CanPutAsAttachment(parent))
13041 {
13042 return false;
13043 }
13044
13045 if (!IsRuined() && !parent.IsRuined())
13046 {
13047 return true;
13048 }
13049
13050 return false;
13051 }
13052
13054 {
13055
13056
13057
13058
13059 return super.CanReceiveItemIntoCargo(item);
13060 }
13061
13063 {
13064
13065
13066
13067
13068 GameInventory attachmentInv = attachment.GetInventory();
13070 {
13071 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13072 return false;
13073 }
13074
13075 InventoryLocation loc = new InventoryLocation();
13076 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13077 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13078 return false;
13079
13080 return super.CanReceiveAttachment(attachment, slotId);
13081 }
13082
13084 {
13085 if (!super.CanReleaseAttachment(attachment))
13086 return false;
13087
13088 return GetInventory().AreChildrenAccessible();
13089 }
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13112 {
13113 int id = muzzle_owner.GetMuzzleID();
13114 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13115
13116 if (WPOF_array)
13117 {
13118 for (int i = 0; i < WPOF_array.Count(); i++)
13119 {
13120 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13121
13122 if (WPOF)
13123 {
13124 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13125 }
13126 }
13127 }
13128 }
13129
13130
13132 {
13133 int id = muzzle_owner.GetMuzzleID();
13135
13136 if (WPOBE_array)
13137 {
13138 for (int i = 0; i < WPOBE_array.Count(); i++)
13139 {
13140 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13141
13142 if (WPOBE)
13143 {
13144 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13145 }
13146 }
13147 }
13148 }
13149
13150
13152 {
13153 int id = muzzle_owner.GetMuzzleID();
13154 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13155
13156 if (WPOOH_array)
13157 {
13158 for (int i = 0; i < WPOOH_array.Count(); i++)
13159 {
13160 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13161
13162 if (WPOOH)
13163 {
13164 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13165 }
13166 }
13167 }
13168 }
13169
13170
13172 {
13173 int id = muzzle_owner.GetMuzzleID();
13174 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13175
13176 if (WPOOH_array)
13177 {
13178 for (int i = 0; i < WPOOH_array.Count(); i++)
13179 {
13180 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13181
13182 if (WPOOH)
13183 {
13184 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13185 }
13186 }
13187 }
13188 }
13189
13190
13192 {
13193 int id = muzzle_owner.GetMuzzleID();
13194 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13195
13196 if (WPOOH_array)
13197 {
13198 for (int i = 0; i < WPOOH_array.Count(); i++)
13199 {
13200 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13201
13202 if (WPOOH)
13203 {
13204 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13205 }
13206 }
13207 }
13208 }
13209
13210
13211
13213 {
13215 {
13216 return true;
13217 }
13218
13219 return false;
13220 }
13221
13223 {
13225 {
13226 return true;
13227 }
13228
13229 return false;
13230 }
13231
13233 {
13235 {
13236 return true;
13237 }
13238
13239 return false;
13240 }
13241
13243 {
13244 return false;
13245 }
13246
13249 {
13250 return UATimeSpent.DEFAULT_DEPLOY;
13251 }
13252
13253
13254
13255
13257 {
13259 SetSynchDirty();
13260 }
13261
13263 {
13265 }
13266
13267
13269 {
13270 return false;
13271 }
13272
13275 {
13276 string att_type = "None";
13277
13278 if (ConfigIsExisting("soundAttType"))
13279 {
13280 att_type = ConfigGetString("soundAttType");
13281 }
13282
13284 }
13285
13287 {
13289 }
13290
13291
13292
13293
13294
13300
13302 {
13305
13307 }
13308
13309
13311 {
13313 return;
13314
13316
13319
13322
13323 SoundParameters params = new SoundParameters();
13327 }
13328
13329
13331 {
13333 {
13336
13337 SetSynchDirty();
13338
13341 }
13342 }
13343
13345 {
13347 }
13348
13349
13351 {
13353 return;
13354
13356 SetSynchDirty();
13357
13360 }
13361
13363 {
13366 }
13367
13369 {
13371 }
13372
13373 void OnApply(PlayerBase player);
13374
13376 {
13377 return 1.0;
13378 };
13379
13381 {
13383 }
13384
13386 {
13388 }
13389
13391
13393 {
13394 SetDynamicPhysicsLifeTime(0.01);
13396 }
13397
13399 {
13400 array<string> zone_names = new array<string>;
13401 GetDamageZones(zone_names);
13402 for (int i = 0; i < zone_names.Count(); i++)
13403 {
13404 SetHealthMax(zone_names.Get(i),"Health");
13405 }
13406 SetHealthMax("","Health");
13407 }
13408
13411 {
13412 float global_health = GetHealth01("","Health");
13413 array<string> zones = new array<string>;
13414 GetDamageZones(zones);
13415
13416 for (int i = 0; i < zones.Count(); i++)
13417 {
13418 SetHealth01(zones.Get(i),"Health",global_health);
13419 }
13420 }
13421
13424 {
13425 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13426 }
13427
13429 {
13430 if (!hasRootAsPlayer)
13431 {
13432 if (refParentIB)
13433 {
13434
13435 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13436 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13437
13438 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13439 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13440
13443 }
13444 else
13445 {
13446
13449 }
13450 }
13451 }
13452
13454 {
13456 {
13457 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13458 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13459 {
13460 float heatPermCoef = 1.0;
13462 while (ent)
13463 {
13464 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13465 ent = ent.GetHierarchyParent();
13466 }
13467
13468 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13469 }
13470 }
13471 }
13472
13474 {
13475
13476 EntityAI parent = GetHierarchyParent();
13477 if (!parent)
13478 {
13479 hasParent = false;
13480 hasRootAsPlayer = false;
13481 }
13482 else
13483 {
13484 hasParent = true;
13485 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13486 refParentIB =
ItemBase.Cast(parent);
13487 }
13488 }
13489
13490 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13491 {
13492
13493 }
13494
13496 {
13497
13498 return false;
13499 }
13500
13502 {
13503
13504
13505 return false;
13506 }
13507
13509 {
13510
13511 return false;
13512 }
13513
13516 {
13517 return !GetIsFrozen() &&
IsOpen();
13518 }
13519
13521 {
13522 bool hasParent = false, hasRootAsPlayer = false;
13524
13525 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13526 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13527
13528 if (wwtu || foodDecay)
13529 {
13533
13534 if (processWetness || processTemperature || processDecay)
13535 {
13537
13538 if (processWetness)
13539 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13540
13541 if (processTemperature)
13543
13544 if (processDecay)
13545 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13546 }
13547 }
13548 }
13549
13552 {
13554 }
13555
13557 {
13560
13561 return super.GetTemperatureFreezeThreshold();
13562 }
13563
13565 {
13568
13569 return super.GetTemperatureThawThreshold();
13570 }
13571
13573 {
13576
13577 return super.GetItemOverheatThreshold();
13578 }
13579
13581 {
13583 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13584
13585 return super.GetTemperatureFreezeTime();
13586 }
13587
13589 {
13591 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13592
13593 return super.GetTemperatureThawTime();
13594 }
13595
13600
13602 {
13603 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13604 }
13605
13607 {
13608 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13609 }
13610
13613 {
13615 }
13616
13618 {
13620 }
13621
13623 {
13625 }
13626
13629 {
13630 return null;
13631 }
13632
13635 {
13636 return false;
13637 }
13638
13640 {
13642 {
13645 if (!trg)
13646 {
13648 explosive = this;
13649 }
13650
13651 explosive.PairRemote(trg);
13653
13654 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13655 trg.SetPersistentPairID(persistentID);
13656 explosive.SetPersistentPairID(persistentID);
13657
13658 return true;
13659 }
13660 return false;
13661 }
13662
13665 {
13666 float ret = 1.0;
13669 ret *= GetHealth01();
13670
13671 return ret;
13672 }
13673
13674 #ifdef DEVELOPER
13675 override void SetDebugItem()
13676 {
13677 super.SetDebugItem();
13678 _itemBase = this;
13679 }
13680
13682 {
13683 string text = super.GetDebugText();
13684
13686 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13687
13688 return text;
13689 }
13690 #endif
13691
13693 {
13694 return true;
13695 }
13696
13698
13700
13702 {
13705 }
13706
13707
13715
13731
13732 [
Obsolete(
"Use ItemSoundHandler instead")]
13735 {
13736 if (!
g_Game.IsDedicatedServer())
13737 {
13738 if (ConfigIsExisting("attachSoundSet"))
13739 {
13740 string cfg_path = "";
13741 string soundset = "";
13742 string type_name =
GetType();
13743
13746 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13747 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13748
13749 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13750 {
13751 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13752 {
13753 if (cfg_slot_array[i] == slot_type)
13754 {
13755 soundset = cfg_soundset_array[i];
13756 break;
13757 }
13758 }
13759 }
13760
13761 if (soundset != "")
13762 {
13763 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13765 }
13766 }
13767 }
13768 }
13769
13771}
13772
13774{
13776 if (entity)
13777 {
13778 bool is_item = entity.IsInherited(
ItemBase);
13779 if (is_item && full_quantity)
13780 {
13783 }
13784 }
13785 else
13786 {
13788 return NULL;
13789 }
13790 return entity;
13791}
13792
13794{
13795 if (item)
13796 {
13797 if (health > 0)
13798 item.SetHealth("", "", health);
13799
13800 if (item.CanHaveTemperature())
13801 {
13803 if (item.CanFreeze())
13804 item.SetFrozen(false);
13805 }
13806
13807 if (item.HasEnergyManager())
13808 {
13809 if (quantity >= 0)
13810 {
13811 item.GetCompEM().SetEnergy0To1(quantity);
13812 }
13813 else
13814 {
13816 }
13817 }
13818 else if (item.IsMagazine())
13819 {
13820 Magazine mag = Magazine.Cast(item);
13821 if (quantity >= 0)
13822 {
13823 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13824 }
13825 else
13826 {
13828 }
13829
13830 }
13831 else
13832 {
13833 if (quantity >= 0)
13834 {
13835 item.SetQuantityNormalized(quantity, false);
13836 }
13837 else
13838 {
13840 }
13841
13842 }
13843 }
13844}
13845
13846#ifdef DEVELOPER
13848#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.