8915{
8917 {
8918 return true;
8919 }
8920};
8921
8923{
8924
8925};
8926
8927
8928
8930{
8934
8936
8939
8940
8941
8942
8943
8952
8958
8963
8968
8989 protected bool m_IsResultOfSplit
8990
8992
8997
8998
8999
9001
9005
9006
9007
9009
9012
9013
9014
9020
9021
9029
9032
9033
9035
9036
9038
9039
9044
9045
9050
9052
9053
9055
9056
9058 {
9063
9064 if (!
g_Game.IsDedicatedServer())
9065 {
9067 {
9069
9071 {
9073 }
9074 }
9075
9078 }
9079
9080 m_OldLocation = null;
9081
9083 {
9085 }
9086
9087 if (ConfigIsExisting("headSelectionsToHide"))
9088 {
9091 }
9092
9094 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9095 {
9097 }
9098
9100
9101 m_IsResultOfSplit = false;
9102
9104 }
9105
9107 {
9108 super.InitItemVariables();
9109
9115 m_Count = ConfigGetInt(
"count");
9116
9119
9124
9127
9132
9144
9148
9149
9152 if (ConfigIsExisting("canBeSplit"))
9153 {
9156 }
9157
9159 if (ConfigIsExisting("itemBehaviour"))
9161
9162
9165 RegisterNetSyncVariableInt("m_VarLiquidType");
9166 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9167
9168 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9169 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9170 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9171
9172 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9173 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9174 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9175 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9176
9177 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9178 RegisterNetSyncVariableBool("m_IsTakeable");
9179 RegisterNetSyncVariableBool("m_IsHologram");
9180
9183 {
9186 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9187 }
9188
9190
9192 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9194
9196 }
9197
9199 {
9201 }
9202
9204 {
9207 {
9212 }
9213 }
9214
9215 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9216 {
9218 {
9221 }
9222
9224 }
9225
9227 {
9233 }
9234
9236
9238 {
9240
9241 if (!action)
9242 {
9243 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9244 return;
9245 }
9246
9248 if (!ai)
9249 {
9251 return;
9252 }
9253
9255 if (!action_array)
9256 {
9257 action_array = new array<ActionBase_Basic>;
9259 }
9260 if (LogManager.IsActionLogEnable())
9261 {
9262 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9263 }
9264
9265 if (action_array.Find(action) != -1)
9266 {
9267 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9268 }
9269 else
9270 {
9271 action_array.Insert(action);
9272 }
9273 }
9274
9276 {
9277 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9278 ActionBase action = player.GetActionManager().GetAction(actionName);
9281
9282 if (action_array)
9283 {
9284 action_array.RemoveItem(action);
9285 }
9286 }
9287
9288
9289
9291 {
9292 ActionOverrideData overrideData = new ActionOverrideData();
9296
9298 if (!actionMap)
9299 {
9302 }
9303
9304 actionMap.Insert(this.
Type(), overrideData);
9305
9306 }
9307
9309
9311
9312
9314 {
9317
9320
9321 string config_to_search = "CfgVehicles";
9322 string muzzle_owner_config;
9323
9325 {
9326 if (IsInherited(Weapon))
9327 config_to_search = "CfgWeapons";
9328
9329 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9330
9331 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9332
9333 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9334
9335 if (config_OnFire_subclass_count > 0)
9336 {
9337 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9338
9339 for (int i = 0; i < config_OnFire_subclass_count; i++)
9340 {
9341 string particle_class = "";
9342 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9343 string config_OnFire_entry = config_OnFire_class + particle_class;
9344 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9345 WPOF_array.Insert(WPOF);
9346 }
9347
9348
9350 }
9351 }
9352
9354 {
9355 config_to_search = "CfgWeapons";
9356 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9357
9358 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9359
9360 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9361
9362 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9363 {
9364 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9365
9366 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9367 {
9368 string particle_class2 = "";
9369 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9370 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9371 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9372 WPOBE_array.Insert(WPOBE);
9373 }
9374
9375
9377 }
9378 }
9379 }
9380
9381
9383 {
9386
9388 {
9389 string config_to_search = "CfgVehicles";
9390
9391 if (IsInherited(Weapon))
9392 config_to_search = "CfgWeapons";
9393
9394 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9395 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9396
9397 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9398 {
9399
9401
9403 {
9405 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9407 return;
9408 }
9409
9412
9413
9414
9415 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9416 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9417
9418 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9419 {
9420 string particle_class = "";
9421 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9422 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9423 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9424
9425 if (entry_type == CT_CLASS)
9426 {
9427 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9428 WPOOH_array.Insert(WPOF);
9429 }
9430 }
9431
9432
9434 }
9435 }
9436 }
9437
9439 {
9441 }
9442
9444 {
9446 {
9448
9451
9454
9455 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9456 }
9457 }
9458
9460 {
9462 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9463
9465 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9466
9468 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9469
9471 {
9473 }
9474 }
9475
9477 {
9479 }
9480
9482 {
9485 else
9487
9489 {
9492 }
9493 else
9494 {
9497
9500 }
9501
9503 }
9504
9506 {
9508 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9509 }
9510
9512 {
9514 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9516 }
9517
9519 {
9521 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9522 }
9523
9525 {
9528
9529 OverheatingParticle OP = new OverheatingParticle();
9534
9536 }
9537
9539 {
9542
9543 return -1;
9544 }
9545
9547 {
9549 {
9552
9553 for (int i = count; i > 0; --i)
9554 {
9555 int id = i - 1;
9558
9561
9562 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9563 {
9564 if (p)
9565 {
9568 }
9569 }
9570 }
9571 }
9572 }
9573
9575 {
9577 {
9579 {
9580 int id = i - 1;
9582
9583 if (OP)
9584 {
9586
9587 if (p)
9588 {
9590 }
9591
9592 delete OP;
9593 }
9594 }
9595
9598 }
9599 }
9600
9603 {
9604 return 0.0;
9605 }
9606
9607
9609 {
9610 return 250;
9611 }
9612
9614 {
9615 return 0;
9616 }
9617
9620 {
9622 return true;
9623
9624 return false;
9625 }
9626
9629 {
9632
9634 {
9636 }
9637 else
9638 {
9639
9641 }
9642
9644 }
9645
9652 {
9653 return -1;
9654 }
9655
9656
9657
9658
9660 {
9662 {
9663 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9664 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9665
9666 if (r_index >= 0)
9667 {
9668 InventoryLocation r_il = new InventoryLocation;
9669 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9670
9671 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9674 {
9675 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9676 }
9678 {
9679 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9680 }
9681
9682 }
9683
9684 player.GetHumanInventory().ClearUserReservedLocation(this);
9685 }
9686
9689 }
9690
9691
9692
9693
9695 {
9696 return ItemBase.m_DebugActionsMask;
9697 }
9698
9700 {
9701 return ItemBase.m_DebugActionsMask & mask;
9702 }
9703
9705 {
9706 ItemBase.m_DebugActionsMask = mask;
9707 }
9708
9710 {
9711 ItemBase.m_DebugActionsMask |= mask;
9712 }
9713
9715 {
9716 ItemBase.m_DebugActionsMask &= ~mask;
9717 }
9718
9720 {
9722 {
9724 }
9725 else
9726 {
9728 }
9729 }
9730
9731
9733 {
9734 if (GetEconomyProfile())
9735 {
9736 float q_max = GetEconomyProfile().GetQuantityMax();
9737 if (q_max > 0)
9738 {
9739 float q_min = GetEconomyProfile().GetQuantityMin();
9740 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9741
9743 {
9744 ComponentEnergyManager comp = GetCompEM();
9746 {
9748 }
9749 }
9751 {
9753
9754 }
9755
9756 }
9757 }
9758 }
9759
9762 {
9763 EntityAI parent = GetHierarchyParent();
9764
9765 if (parent)
9766 {
9767 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9768 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9769 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9770 }
9771 }
9772
9775 {
9776 EntityAI parent = GetHierarchyParent();
9777
9778 if (parent)
9779 {
9780 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9781 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9782 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9783 }
9784 }
9785
9787 {
9788
9789
9790
9791
9793
9795 {
9796 if (ScriptInputUserData.CanStoreInputUserData())
9797 {
9798 ScriptInputUserData ctx = new ScriptInputUserData;
9804 ctx.
Write(use_stack_max);
9807
9809 {
9810 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9811 }
9812 }
9813 }
9814 else if (!
g_Game.IsMultiplayer())
9815 {
9817 }
9818 }
9819
9821 {
9823 }
9824
9826 {
9828 }
9829
9831 {
9833 }
9834
9836 {
9837
9838 return false;
9839 }
9840
9842 {
9843 return false;
9844 }
9845
9849 {
9850 return false;
9851 }
9852
9854 {
9855 return "";
9856 }
9857
9859
9861 {
9862 return false;
9863 }
9864
9866 {
9867 return true;
9868 }
9869
9870
9871
9873 {
9874 return true;
9875 }
9876
9878 {
9879 return true;
9880 }
9881
9883 {
9884 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9886 }
9887
9889 {
9891 }
9892
9894 {
9896 if (!is_being_placed)
9898 SetSynchDirty();
9899 }
9900
9901
9903
9905 {
9907 }
9908
9910 {
9912 }
9913
9915 {
9916 return 1;
9917 }
9918
9920 {
9921 return false;
9922 }
9923
9925 {
9927 SetSynchDirty();
9928 }
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9965 {
9966 super.OnMovedInsideCargo(container);
9967
9968 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9969 }
9970
9971 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9972 {
9973 super.EEItemLocationChanged(oldLoc, newLoc);
9974
9975 PlayerBase newPlayer = null;
9976 PlayerBase oldPlayer = null;
9977
9978 if (newLoc.GetParent())
9979 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9980
9981 if (oldLoc.GetParent())
9982 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9983
9985 {
9986 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9987
9988 if (rIndex >= 0)
9989 {
9990 InventoryLocation rIl = new InventoryLocation;
9991 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9992
9993 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9996 {
9997 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9998 }
10000 {
10002 }
10003
10004 }
10005 }
10006
10008 {
10009 if (newPlayer)
10010 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10011
10012 if (newPlayer == oldPlayer)
10013 {
10014 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10015 {
10017 {
10018 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10019 {
10020 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10021 }
10022 }
10023 else
10024 {
10025 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10026 }
10027 }
10028
10029 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10030 {
10031 int type = oldLoc.GetType();
10033 {
10034 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10035 }
10037 {
10038 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10039 }
10040 }
10041 if (!m_OldLocation)
10042 {
10043 m_OldLocation = new InventoryLocation;
10044 }
10045 m_OldLocation.Copy(oldLoc);
10046 }
10047 else
10048 {
10049 if (m_OldLocation)
10050 {
10051 m_OldLocation.Reset();
10052 }
10053 }
10054
10055 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10056 }
10057 else
10058 {
10059 if (newPlayer)
10060 {
10061 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10062 if (resIndex >= 0)
10063 {
10064 InventoryLocation il = new InventoryLocation;
10065 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10067 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10070 {
10071 il.
GetParent().GetOnReleaseLock().Invoke(it);
10072 }
10074 {
10076 }
10077
10078 }
10079 }
10081 {
10082
10084 }
10085
10086 if (m_OldLocation)
10087 {
10088 m_OldLocation.Reset();
10089 }
10090 }
10091
10093 {
10094 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10095 }
10096
10098 {
10099 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10100 }
10101 }
10102
10103 override void EOnContact(IEntity other, Contact extra)
10104 {
10106 {
10107 int liquidType = -1;
10109 if (impactSpeed > 0.0)
10110 {
10112 #ifndef SERVER
10114 #else
10116 SetSynchDirty();
10117 #endif
10119 }
10120 }
10121
10122 #ifdef SERVER
10123 if (GetCompEM() && GetCompEM().IsPlugged())
10124 {
10125 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10126 GetCompEM().UnplugThis();
10127 }
10128 #endif
10129 }
10130
10132
10134 {
10136 }
10137
10139 {
10140
10141 }
10142
10144 {
10145 super.OnItemLocationChanged(old_owner, new_owner);
10146
10147 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10148 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10149
10150 if (!relatedPlayer && playerNew)
10151 relatedPlayer = playerNew;
10152
10153 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10154 {
10156 if (actionMgr)
10157 {
10158 ActionBase currentAction = actionMgr.GetRunningAction();
10159 if (currentAction)
10161 }
10162 }
10163
10164 Man ownerPlayerOld = null;
10165 Man ownerPlayerNew = null;
10166
10167 if (old_owner)
10168 {
10169 if (old_owner.
IsMan())
10170 {
10171 ownerPlayerOld = Man.Cast(old_owner);
10172 }
10173 else
10174 {
10175 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10176 }
10177 }
10178 else
10179 {
10181 {
10183
10184 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10185 {
10186 GetCompEM().UnplugThis();
10187 }
10188 }
10189 }
10190
10191 if (new_owner)
10192 {
10193 if (new_owner.
IsMan())
10194 {
10195 ownerPlayerNew = Man.Cast(new_owner);
10196 }
10197 else
10198 {
10199 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10200 }
10201 }
10202
10203 if (ownerPlayerOld != ownerPlayerNew)
10204 {
10205 if (ownerPlayerOld)
10206 {
10207 array<EntityAI> subItemsExit = new array<EntityAI>;
10209 for (int i = 0; i < subItemsExit.Count(); i++)
10210 {
10213 }
10214 }
10215
10216 if (ownerPlayerNew)
10217 {
10218 array<EntityAI> subItemsEnter = new array<EntityAI>;
10220 for (int j = 0; j < subItemsEnter.Count(); j++)
10221 {
10224 }
10225 }
10226 }
10227 else if (ownerPlayerNew != null)
10228 {
10229 PlayerBase nplayer;
10230 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10231 {
10232 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10234 for (int k = 0; k < subItemsUpdate.Count(); k++)
10235 {
10237 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10238 }
10239 }
10240 }
10241
10242 if (old_owner)
10243 old_owner.OnChildItemRemoved(this);
10244 if (new_owner)
10245 new_owner.OnChildItemReceived(this);
10246 }
10247
10248
10250 {
10251 super.EEDelete(parent);
10252 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10253 if (player)
10254 {
10256
10257 if (player.IsAlive())
10258 {
10259 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10260 if (r_index >= 0)
10261 {
10262 InventoryLocation r_il = new InventoryLocation;
10263 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10264
10265 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10268 {
10269 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10270 }
10272 {
10273 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10274 }
10275
10276 }
10277
10278 player.RemoveQuickBarEntityShortcut(this);
10279 }
10280 }
10281 }
10282
10284 {
10285 super.EEKilled(killer);
10286
10289 {
10290 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10291 {
10292 if (IsMagazine())
10293 {
10294 if (Magazine.Cast(this).GetAmmoCount() > 0)
10295 {
10297 }
10298 }
10299 else
10300 {
10302 }
10303 }
10304 }
10305 }
10306
10308 {
10309 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10310
10311 super.OnWasAttached(parent, slot_id);
10312
10315
10318 }
10319
10321 {
10322 super.OnWasDetached(parent, slot_id);
10323
10326
10329 }
10330
10332 {
10333 int idx;
10336
10337 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10338 if (inventory_slots.Count() < 1)
10339 {
10340 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10341 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10342 }
10343 else
10344 {
10345 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10346 }
10347
10348 idx = inventory_slots.Find(slot);
10349 if (idx < 0)
10350 return "";
10351
10352 return attach_types.Get(idx);
10353 }
10354
10356 {
10357 int idx = -1;
10358 string slot;
10359
10362
10363 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10364 if (inventory_slots.Count() < 1)
10365 {
10366 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10367 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10368 }
10369 else
10370 {
10371 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10372 if (detach_types.Count() < 1)
10373 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10374 }
10375
10376 for (int i = 0; i < inventory_slots.Count(); i++)
10377 {
10378 slot = inventory_slots.Get(i);
10379 }
10380
10381 if (slot != "")
10382 {
10383 if (detach_types.Count() == 1)
10384 idx = 0;
10385 else
10386 idx = inventory_slots.Find(slot);
10387 }
10388 if (idx < 0)
10389 return "";
10390
10391 return detach_types.Get(idx);
10392 }
10393
10395 {
10396
10398
10399
10400 float min_time = 1;
10401 float max_time = 3;
10402 float delay = Math.RandomFloat(min_time, max_time);
10403
10404 explode_timer.Run(delay, this, "DoAmmoExplosion");
10405 }
10406
10408 {
10409 Magazine magazine = Magazine.Cast(this);
10410 int pop_sounds_count = 6;
10411 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10412
10413
10414 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10415 string sound_name = pop_sounds[ sound_idx ];
10416 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10417
10418
10419 magazine.ServerAddAmmoCount(-1);
10420
10421
10422 float min_temp_to_explode = 100;
10423
10424 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10425 {
10427 }
10428 }
10429
10430
10431 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10432 {
10433 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10434
10435 const int CHANCE_DAMAGE_CARGO = 4;
10436 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10437 const int CHANCE_DAMAGE_NOTHING = 2;
10438
10440 {
10441 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10442 int chances;
10443 int rnd;
10444
10445 if (GetInventory().GetCargo())
10446 {
10447 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10448 rnd = Math.RandomInt(0,chances);
10449
10450 if (rnd < CHANCE_DAMAGE_CARGO)
10451 {
10453 }
10454 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10455 {
10457 }
10458 }
10459 else
10460 {
10461 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10462 rnd = Math.RandomInt(0,chances);
10463
10464 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10465 {
10467 }
10468 }
10469 }
10470 }
10471
10473 {
10474 CargoBase cargo = GetInventory().GetCargo();
10475 if (cargo)
10476 {
10478 if (item_count > 0)
10479 {
10480 int random_pick = Math.RandomInt(0, item_count);
10482 if (!item.IsExplosive())
10483 {
10484 item.AddHealth("","",damage);
10485 return true;
10486 }
10487 }
10488 }
10489 return false;
10490 }
10491
10493 {
10494 GameInventory inventory = GetInventory();
10496 if (attachment_count > 0)
10497 {
10498 int random_pick = Math.RandomInt(0, attachment_count);
10500 if (!attachment.IsExplosive())
10501 {
10502 attachment.AddHealth("","",damage);
10503 return true;
10504 }
10505 }
10506 return false;
10507 }
10508
10510 {
10512 }
10513
10515 {
10517 return GetInventory().CanRemoveEntity();
10518
10519 return false;
10520 }
10521
10523 {
10524
10526 return false;
10527
10528
10530 return false;
10531
10532
10533
10535 if (delta == 0)
10536 return false;
10537
10538
10539 return true;
10540 }
10541
10543 {
10545 {
10546 if (ScriptInputUserData.CanStoreInputUserData())
10547 {
10548 ScriptInputUserData ctx = new ScriptInputUserData;
10553 ctx.
Write(destination_entity);
10555 ctx.
Write(slot_id);
10557 }
10558 }
10559 else if (!
g_Game.IsMultiplayer())
10560 {
10562 }
10563 }
10564
10566 {
10567 float split_quantity_new;
10571 InventoryLocation loc = new InventoryLocation;
10572
10573 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10574 {
10576 split_quantity_new = stack_max;
10577 else
10579
10581 {
10582 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10583 if (new_item)
10584 {
10585 new_item.SetResultOfSplit(true);
10586 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10588 new_item.
SetQuantity(split_quantity_new,
false,
true);
10589 }
10590 }
10591 }
10592 else if (destination_entity && slot_id == -1)
10593 {
10594 if (quantity > stack_max)
10595 split_quantity_new = stack_max;
10596 else
10597 split_quantity_new = quantity;
10598
10600 {
10601 GameInventory destinationInventory = destination_entity.GetInventory();
10603 {
10606 }
10607
10608 if (new_item)
10609 {
10610 new_item.SetResultOfSplit(true);
10611 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10613 new_item.
SetQuantity(split_quantity_new,
false,
true);
10614 }
10615 }
10616 }
10617 else
10618 {
10619 if (stack_max != 0)
10620 {
10622 {
10624 }
10625
10626 if (split_quantity_new == 0)
10627 {
10628 if (!
g_Game.IsMultiplayer())
10629 player.PhysicalPredictiveDropItem(this);
10630 else
10631 player.ServerDropEntity(this);
10632 return;
10633 }
10634
10636 {
10638
10639 if (new_item)
10640 {
10641 new_item.SetResultOfSplit(true);
10642 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10645 new_item.PlaceOnSurface();
10646 }
10647 }
10648 }
10649 }
10650 }
10651
10653 {
10654 float split_quantity_new;
10658 InventoryLocation loc = new InventoryLocation;
10659
10660 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10661 {
10663 split_quantity_new = stack_max;
10664 else
10666
10668 {
10669 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10670 if (new_item)
10671 {
10672 new_item.SetResultOfSplit(true);
10673 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10675 new_item.
SetQuantity(split_quantity_new,
false,
true);
10676 }
10677 }
10678 }
10679 else if (destination_entity && slot_id == -1)
10680 {
10681 if (quantity > stack_max)
10682 split_quantity_new = stack_max;
10683 else
10684 split_quantity_new = quantity;
10685
10687 {
10688 GameInventory destinationInventory = destination_entity.GetInventory();
10690 {
10693 }
10694
10695 if (new_item)
10696 {
10697 new_item.SetResultOfSplit(true);
10698 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10700 new_item.
SetQuantity(split_quantity_new,
false,
true);
10701 }
10702 }
10703 }
10704 else
10705 {
10706 if (stack_max != 0)
10707 {
10709 {
10711 }
10712
10714 {
10716
10717 if (new_item)
10718 {
10719 new_item.SetResultOfSplit(true);
10720 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10723 new_item.PlaceOnSurface();
10724 }
10725 }
10726 }
10727 }
10728 }
10729
10731 {
10733 {
10734 if (ScriptInputUserData.CanStoreInputUserData())
10735 {
10736 ScriptInputUserData ctx = new ScriptInputUserData;
10741 dst.WriteToContext(ctx);
10743 }
10744 }
10745 else if (!
g_Game.IsMultiplayer())
10746 {
10748 }
10749 }
10750
10752 {
10754 {
10755 if (ScriptInputUserData.CanStoreInputUserData())
10756 {
10757 ScriptInputUserData ctx = new ScriptInputUserData;
10762 ctx.
Write(destination_entity);
10768 }
10769 }
10770 else if (!
g_Game.IsMultiplayer())
10771 {
10773 }
10774 }
10775
10777 {
10779 }
10780
10782 {
10784 float split_quantity_new;
10786 if (dst.IsValid())
10787 {
10788 int slot_id = dst.GetSlot();
10790
10791 if (quantity > stack_max)
10792 split_quantity_new = stack_max;
10793 else
10794 split_quantity_new = quantity;
10795
10797 {
10799
10800 if (new_item)
10801 {
10802 new_item.SetResultOfSplit(true);
10803 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10805 new_item.
SetQuantity(split_quantity_new,
false,
true);
10806 }
10807
10808 return new_item;
10809 }
10810 }
10811
10812 return null;
10813 }
10814
10816 {
10818 float split_quantity_new;
10820 if (destination_entity)
10821 {
10823 if (quantity > stackable)
10824 split_quantity_new = stackable;
10825 else
10826 split_quantity_new = quantity;
10827
10829 {
10830 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10831 if (new_item)
10832 {
10833 new_item.SetResultOfSplit(true);
10834 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10836 new_item.
SetQuantity(split_quantity_new,
false,
true);
10837 }
10838 }
10839 }
10840 }
10841
10843 {
10845 {
10846 if (ScriptInputUserData.CanStoreInputUserData())
10847 {
10848 ScriptInputUserData ctx = new ScriptInputUserData;
10853 ItemBase destination_entity =
this;
10854 ctx.
Write(destination_entity);
10858 }
10859 }
10860 else if (!
g_Game.IsMultiplayer())
10861 {
10863 }
10864 }
10865
10867 {
10869 float split_quantity_new;
10871 if (player)
10872 {
10874 if (quantity > stackable)
10875 split_quantity_new = stackable;
10876 else
10877 split_quantity_new = quantity;
10878
10880 {
10881 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10882 new_item =
ItemBase.Cast(in_hands);
10883 if (new_item)
10884 {
10885 new_item.SetResultOfSplit(true);
10886 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10888 new_item.SetQuantity(split_quantity_new, false, true);
10889 }
10890 }
10891 }
10892 }
10893
10895 {
10897 float split_quantity_new = Math.Floor(quantity * 0.5);
10898
10900 return;
10901
10903
10904 if (new_item)
10905 {
10906 if (new_item.GetQuantityMax() < split_quantity_new)
10907 {
10908 split_quantity_new = new_item.GetQuantityMax();
10909 }
10910
10911 new_item.SetResultOfSplit(true);
10912 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10913
10915 {
10918 }
10919 else
10920 {
10922 new_item.
SetQuantity(split_quantity_new,
false,
true);
10923 }
10924 }
10925 }
10926
10928 {
10930 float split_quantity_new = Math.Floor(quantity / 2);
10931
10933 return;
10934
10935 InventoryLocation invloc = new InventoryLocation;
10937
10939 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10940
10941 if (new_item)
10942 {
10943 if (new_item.GetQuantityMax() < split_quantity_new)
10944 {
10945 split_quantity_new = new_item.GetQuantityMax();
10946 }
10948 {
10951 }
10952 else if (split_quantity_new > 1)
10953 {
10955 new_item.
SetQuantity(split_quantity_new,
false,
true);
10956 }
10957 }
10958 }
10959
10962 {
10963 SetWeightDirty();
10965
10966 if (parent)
10967 parent.OnAttachmentQuantityChangedEx(this, delta);
10968
10970 {
10972 {
10974 }
10976 {
10977 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10979 }
10980 }
10981 }
10982
10985 {
10986
10987 }
10988
10991 {
10993 }
10994
10996 {
10997 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10998
11000 {
11001 if (newLevel == GameConstants.STATE_RUINED)
11002 {
11004 EntityAI parent = GetHierarchyParent();
11005 if (parent && parent.IsFireplace())
11006 {
11007 CargoBase cargo = GetInventory().GetCargo();
11008 if (cargo)
11009 {
11011 {
11013 }
11014 }
11015 }
11016 }
11017
11019 {
11020
11022 return;
11023 }
11024
11025 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11026 {
11028 }
11029 }
11030 }
11031
11032
11034 {
11035 super.OnRightClick();
11036
11038 {
11040 {
11041 if (ScriptInputUserData.CanStoreInputUserData())
11042 {
11043 EntityAI root = GetHierarchyRoot();
11044 Man playerOwner = GetHierarchyRootPlayer();
11045 InventoryLocation dst = new InventoryLocation;
11046
11047
11048 if (!playerOwner && root && root == this)
11049 {
11051 }
11052 else
11053 {
11054
11055 GetInventory().GetCurrentInventoryLocation(dst);
11057 {
11058 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11060 {
11062 }
11063 else
11064 {
11066
11067
11068 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11069 {
11071 }
11072 else
11073 {
11074 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11075 }
11076 }
11077 }
11078 }
11079
11080 ScriptInputUserData ctx = new ScriptInputUserData;
11088 }
11089 }
11090 else if (!
g_Game.IsMultiplayer())
11091 {
11093 }
11094 }
11095 }
11096
11098 {
11099 if (root)
11100 {
11101 vector m4[4];
11102 root.GetTransform(m4);
11103 dst.SetGround(this, m4);
11104 }
11105 else
11106 {
11107 GetInventory().GetCurrentInventoryLocation(dst);
11108 }
11109 }
11110
11111 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11112 {
11113
11114 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11115 return false;
11116
11117 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11118 return false;
11119
11120
11122 return false;
11123
11124
11125 Magazine mag = Magazine.Cast(this);
11126 if (mag)
11127 {
11128 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11129 return false;
11130
11131 if (stack_max_limit)
11132 {
11133 Magazine other_mag = Magazine.Cast(other_item);
11134 if (other_item)
11135 {
11136 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11137 return false;
11138 }
11139
11140 }
11141 }
11142 else
11143 {
11144
11146 return false;
11147
11149 return false;
11150 }
11151
11152 PlayerBase player = null;
11153 if (CastTo(player, GetHierarchyRootPlayer()))
11154 {
11155 if (player.GetInventory().HasAttachment(this))
11156 return false;
11157
11158 if (player.IsItemsToDelete())
11159 return false;
11160 }
11161
11162 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11163 return false;
11164
11165 int slotID;
11167 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11168 return false;
11169
11170 return true;
11171 }
11172
11174 {
11176 }
11177
11179 {
11180 return m_IsResultOfSplit;
11181 }
11182
11184 {
11185 m_IsResultOfSplit = value;
11186 }
11187
11189 {
11191 }
11192
11194 {
11195 float other_item_quantity = other_item.GetQuantity();
11196 float this_free_space;
11197
11199
11201
11202 if (other_item_quantity > this_free_space)
11203 {
11204 return this_free_space;
11205 }
11206 else
11207 {
11208 return other_item_quantity;
11209 }
11210 }
11211
11213 {
11215 }
11216
11218 {
11220 return;
11221
11222 if (!IsMagazine() && other_item)
11223 {
11225 if (quantity_used != 0)
11226 {
11227 float hp1 = GetHealth01("","");
11228 float hp2 = other_item.GetHealth01("","");
11229 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11230 hpResult = hpResult / (
GetQuantity() + quantity_used);
11231
11232 hpResult *= GetMaxHealth();
11233 Math.Round(hpResult);
11234 SetHealth("", "Health", hpResult);
11235
11237 other_item.AddQuantity(-quantity_used);
11238 }
11239 }
11241 }
11242
11244 {
11245 #ifdef SERVER
11246 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11247 GetHierarchyParent().IncreaseLifetimeUp();
11248 #endif
11249 };
11250
11252 {
11253 PlayerBase p = PlayerBase.Cast(player);
11254
11255 array<int> recipesIds = p.m_Recipes;
11256 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11257 if (moduleRecipesManager)
11258 {
11259 EntityAI itemInHands = player.GetEntityInHands();
11260 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11261 }
11262
11263 for (int i = 0;i < recipesIds.Count(); i++)
11264 {
11265 int key = recipesIds.Get(i);
11266 string recipeName = moduleRecipesManager.GetRecipeName(key);
11268 }
11269 }
11270
11271
11272 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11273 {
11274 super.GetDebugActions(outputList);
11275
11276
11282
11283
11288
11293
11294
11298
11299
11301 {
11305 }
11306
11309
11310
11314
11316
11317 InventoryLocation loc = new InventoryLocation();
11318 GetInventory().GetCurrentInventoryLocation(loc);
11320 {
11321 if (Gizmo_IsSupported())
11324 }
11325
11327 }
11328
11329
11330
11331
11333 {
11334 super.OnAction(action_id, player, ctx);
11335
11337 {
11338 switch (action_id)
11339 {
11343 return true;
11347 return true;
11348 }
11349 }
11350
11352 {
11353 switch (action_id)
11354 {
11356 Delete();
11357 return true;
11358 }
11359 }
11360
11361 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11362 {
11363 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11364 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11365 PlayerBase p = PlayerBase.Cast(player);
11366 if (
EActions.RECIPES_RANGE_START < 1000)
11367 {
11368 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11369 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11370 }
11371 }
11372 #ifndef SERVER
11373 else if (action_id ==
EActions.WATCH_PLAYER)
11374 {
11375 PluginDeveloper.SetDeveloperItemClientEx(player);
11376 }
11377 #endif
11379 {
11380 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11381 {
11382 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11383 OnDebugButtonPressServer(id + 1);
11384 }
11385
11386 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11387 {
11388 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11390 }
11391
11392 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11393 {
11394 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11396 }
11397
11398 else if (action_id ==
EActions.ADD_QUANTITY)
11399 {
11400 if (IsMagazine())
11401 {
11402 Magazine mag = Magazine.Cast(this);
11403 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11404 }
11405 else
11406 {
11408 }
11409
11410 if (m_EM)
11411 {
11412 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11413 }
11414
11415 }
11416
11417 else if (action_id ==
EActions.REMOVE_QUANTITY)
11418 {
11419 if (IsMagazine())
11420 {
11421 Magazine mag2 = Magazine.Cast(this);
11422 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11423 }
11424 else
11425 {
11427 }
11428 if (m_EM)
11429 {
11430 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11431 }
11432
11433 }
11434
11435 else if (action_id ==
EActions.SET_QUANTITY_0)
11436 {
11438
11439 if (m_EM)
11440 {
11441 m_EM.SetEnergy(0);
11442 }
11443 }
11444
11445 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11446 {
11448
11449 if (m_EM)
11450 {
11451 m_EM.SetEnergy(m_EM.GetEnergyMax());
11452 }
11453 }
11454
11455 else if (action_id ==
EActions.ADD_HEALTH)
11456 {
11457 AddHealth("","",GetMaxHealth("","Health")/5);
11458 }
11459 else if (action_id ==
EActions.REMOVE_HEALTH)
11460 {
11461 AddHealth("","",-GetMaxHealth("","Health")/5);
11462 }
11463 else if (action_id ==
EActions.DESTROY_HEALTH)
11464 {
11465 SetHealth01("","",0);
11466 }
11467 else if (action_id ==
EActions.WATCH_ITEM)
11468 {
11470 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11471 #ifdef DEVELOPER
11472 SetDebugDeveloper_item(this);
11473 #endif
11474 }
11475
11476 else if (action_id ==
EActions.ADD_TEMPERATURE)
11477 {
11478 AddTemperature(20);
11479
11480 }
11481
11482 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11483 {
11484 AddTemperature(-20);
11485
11486 }
11487
11488 else if (action_id ==
EActions.FLIP_FROZEN)
11489 {
11490 SetFrozen(!GetIsFrozen());
11491
11492 }
11493
11494 else if (action_id ==
EActions.ADD_WETNESS)
11495 {
11497
11498 }
11499
11500 else if (action_id ==
EActions.REMOVE_WETNESS)
11501 {
11503
11504 }
11505
11506 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11507 {
11510
11511
11512 }
11513
11514 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11515 {
11518 }
11519
11520 else if (action_id ==
EActions.MAKE_SPECIAL)
11521 {
11522 auto debugParams = DebugSpawnParams.WithPlayer(player);
11523 OnDebugSpawnEx(debugParams);
11524 }
11525
11526 }
11527
11528
11529 return false;
11530 }
11531
11532
11533
11534
11538
11541
11542
11543
11545 {
11546 return false;
11547 }
11548
11549
11551 {
11552 return true;
11553 }
11554
11555
11557 {
11558 return true;
11559 }
11560
11561
11562
11564 {
11565 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11566 return g_Game.ConfigIsExisting(config_path);
11567 }
11568
11571 {
11572 return null;
11573 }
11574
11576 {
11577 return false;
11578 }
11579
11581 {
11582 return false;
11583 }
11584
11588
11589
11591 {
11592 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11593 return module_repairing.CanRepair(this, item_repair_kit);
11594 }
11595
11596
11597 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11598 {
11599 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11600 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11601 }
11602
11603
11605 {
11606
11607
11608
11609
11610
11611
11612
11613
11614 return 1;
11615 }
11616
11617
11618
11620 {
11622 }
11623
11624
11625
11627 {
11629 }
11630
11631
11640 {
11641 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11642
11643 if (player)
11644 {
11645 player.MessageStatus(text);
11646 }
11647 }
11648
11649
11658 {
11659 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11660
11661 if (player)
11662 {
11663 player.MessageAction(text);
11664 }
11665 }
11666
11667
11676 {
11677 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11678
11679 if (player)
11680 {
11681 player.MessageFriendly(text);
11682 }
11683 }
11684
11685
11694 {
11695 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11696
11697 if (player)
11698 {
11699 player.MessageImportant(text);
11700 }
11701 }
11702
11704 {
11705 return true;
11706 }
11707
11708
11709 override bool KindOf(
string tag)
11710 {
11711 bool found = false;
11712 string item_name = this.
GetType();
11714 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11715
11716 int array_size = item_tag_array.Count();
11717 for (int i = 0; i < array_size; i++)
11718 {
11719 if (item_tag_array.Get(i) == tag)
11720 {
11721 found = true;
11722 break;
11723 }
11724 }
11725 return found;
11726 }
11727
11728
11730 {
11731
11732 super.OnRPC(sender, rpc_type,ctx);
11733
11734
11735 switch (rpc_type)
11736 {
11737 #ifndef SERVER
11738 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11739 Param2<bool, string> p = new Param2<bool, string>(false, "");
11740
11742 return;
11743
11744 bool play = p.param1;
11745 string soundSet = p.param2;
11746
11747 if (play)
11748 {
11750 {
11752 {
11754 }
11755 }
11756 else
11757 {
11759 }
11760 }
11761 else
11762 {
11764 }
11765
11766 break;
11767 #endif
11768
11769 }
11770
11772 {
11774 }
11775 }
11776
11777
11778
11779
11781 {
11782 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11783 return plugin.GetID(
name);
11784 }
11785
11787 {
11788 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11789 return plugin.GetName(id);
11790 }
11791
11794 {
11795
11796
11797 int varFlags;
11798 if (!ctx.
Read(varFlags))
11799 return;
11800
11801 if (varFlags & ItemVariableFlags.FLOAT)
11802 {
11804 }
11805 }
11806
11808 {
11809
11810 super.SerializeNumericalVars(floats_out);
11811
11812
11813
11815 {
11817 }
11818
11820 {
11822 }
11823
11825 {
11827 }
11828
11830 {
11835 }
11836
11838 {
11840 }
11841 }
11842
11844 {
11845
11846 super.DeSerializeNumericalVars(floats);
11847
11848
11849 int index = 0;
11850 int mask = Math.Round(floats.Get(index));
11851
11852 index++;
11853
11855 {
11857 {
11859 }
11860 else
11861 {
11862 float quantity = floats.Get(index);
11863 SetQuantity(quantity,
true,
false,
false,
false);
11864 }
11865 index++;
11866 }
11867
11869 {
11870 float wet = floats.Get(index);
11872 index++;
11873 }
11874
11876 {
11877 int liquidtype = Math.Round(floats.Get(index));
11879 index++;
11880 }
11881
11883 {
11885 index++;
11887 index++;
11889 index++;
11891 index++;
11892 }
11893
11895 {
11896 int cleanness = Math.Round(floats.Get(index));
11898 index++;
11899 }
11900 }
11901
11903 {
11904 super.WriteVarsToCTX(ctx);
11905
11906
11908 {
11910 }
11911
11913 {
11915 }
11916
11918 {
11920 }
11921
11923 {
11924 int r,g,b,a;
11930 }
11931
11933 {
11935 }
11936 }
11937
11939 {
11940 if (!super.ReadVarsFromCTX(ctx,version))
11941 return false;
11942
11943 int intValue;
11944 float value;
11945
11946 if (version < 140)
11947 {
11948 if (!ctx.
Read(intValue))
11949 return false;
11950
11951 m_VariablesMask = intValue;
11952 }
11953
11955 {
11956 if (!ctx.
Read(value))
11957 return false;
11958
11960 {
11962 }
11963 else
11964 {
11966 }
11967 }
11968
11969 if (version < 140)
11970 {
11972 {
11973 if (!ctx.
Read(value))
11974 return false;
11975 SetTemperatureDirect(value);
11976 }
11977 }
11978
11980 {
11981 if (!ctx.
Read(value))
11982 return false;
11984 }
11985
11987 {
11988 if (!ctx.
Read(intValue))
11989 return false;
11991 }
11992
11994 {
11995 int r,g,b,a;
11997 return false;
11999 return false;
12001 return false;
12003 return false;
12004
12006 }
12007
12009 {
12010 if (!ctx.
Read(intValue))
12011 return false;
12013 }
12014
12015 if (version >= 138 && version < 140)
12016 {
12018 {
12019 if (!ctx.
Read(intValue))
12020 return false;
12021 SetFrozen(intValue);
12022 }
12023 }
12024
12025 return true;
12026 }
12027
12028
12030 {
12033 {
12035 }
12036
12037 if (!super.OnStoreLoad(ctx, version))
12038 {
12040 return false;
12041 }
12042
12043 if (version >= 114)
12044 {
12045 bool hasQuickBarIndexSaved;
12046
12047 if (!ctx.
Read(hasQuickBarIndexSaved))
12048 {
12050 return false;
12051 }
12052
12053 if (hasQuickBarIndexSaved)
12054 {
12055 int itmQBIndex;
12056
12057
12058 if (!ctx.
Read(itmQBIndex))
12059 {
12061 return false;
12062 }
12063
12064 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12065 if (itmQBIndex != -1 && parentPlayer)
12066 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12067 }
12068 }
12069 else
12070 {
12071
12072 PlayerBase player;
12073 int itemQBIndex;
12074 if (version ==
int.
MAX)
12075 {
12076 if (!ctx.
Read(itemQBIndex))
12077 {
12079 return false;
12080 }
12081 }
12082 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12083 {
12084
12085 if (!ctx.
Read(itemQBIndex))
12086 {
12088 return false;
12089 }
12090 if (itemQBIndex != -1 && player)
12091 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12092 }
12093 }
12094
12095 if (version < 140)
12096 {
12097
12098 if (!LoadVariables(ctx, version))
12099 {
12101 return false;
12102 }
12103 }
12104
12105
12107 {
12109 return false;
12110 }
12111 if (version >= 132)
12112 {
12114 if (raib)
12115 {
12117 {
12119 return false;
12120 }
12121 }
12122 }
12123
12125 return true;
12126 }
12127
12128
12129
12131 {
12132 super.OnStoreSave(ctx);
12133
12134 PlayerBase player;
12135 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12136 {
12138
12139 int itemQBIndex = -1;
12140 itemQBIndex = player.FindQuickBarEntityIndex(this);
12141 ctx.
Write(itemQBIndex);
12142 }
12143 else
12144 {
12146 }
12147
12149
12151 if (raib)
12152 {
12154 }
12155 }
12156
12157
12159 {
12160 super.AfterStoreLoad();
12161
12163 {
12165 }
12166
12168 {
12171 }
12172 }
12173
12175 {
12176 super.EEOnAfterLoad();
12177
12179 {
12181 }
12182
12185 }
12186
12188 {
12189 return false;
12190 }
12191
12192
12193
12195 {
12197 {
12198 #ifdef PLATFORM_CONSOLE
12199
12201 {
12203 if (menu)
12204 {
12206 }
12207 }
12208 #endif
12209 }
12210
12212 {
12215 }
12216
12218 {
12219 SetWeightDirty();
12221 }
12223 {
12226 }
12227
12229 {
12232
12235 }
12237 {
12241 }
12242
12243 super.OnVariablesSynchronized();
12244 }
12245
12246
12247
12249 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12250 {
12251 if (!IsServerCheck(allow_client))
12252 return false;
12253
12255 return false;
12256
12259
12260 if (value <= (min + 0.001))
12261 value = min;
12262
12263 if (value == min)
12264 {
12265 if (destroy_config)
12266 {
12267 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12268 if (dstr)
12269 {
12271 this.Delete();
12272 return true;
12273 }
12274 }
12275 else if (destroy_forced)
12276 {
12278 this.Delete();
12279 return true;
12280 }
12281
12283 }
12284
12287
12289 {
12290 EntityAI parent = GetHierarchyRoot();
12291 InventoryLocation iLoc = new InventoryLocation();
12292 GetInventory().GetCurrentInventoryLocation(iLoc);
12294 {
12295 int iLocSlot = iLoc.
GetSlot();
12297 {
12299 }
12301 {
12303 }
12304 }
12305 }
12306
12308 {
12310
12311 if (delta)
12313 }
12314
12316
12317 return false;
12318 }
12319
12320
12322 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12323 {
12325 }
12326
12328 {
12331 }
12332
12334 {
12337 }
12338
12340 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12341 {
12342 float value_clamped = Math.Clamp(value, 0, 1);
12344 SetQuantity(result, destroy_config, destroy_forced);
12345 }
12346
12347
12350 {
12352 }
12353
12355 {
12357 }
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12369 {
12370 int slot = -1;
12371 GameInventory inventory = GetInventory();
12372 if (inventory)
12373 {
12374 InventoryLocation il = new InventoryLocation;
12377 }
12378
12380 }
12381
12383 {
12384 float quantity_max = 0;
12385
12387 {
12388 if (attSlotID != -1)
12389 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12390
12391 if (quantity_max <= 0)
12393 }
12394
12395 if (quantity_max <= 0)
12397
12398 return quantity_max;
12399 }
12400
12402 {
12404 }
12405
12407 {
12409 }
12410
12411
12413 {
12415 }
12416
12418 {
12420 }
12421
12423 {
12425 }
12426
12427
12429 {
12430
12431 float weightEx = GetWeightEx();
12432 float special = GetInventoryAndCargoWeight();
12433 return weightEx - special;
12434 }
12435
12436
12438 {
12440 }
12441
12443 {
12445 {
12446 #ifdef DEVELOPER
12447 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12448 {
12449 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12451 }
12452 #endif
12453
12454 return GetQuantity() * GetConfigWeightModified();
12455 }
12456 else if (HasEnergyManager())
12457 {
12458 #ifdef DEVELOPER
12459 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12460 {
12461 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12462 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12463 }
12464 #endif
12465 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12466 }
12467 else
12468 {
12469 #ifdef DEVELOPER
12470 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12471 {
12472 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12473 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12474 }
12475 #endif
12476 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12477 }
12478 }
12479
12482 {
12483 int item_count = 0;
12485
12486 GameInventory inventory = GetInventory();
12487 CargoBase cargo = inventory.
GetCargo();
12488 if (cargo != NULL)
12489 {
12491 }
12492
12494 for (int i = 0; i < nAttachments; ++i)
12495 {
12497 if (item)
12498 item_count += item.GetNumberOfItems();
12499 }
12500 return item_count;
12501 }
12502
12505 {
12506 float weight = 0;
12507 float wetness = 1;
12508 if (include_wetness)
12511 {
12512 weight = wetness * m_ConfigWeight;
12513 }
12515 {
12516 weight = 1;
12517 }
12518 return weight;
12519 }
12520
12521
12522
12524 {
12525 GameInventory inventory = GetInventory();
12526 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12527 {
12528 array<EntityAI> items = new array<EntityAI>;
12530 for (int i = 0; i < items.Count(); ++i)
12531 {
12533 if (item)
12534 {
12535 g_Game.ObjectDelete(item);
12536 }
12537 }
12538 }
12539 }
12540
12541
12542
12543
12545 {
12546 float energy = 0;
12547 if (HasEnergyManager())
12548 {
12549 energy = GetCompEM().GetEnergy();
12550 }
12551 return energy;
12552 }
12553
12554
12556 {
12557 super.OnEnergyConsumed();
12558
12560 }
12561
12563 {
12564 super.OnEnergyAdded();
12565
12567 }
12568
12569
12571 {
12572 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12573 {
12575 {
12576 float energy_0to1 = GetCompEM().GetEnergy0To1();
12578 }
12579 }
12580 }
12581
12582
12584 {
12585 return ConfigGetFloat("heatIsolation");
12586 }
12587
12589 {
12591 }
12592
12594 {
12595 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12596 if (
g_Game.ConfigIsExisting(paramPath))
12597 return g_Game.ConfigGetFloat(paramPath);
12598
12599 return 0.0;
12600 }
12601
12603 {
12604 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12605 if (
g_Game.ConfigIsExisting(paramPath))
12606 return g_Game.ConfigGetFloat(paramPath);
12607
12608 return 0.0;
12609 }
12610
12611 override void SetWet(
float value,
bool allow_client =
false)
12612 {
12613 if (!IsServerCheck(allow_client))
12614 return;
12615
12618
12620
12621 m_VarWet = Math.Clamp(value, min, max);
12622
12624 {
12627 }
12628 }
12629
12630 override void AddWet(
float value)
12631 {
12633 }
12634
12636 {
12638 }
12639
12641 {
12643 }
12644
12646 {
12648 }
12649
12651 {
12653 }
12654
12656 {
12658 }
12659
12660 override void OnWetChanged(
float newVal,
float oldVal)
12661 {
12664 if (newLevel != oldLevel)
12665 {
12667 }
12668 }
12669
12671 {
12672 SetWeightDirty();
12673 }
12674
12676 {
12677 return GetWetLevelInternal(
m_VarWet);
12678 }
12679
12680
12681
12683 {
12685 }
12686
12688 {
12690 }
12691
12693 {
12695 }
12696
12698 {
12700 }
12701
12702
12703
12705 {
12706 if (ConfigIsExisting("itemModelLength"))
12707 {
12708 return ConfigGetFloat("itemModelLength");
12709 }
12710 return 0;
12711 }
12712
12714 {
12715 if (ConfigIsExisting("itemAttachOffset"))
12716 {
12717 return ConfigGetFloat("itemAttachOffset");
12718 }
12719 return 0;
12720 }
12721
12722 override void SetCleanness(
int value,
bool allow_client =
false)
12723 {
12724 if (!IsServerCheck(allow_client))
12725 return;
12726
12728
12730
12733 }
12734
12736 {
12738 }
12739
12741 {
12742 return true;
12743 }
12744
12745
12746
12747
12749 {
12751 }
12752
12754 {
12756 }
12757
12758
12759
12760
12761 override void SetColor(
int r,
int g,
int b,
int a)
12762 {
12768 }
12770 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12771 {
12776 }
12777
12779 {
12781 }
12782
12785 {
12786 int r,g,b,a;
12788 r = r/255;
12789 g = g/255;
12790 b = b/255;
12791 a = a/255;
12792 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12793 }
12794
12795
12796
12797 override void SetLiquidType(
int value,
bool allow_client =
false)
12798 {
12799 if (!IsServerCheck(allow_client))
12800 return;
12801
12806 }
12807
12809 {
12810 return ConfigGetInt("varLiquidTypeInit");
12811 }
12812
12814 {
12816 }
12817
12819 {
12821 SetFrozen(false);
12822 }
12823
12826 {
12827 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12828 }
12829
12830
12833 {
12834 PlayerBase nplayer;
12835 if (PlayerBase.CastTo(nplayer, player))
12836 {
12838 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12839 }
12840 }
12841
12842
12845 {
12846 PlayerBase nplayer;
12847 if (PlayerBase.CastTo(nplayer,player))
12848 {
12849 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12850 }
12851
12852 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12853
12854 if (HasEnergyManager())
12855 {
12856 GetCompEM().UpdatePlugState();
12857 }
12858 }
12859
12860
12862 {
12863 super.OnPlacementStarted(player);
12864
12866 }
12867
12868 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12869 {
12871 {
12872 m_AdminLog.OnPlacementComplete(player,
this);
12873 }
12874
12875 super.OnPlacementComplete(player, position, orientation);
12876 }
12877
12878
12879
12880
12881
12883 {
12885 {
12886 return true;
12887 }
12888 else
12889 {
12890 return false;
12891 }
12892 }
12893
12894
12896 {
12898 {
12900 }
12901 }
12902
12903
12905 {
12907 }
12908
12910 {
12912 }
12913
12914 override void InsertAgent(
int agent,
float count = 1)
12915 {
12916 if (count < 1)
12917 return;
12918
12920 }
12921
12924 {
12926 }
12927
12928
12930 {
12932 }
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12976 {
12978 return false;
12979 return true;
12980 }
12981
12983 {
12984
12986 }
12987
12988
12991 {
12992 super.CheckForRoofLimited(timeTresholdMS);
12993
12994 float time =
g_Game.GetTime();
12995 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12996 {
12997 m_PreviousRoofTestTime = time;
12998 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12999 }
13000 }
13001
13002
13004 {
13006 {
13007 return 0;
13008 }
13009
13010 if (GetInventory().GetAttachmentSlotsCount() != 0)
13011 {
13012 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13013 if (filter)
13014 return filter.GetProtectionLevel(type, false, system);
13015 else
13016 return 0;
13017 }
13018
13019 string subclassPath, entryName;
13020
13021 switch (type)
13022 {
13024 entryName = "biological";
13025 break;
13027 entryName = "chemical";
13028 break;
13029 default:
13030 entryName = "biological";
13031 break;
13032 }
13033
13034 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13035
13036 return g_Game.ConfigGetFloat(subclassPath + entryName);
13037 }
13038
13039
13040
13043 {
13044 if (!IsMagazine())
13046
13048 }
13049
13050
13051
13052
13053
13058 {
13059 return true;
13060 }
13061
13063 {
13065 }
13066
13067
13068
13069
13070
13072 {
13073 if (parent)
13074 {
13075 if (parent.IsInherited(DayZInfected))
13076 return true;
13077
13078 if (!parent.IsRuined())
13079 return true;
13080 }
13081
13082 return true;
13083 }
13084
13086 {
13087 if (!super.CanPutAsAttachment(parent))
13088 {
13089 return false;
13090 }
13091
13092 if (!IsRuined() && !parent.IsRuined())
13093 {
13094 return true;
13095 }
13096
13097 return false;
13098 }
13099
13101 {
13102
13103
13104
13105
13106 return super.CanReceiveItemIntoCargo(item);
13107 }
13108
13110 {
13111
13112
13113
13114
13115 GameInventory attachmentInv = attachment.GetInventory();
13117 {
13118 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13119 return false;
13120 }
13121
13122 InventoryLocation loc = new InventoryLocation();
13123 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13124 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13125 return false;
13126
13127 return super.CanReceiveAttachment(attachment, slotId);
13128 }
13129
13131 {
13132 if (!super.CanReleaseAttachment(attachment))
13133 return false;
13134
13135 return GetInventory().AreChildrenAccessible();
13136 }
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13159 {
13160 int id = muzzle_owner.GetMuzzleID();
13161 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13162
13163 if (WPOF_array)
13164 {
13165 for (int i = 0; i < WPOF_array.Count(); i++)
13166 {
13167 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13168
13169 if (WPOF)
13170 {
13171 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13172 }
13173 }
13174 }
13175 }
13176
13177
13179 {
13180 int id = muzzle_owner.GetMuzzleID();
13182
13183 if (WPOBE_array)
13184 {
13185 for (int i = 0; i < WPOBE_array.Count(); i++)
13186 {
13187 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13188
13189 if (WPOBE)
13190 {
13191 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13192 }
13193 }
13194 }
13195 }
13196
13197
13199 {
13200 int id = muzzle_owner.GetMuzzleID();
13201 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13202
13203 if (WPOOH_array)
13204 {
13205 for (int i = 0; i < WPOOH_array.Count(); i++)
13206 {
13207 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13208
13209 if (WPOOH)
13210 {
13211 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13212 }
13213 }
13214 }
13215 }
13216
13217
13219 {
13220 int id = muzzle_owner.GetMuzzleID();
13221 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13222
13223 if (WPOOH_array)
13224 {
13225 for (int i = 0; i < WPOOH_array.Count(); i++)
13226 {
13227 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13228
13229 if (WPOOH)
13230 {
13231 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13232 }
13233 }
13234 }
13235 }
13236
13237
13239 {
13240 int id = muzzle_owner.GetMuzzleID();
13241 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13242
13243 if (WPOOH_array)
13244 {
13245 for (int i = 0; i < WPOOH_array.Count(); i++)
13246 {
13247 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13248
13249 if (WPOOH)
13250 {
13251 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13252 }
13253 }
13254 }
13255 }
13256
13257
13258
13260 {
13262 {
13263 return true;
13264 }
13265
13266 return false;
13267 }
13268
13270 {
13272 {
13273 return true;
13274 }
13275
13276 return false;
13277 }
13278
13280 {
13282 {
13283 return true;
13284 }
13285
13286 return false;
13287 }
13288
13290 {
13291 return false;
13292 }
13293
13296 {
13297 return UATimeSpent.DEFAULT_DEPLOY;
13298 }
13299
13300
13301
13302
13304 {
13306 SetSynchDirty();
13307 }
13308
13310 {
13312 }
13313
13314
13316 {
13317 return false;
13318 }
13319
13322 {
13323 string att_type = "None";
13324
13325 if (ConfigIsExisting("soundAttType"))
13326 {
13327 att_type = ConfigGetString("soundAttType");
13328 }
13329
13331 }
13332
13334 {
13336 }
13337
13338
13339
13340
13341
13347
13349 {
13352
13354 }
13355
13356
13358 {
13360 return;
13361
13363
13366
13369
13370 SoundParameters params = new SoundParameters();
13374 }
13375
13376
13378 {
13380 {
13383
13384 SetSynchDirty();
13385
13388 }
13389 }
13390
13392 {
13394 }
13395
13396
13398 {
13400 return;
13401
13403 SetSynchDirty();
13404
13407 }
13408
13410 {
13413 }
13414
13416 {
13418 }
13419
13420 void OnApply(PlayerBase player);
13421
13423 {
13424 return 1.0;
13425 };
13426
13428 {
13430 }
13431
13433 {
13435 }
13436
13438
13440 {
13441 SetDynamicPhysicsLifeTime(0.01);
13443 }
13444
13446 {
13447 array<string> zone_names = new array<string>;
13448 GetDamageZones(zone_names);
13449 for (int i = 0; i < zone_names.Count(); i++)
13450 {
13451 SetHealthMax(zone_names.Get(i),"Health");
13452 }
13453 SetHealthMax("","Health");
13454 }
13455
13458 {
13459 float global_health = GetHealth01("","Health");
13460 array<string> zones = new array<string>;
13461 GetDamageZones(zones);
13462
13463 for (int i = 0; i < zones.Count(); i++)
13464 {
13465 SetHealth01(zones.Get(i),"Health",global_health);
13466 }
13467 }
13468
13471 {
13472 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13473 }
13474
13476 {
13477 if (!hasRootAsPlayer)
13478 {
13479 if (refParentIB)
13480 {
13481
13482 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13483 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13484
13485 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13486 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13487
13490 }
13491 else
13492 {
13493
13496 }
13497 }
13498 }
13499
13501 {
13503 {
13504 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13505 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13506 {
13507 float heatPermCoef = 1.0;
13509 while (ent)
13510 {
13511 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13512 ent = ent.GetHierarchyParent();
13513 }
13514
13515 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13516 }
13517 }
13518 }
13519
13521 {
13522
13523 EntityAI parent = GetHierarchyParent();
13524 if (!parent)
13525 {
13526 hasParent = false;
13527 hasRootAsPlayer = false;
13528 }
13529 else
13530 {
13531 hasParent = true;
13532 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13533 refParentIB =
ItemBase.Cast(parent);
13534 }
13535 }
13536
13537 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13538 {
13539
13540 }
13541
13543 {
13544
13545 return false;
13546 }
13547
13549 {
13550
13551
13552 return false;
13553 }
13554
13556 {
13557
13558 return false;
13559 }
13560
13563 {
13564 return !GetIsFrozen() &&
IsOpen();
13565 }
13566
13568 {
13569 bool hasParent = false, hasRootAsPlayer = false;
13571
13572 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13573 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13574
13575 if (wwtu || foodDecay)
13576 {
13580
13581 if (processWetness || processTemperature || processDecay)
13582 {
13584
13585 if (processWetness)
13586 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13587
13588 if (processTemperature)
13590
13591 if (processDecay)
13592 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13593 }
13594 }
13595 }
13596
13599 {
13601 }
13602
13604 {
13607
13608 return super.GetTemperatureFreezeThreshold();
13609 }
13610
13612 {
13615
13616 return super.GetTemperatureThawThreshold();
13617 }
13618
13620 {
13623
13624 return super.GetItemOverheatThreshold();
13625 }
13626
13628 {
13630 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13631
13632 return super.GetTemperatureFreezeTime();
13633 }
13634
13636 {
13638 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13639
13640 return super.GetTemperatureThawTime();
13641 }
13642
13647
13649 {
13650 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13651 }
13652
13654 {
13655 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13656 }
13657
13660 {
13662 }
13663
13665 {
13667 }
13668
13670 {
13672 }
13673
13676 {
13677 return null;
13678 }
13679
13682 {
13683 return false;
13684 }
13685
13687 {
13689 {
13692 if (!trg)
13693 {
13695 explosive = this;
13696 }
13697
13698 explosive.PairRemote(trg);
13700
13701 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13702 trg.SetPersistentPairID(persistentID);
13703 explosive.SetPersistentPairID(persistentID);
13704
13705 return true;
13706 }
13707 return false;
13708 }
13709
13712 {
13713 float ret = 1.0;
13716 ret *= GetHealth01();
13717
13718 return ret;
13719 }
13720
13721 #ifdef DEVELOPER
13722 override void SetDebugItem()
13723 {
13724 super.SetDebugItem();
13725 _itemBase = this;
13726 }
13727
13729 {
13730 string text = super.GetDebugText();
13731
13733 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13734
13735 return text;
13736 }
13737 #endif
13738
13740 {
13741 return true;
13742 }
13743
13745
13747
13749 {
13752 }
13753
13754
13762
13778
13779 [
Obsolete(
"Use ItemSoundHandler instead")]
13782 {
13783 if (!
g_Game.IsDedicatedServer())
13784 {
13785 if (ConfigIsExisting("attachSoundSet"))
13786 {
13787 string cfg_path = "";
13788 string soundset = "";
13789 string type_name =
GetType();
13790
13793 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13794 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13795
13796 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13797 {
13798 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13799 {
13800 if (cfg_slot_array[i] == slot_type)
13801 {
13802 soundset = cfg_soundset_array[i];
13803 break;
13804 }
13805 }
13806 }
13807
13808 if (soundset != "")
13809 {
13810 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13812 }
13813 }
13814 }
13815 }
13816
13818}
13819
13821{
13823 if (entity)
13824 {
13825 bool is_item = entity.IsInherited(
ItemBase);
13826 if (is_item && full_quantity)
13827 {
13830 }
13831 }
13832 else
13833 {
13835 return NULL;
13836 }
13837 return entity;
13838}
13839
13841{
13842 if (item)
13843 {
13844 if (health > 0)
13845 item.SetHealth("", "", health);
13846
13847 if (item.CanHaveTemperature())
13848 {
13850 if (item.CanFreeze())
13851 item.SetFrozen(false);
13852 }
13853
13854 if (item.HasEnergyManager())
13855 {
13856 if (quantity >= 0)
13857 {
13858 item.GetCompEM().SetEnergy0To1(quantity);
13859 }
13860 else
13861 {
13863 }
13864 }
13865 else if (item.IsMagazine())
13866 {
13867 Magazine mag = Magazine.Cast(item);
13868 if (quantity >= 0)
13869 {
13870 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13871 }
13872 else
13873 {
13875 }
13876
13877 }
13878 else
13879 {
13880 if (quantity >= 0)
13881 {
13882 item.SetQuantityNormalized(quantity, false);
13883 }
13884 else
13885 {
13887 }
13888
13889 }
13890 }
13891}
13892
13893#ifdef DEVELOPER
13895#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.