8900{
8902 {
8903 return true;
8904 }
8905};
8906
8908{
8909
8910};
8911
8912
8913
8915{
8919
8921
8924
8925
8926
8927
8928
8937
8943
8948
8953
8974 protected bool m_IsResultOfSplit
8975
8977
8982
8983
8984
8986
8990
8991
8992
8994
8997
8998
8999
9005
9006
9014
9017
9018
9020
9021
9023
9024
9029
9030
9035
9037
9038
9040
9041
9043 {
9048
9049 if (!
g_Game.IsDedicatedServer())
9050 {
9052 {
9054
9056 {
9058 }
9059 }
9060
9063 }
9064
9065 m_OldLocation = null;
9066
9068 {
9070 }
9071
9072 if (ConfigIsExisting("headSelectionsToHide"))
9073 {
9076 }
9077
9079 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9080 {
9082 }
9083
9085
9086 m_IsResultOfSplit = false;
9087
9089 }
9090
9092 {
9093 super.InitItemVariables();
9094
9100 m_Count = ConfigGetInt(
"count");
9101
9104
9109
9112
9117
9129
9133
9134
9137 if (ConfigIsExisting("canBeSplit"))
9138 {
9141 }
9142
9144 if (ConfigIsExisting("itemBehaviour"))
9146
9147
9150 RegisterNetSyncVariableInt("m_VarLiquidType");
9151 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9152
9153 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9154 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9155 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9156
9157 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9158 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9159 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9160 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9161
9162 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9163 RegisterNetSyncVariableBool("m_IsTakeable");
9164 RegisterNetSyncVariableBool("m_IsHologram");
9165
9168 {
9171 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9172 }
9173
9175
9177 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9179
9181 }
9182
9184 {
9186 }
9187
9189 {
9192 {
9197 }
9198 }
9199
9200 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9201 {
9203 {
9206 }
9207
9209 }
9210
9212 {
9218 }
9219
9221
9223 {
9225
9226 if (!action)
9227 {
9228 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9229 return;
9230 }
9231
9233 if (!ai)
9234 {
9236 return;
9237 }
9238
9240 if (!action_array)
9241 {
9242 action_array = new array<ActionBase_Basic>;
9244 }
9245 if (LogManager.IsActionLogEnable())
9246 {
9247 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9248 }
9249
9250 if (action_array.Find(action) != -1)
9251 {
9252 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9253 }
9254 else
9255 {
9256 action_array.Insert(action);
9257 }
9258 }
9259
9261 {
9262 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9263 ActionBase action = player.GetActionManager().GetAction(actionName);
9266
9267 if (action_array)
9268 {
9269 action_array.RemoveItem(action);
9270 }
9271 }
9272
9273
9274
9276 {
9277 ActionOverrideData overrideData = new ActionOverrideData();
9281
9283 if (!actionMap)
9284 {
9287 }
9288
9289 actionMap.Insert(this.
Type(), overrideData);
9290
9291 }
9292
9294
9296
9297
9299 {
9302
9305
9306 string config_to_search = "CfgVehicles";
9307 string muzzle_owner_config;
9308
9310 {
9311 if (IsInherited(Weapon))
9312 config_to_search = "CfgWeapons";
9313
9314 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9315
9316 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9317
9318 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9319
9320 if (config_OnFire_subclass_count > 0)
9321 {
9322 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9323
9324 for (int i = 0; i < config_OnFire_subclass_count; i++)
9325 {
9326 string particle_class = "";
9327 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9328 string config_OnFire_entry = config_OnFire_class + particle_class;
9329 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9330 WPOF_array.Insert(WPOF);
9331 }
9332
9333
9335 }
9336 }
9337
9339 {
9340 config_to_search = "CfgWeapons";
9341 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9342
9343 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9344
9345 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9346
9347 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9348 {
9349 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9350
9351 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9352 {
9353 string particle_class2 = "";
9354 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9355 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9356 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9357 WPOBE_array.Insert(WPOBE);
9358 }
9359
9360
9362 }
9363 }
9364 }
9365
9366
9368 {
9371
9373 {
9374 string config_to_search = "CfgVehicles";
9375
9376 if (IsInherited(Weapon))
9377 config_to_search = "CfgWeapons";
9378
9379 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9380 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9381
9382 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9383 {
9384
9386
9388 {
9390 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9392 return;
9393 }
9394
9397
9398
9399
9400 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9401 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9402
9403 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9404 {
9405 string particle_class = "";
9406 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9407 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9408 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9409
9410 if (entry_type == CT_CLASS)
9411 {
9412 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9413 WPOOH_array.Insert(WPOF);
9414 }
9415 }
9416
9417
9419 }
9420 }
9421 }
9422
9424 {
9426 }
9427
9429 {
9431 {
9433
9436
9439
9440 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9441 }
9442 }
9443
9445 {
9447 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9448
9450 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9451
9453 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9454
9456 {
9458 }
9459 }
9460
9462 {
9464 }
9465
9467 {
9470 else
9472
9474 {
9477 }
9478 else
9479 {
9482
9485 }
9486
9488 }
9489
9491 {
9493 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9494 }
9495
9497 {
9499 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9501 }
9502
9504 {
9506 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9507 }
9508
9510 {
9513
9514 OverheatingParticle OP = new OverheatingParticle();
9519
9521 }
9522
9524 {
9527
9528 return -1;
9529 }
9530
9532 {
9534 {
9537
9538 for (int i = count; i > 0; --i)
9539 {
9540 int id = i - 1;
9543
9546
9547 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9548 {
9549 if (p)
9550 {
9553 }
9554 }
9555 }
9556 }
9557 }
9558
9560 {
9562 {
9564 {
9565 int id = i - 1;
9567
9568 if (OP)
9569 {
9571
9572 if (p)
9573 {
9575 }
9576
9577 delete OP;
9578 }
9579 }
9580
9583 }
9584 }
9585
9588 {
9589 return 0.0;
9590 }
9591
9592
9594 {
9595 return 250;
9596 }
9597
9599 {
9600 return 0;
9601 }
9602
9605 {
9607 return true;
9608
9609 return false;
9610 }
9611
9614 {
9617
9619 {
9621 }
9622 else
9623 {
9624
9626 }
9627
9629 }
9630
9637 {
9638 return -1;
9639 }
9640
9641
9642
9643
9645 {
9647 {
9648 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9649 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9650
9651 if (r_index >= 0)
9652 {
9653 InventoryLocation r_il = new InventoryLocation;
9654 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9655
9656 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9659 {
9660 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9661 }
9663 {
9664 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9665 }
9666
9667 }
9668
9669 player.GetHumanInventory().ClearUserReservedLocation(this);
9670 }
9671
9674 }
9675
9676
9677
9678
9680 {
9681 return ItemBase.m_DebugActionsMask;
9682 }
9683
9685 {
9686 return ItemBase.m_DebugActionsMask & mask;
9687 }
9688
9690 {
9691 ItemBase.m_DebugActionsMask = mask;
9692 }
9693
9695 {
9696 ItemBase.m_DebugActionsMask |= mask;
9697 }
9698
9700 {
9701 ItemBase.m_DebugActionsMask &= ~mask;
9702 }
9703
9705 {
9707 {
9709 }
9710 else
9711 {
9713 }
9714 }
9715
9716
9718 {
9719 if (GetEconomyProfile())
9720 {
9721 float q_max = GetEconomyProfile().GetQuantityMax();
9722 if (q_max > 0)
9723 {
9724 float q_min = GetEconomyProfile().GetQuantityMin();
9725 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9726
9728 {
9729 ComponentEnergyManager comp = GetCompEM();
9731 {
9733 }
9734 }
9736 {
9738
9739 }
9740
9741 }
9742 }
9743 }
9744
9747 {
9748 EntityAI parent = GetHierarchyParent();
9749
9750 if (parent)
9751 {
9752 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9753 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9754 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9755 }
9756 }
9757
9760 {
9761 EntityAI parent = GetHierarchyParent();
9762
9763 if (parent)
9764 {
9765 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9766 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9767 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9768 }
9769 }
9770
9772 {
9773
9774
9775
9776
9778
9780 {
9781 if (ScriptInputUserData.CanStoreInputUserData())
9782 {
9783 ScriptInputUserData ctx = new ScriptInputUserData;
9789 ctx.
Write(use_stack_max);
9792
9794 {
9795 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9796 }
9797 }
9798 }
9799 else if (!
g_Game.IsMultiplayer())
9800 {
9802 }
9803 }
9804
9806 {
9808 }
9809
9811 {
9813 }
9814
9816 {
9818 }
9819
9821 {
9822
9823 return false;
9824 }
9825
9827 {
9828 return false;
9829 }
9830
9834 {
9835 return false;
9836 }
9837
9839 {
9840 return "";
9841 }
9842
9844
9846 {
9847 return false;
9848 }
9849
9851 {
9852 return true;
9853 }
9854
9855
9856
9858 {
9859 return true;
9860 }
9861
9863 {
9864 return true;
9865 }
9866
9868 {
9869 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9871 }
9872
9874 {
9876 }
9877
9879 {
9881 if (!is_being_placed)
9883 SetSynchDirty();
9884 }
9885
9886
9888
9890 {
9892 }
9893
9895 {
9897 }
9898
9900 {
9901 return 1;
9902 }
9903
9905 {
9906 return false;
9907 }
9908
9910 {
9912 SetSynchDirty();
9913 }
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9950 {
9951 super.OnMovedInsideCargo(container);
9952
9953 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9954 }
9955
9956 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9957 {
9958 super.EEItemLocationChanged(oldLoc, newLoc);
9959
9960 PlayerBase newPlayer = null;
9961 PlayerBase oldPlayer = null;
9962
9963 if (newLoc.GetParent())
9964 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9965
9966 if (oldLoc.GetParent())
9967 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9968
9970 {
9971 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9972
9973 if (rIndex >= 0)
9974 {
9975 InventoryLocation rIl = new InventoryLocation;
9976 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9977
9978 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9981 {
9982 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9983 }
9985 {
9987 }
9988
9989 }
9990 }
9991
9993 {
9994 if (newPlayer)
9995 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9996
9997 if (newPlayer == oldPlayer)
9998 {
9999 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10000 {
10002 {
10003 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10004 {
10005 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10006 }
10007 }
10008 else
10009 {
10010 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10011 }
10012 }
10013
10014 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10015 {
10016 int type = oldLoc.GetType();
10018 {
10019 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10020 }
10022 {
10023 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10024 }
10025 }
10026 if (!m_OldLocation)
10027 {
10028 m_OldLocation = new InventoryLocation;
10029 }
10030 m_OldLocation.Copy(oldLoc);
10031 }
10032 else
10033 {
10034 if (m_OldLocation)
10035 {
10036 m_OldLocation.Reset();
10037 }
10038 }
10039
10040 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10041 }
10042 else
10043 {
10044 if (newPlayer)
10045 {
10046 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10047 if (resIndex >= 0)
10048 {
10049 InventoryLocation il = new InventoryLocation;
10050 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10052 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10055 {
10056 il.
GetParent().GetOnReleaseLock().Invoke(it);
10057 }
10059 {
10061 }
10062
10063 }
10064 }
10066 {
10067
10069 }
10070
10071 if (m_OldLocation)
10072 {
10073 m_OldLocation.Reset();
10074 }
10075 }
10076
10078 {
10079 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10080 }
10081
10083 {
10084 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10085 }
10086 }
10087
10088 override void EOnContact(IEntity other, Contact extra)
10089 {
10091 {
10092 int liquidType = -1;
10094 if (impactSpeed > 0.0)
10095 {
10097 #ifndef SERVER
10099 #else
10101 SetSynchDirty();
10102 #endif
10104 }
10105 }
10106
10107 #ifdef SERVER
10108 if (GetCompEM() && GetCompEM().IsPlugged())
10109 {
10110 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10111 GetCompEM().UnplugThis();
10112 }
10113 #endif
10114 }
10115
10117
10119 {
10121 }
10122
10124 {
10125
10126 }
10127
10129 {
10130 super.OnItemLocationChanged(old_owner, new_owner);
10131
10132 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10133 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10134
10135 if (!relatedPlayer && playerNew)
10136 relatedPlayer = playerNew;
10137
10138 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10139 {
10141 if (actionMgr)
10142 {
10143 ActionBase currentAction = actionMgr.GetRunningAction();
10144 if (currentAction)
10146 }
10147 }
10148
10149 Man ownerPlayerOld = null;
10150 Man ownerPlayerNew = null;
10151
10152 if (old_owner)
10153 {
10154 if (old_owner.
IsMan())
10155 {
10156 ownerPlayerOld = Man.Cast(old_owner);
10157 }
10158 else
10159 {
10160 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10161 }
10162 }
10163 else
10164 {
10166 {
10168
10169 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10170 {
10171 GetCompEM().UnplugThis();
10172 }
10173 }
10174 }
10175
10176 if (new_owner)
10177 {
10178 if (new_owner.
IsMan())
10179 {
10180 ownerPlayerNew = Man.Cast(new_owner);
10181 }
10182 else
10183 {
10184 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10185 }
10186 }
10187
10188 if (ownerPlayerOld != ownerPlayerNew)
10189 {
10190 if (ownerPlayerOld)
10191 {
10192 array<EntityAI> subItemsExit = new array<EntityAI>;
10194 for (int i = 0; i < subItemsExit.Count(); i++)
10195 {
10198 }
10199 }
10200
10201 if (ownerPlayerNew)
10202 {
10203 array<EntityAI> subItemsEnter = new array<EntityAI>;
10205 for (int j = 0; j < subItemsEnter.Count(); j++)
10206 {
10209 }
10210 }
10211 }
10212 else if (ownerPlayerNew != null)
10213 {
10214 PlayerBase nplayer;
10215 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10216 {
10217 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10219 for (int k = 0; k < subItemsUpdate.Count(); k++)
10220 {
10222 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10223 }
10224 }
10225 }
10226
10227 if (old_owner)
10228 old_owner.OnChildItemRemoved(this);
10229 if (new_owner)
10230 new_owner.OnChildItemReceived(this);
10231 }
10232
10233
10235 {
10236 super.EEDelete(parent);
10237 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10238 if (player)
10239 {
10241
10242 if (player.IsAlive())
10243 {
10244 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10245 if (r_index >= 0)
10246 {
10247 InventoryLocation r_il = new InventoryLocation;
10248 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10249
10250 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10253 {
10254 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10255 }
10257 {
10258 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10259 }
10260
10261 }
10262
10263 player.RemoveQuickBarEntityShortcut(this);
10264 }
10265 }
10266 }
10267
10269 {
10270 super.EEKilled(killer);
10271
10274 {
10275 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10276 {
10277 if (IsMagazine())
10278 {
10279 if (Magazine.Cast(this).GetAmmoCount() > 0)
10280 {
10282 }
10283 }
10284 else
10285 {
10287 }
10288 }
10289 }
10290 }
10291
10293 {
10294 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10295
10296 super.OnWasAttached(parent, slot_id);
10297
10300
10303 }
10304
10306 {
10307 super.OnWasDetached(parent, slot_id);
10308
10311
10314 }
10315
10317 {
10318 int idx;
10321
10322 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10323 if (inventory_slots.Count() < 1)
10324 {
10325 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10326 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10327 }
10328 else
10329 {
10330 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10331 }
10332
10333 idx = inventory_slots.Find(slot);
10334 if (idx < 0)
10335 return "";
10336
10337 return attach_types.Get(idx);
10338 }
10339
10341 {
10342 int idx = -1;
10343 string slot;
10344
10347
10348 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10349 if (inventory_slots.Count() < 1)
10350 {
10351 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10352 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10353 }
10354 else
10355 {
10356 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10357 if (detach_types.Count() < 1)
10358 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10359 }
10360
10361 for (int i = 0; i < inventory_slots.Count(); i++)
10362 {
10363 slot = inventory_slots.Get(i);
10364 }
10365
10366 if (slot != "")
10367 {
10368 if (detach_types.Count() == 1)
10369 idx = 0;
10370 else
10371 idx = inventory_slots.Find(slot);
10372 }
10373 if (idx < 0)
10374 return "";
10375
10376 return detach_types.Get(idx);
10377 }
10378
10380 {
10381
10383
10384
10385 float min_time = 1;
10386 float max_time = 3;
10387 float delay = Math.RandomFloat(min_time, max_time);
10388
10389 explode_timer.Run(delay, this, "DoAmmoExplosion");
10390 }
10391
10393 {
10394 Magazine magazine = Magazine.Cast(this);
10395 int pop_sounds_count = 6;
10396 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10397
10398
10399 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10400 string sound_name = pop_sounds[ sound_idx ];
10401 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10402
10403
10404 magazine.ServerAddAmmoCount(-1);
10405
10406
10407 float min_temp_to_explode = 100;
10408
10409 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10410 {
10412 }
10413 }
10414
10415
10416 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10417 {
10418 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10419
10420 const int CHANCE_DAMAGE_CARGO = 4;
10421 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10422 const int CHANCE_DAMAGE_NOTHING = 2;
10423
10425 {
10426 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10427 int chances;
10428 int rnd;
10429
10430 if (GetInventory().GetCargo())
10431 {
10432 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10433 rnd = Math.RandomInt(0,chances);
10434
10435 if (rnd < CHANCE_DAMAGE_CARGO)
10436 {
10438 }
10439 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10440 {
10442 }
10443 }
10444 else
10445 {
10446 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10447 rnd = Math.RandomInt(0,chances);
10448
10449 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10450 {
10452 }
10453 }
10454 }
10455 }
10456
10458 {
10459 CargoBase cargo = GetInventory().GetCargo();
10460 if (cargo)
10461 {
10463 if (item_count > 0)
10464 {
10465 int random_pick = Math.RandomInt(0, item_count);
10467 if (!item.IsExplosive())
10468 {
10469 item.AddHealth("","",damage);
10470 return true;
10471 }
10472 }
10473 }
10474 return false;
10475 }
10476
10478 {
10479 GameInventory inventory = GetInventory();
10481 if (attachment_count > 0)
10482 {
10483 int random_pick = Math.RandomInt(0, attachment_count);
10485 if (!attachment.IsExplosive())
10486 {
10487 attachment.AddHealth("","",damage);
10488 return true;
10489 }
10490 }
10491 return false;
10492 }
10493
10495 {
10497 }
10498
10500 {
10502 return GetInventory().CanRemoveEntity();
10503
10504 return false;
10505 }
10506
10508 {
10509
10511 return false;
10512
10513
10515 return false;
10516
10517
10518
10520 if (delta == 0)
10521 return false;
10522
10523
10524 return true;
10525 }
10526
10528 {
10530 {
10531 if (ScriptInputUserData.CanStoreInputUserData())
10532 {
10533 ScriptInputUserData ctx = new ScriptInputUserData;
10538 ctx.
Write(destination_entity);
10540 ctx.
Write(slot_id);
10542 }
10543 }
10544 else if (!
g_Game.IsMultiplayer())
10545 {
10547 }
10548 }
10549
10551 {
10552 float split_quantity_new;
10556 InventoryLocation loc = new InventoryLocation;
10557
10558 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10559 {
10561 split_quantity_new = stack_max;
10562 else
10564
10566 {
10567 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10568 if (new_item)
10569 {
10570 new_item.SetResultOfSplit(true);
10571 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10573 new_item.
SetQuantity(split_quantity_new,
false,
true);
10574 }
10575 }
10576 }
10577 else if (destination_entity && slot_id == -1)
10578 {
10579 if (quantity > stack_max)
10580 split_quantity_new = stack_max;
10581 else
10582 split_quantity_new = quantity;
10583
10585 {
10586 GameInventory destinationInventory = destination_entity.GetInventory();
10588 {
10591 }
10592
10593 if (new_item)
10594 {
10595 new_item.SetResultOfSplit(true);
10596 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10598 new_item.
SetQuantity(split_quantity_new,
false,
true);
10599 }
10600 }
10601 }
10602 else
10603 {
10604 if (stack_max != 0)
10605 {
10607 {
10609 }
10610
10611 if (split_quantity_new == 0)
10612 {
10613 if (!
g_Game.IsMultiplayer())
10614 player.PhysicalPredictiveDropItem(this);
10615 else
10616 player.ServerDropEntity(this);
10617 return;
10618 }
10619
10621 {
10623
10624 if (new_item)
10625 {
10626 new_item.SetResultOfSplit(true);
10627 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10630 new_item.PlaceOnSurface();
10631 }
10632 }
10633 }
10634 }
10635 }
10636
10638 {
10639 float split_quantity_new;
10643 InventoryLocation loc = new InventoryLocation;
10644
10645 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10646 {
10648 split_quantity_new = stack_max;
10649 else
10651
10653 {
10654 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10655 if (new_item)
10656 {
10657 new_item.SetResultOfSplit(true);
10658 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10660 new_item.
SetQuantity(split_quantity_new,
false,
true);
10661 }
10662 }
10663 }
10664 else if (destination_entity && slot_id == -1)
10665 {
10666 if (quantity > stack_max)
10667 split_quantity_new = stack_max;
10668 else
10669 split_quantity_new = quantity;
10670
10672 {
10673 GameInventory destinationInventory = destination_entity.GetInventory();
10675 {
10678 }
10679
10680 if (new_item)
10681 {
10682 new_item.SetResultOfSplit(true);
10683 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10685 new_item.
SetQuantity(split_quantity_new,
false,
true);
10686 }
10687 }
10688 }
10689 else
10690 {
10691 if (stack_max != 0)
10692 {
10694 {
10696 }
10697
10699 {
10701
10702 if (new_item)
10703 {
10704 new_item.SetResultOfSplit(true);
10705 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10708 new_item.PlaceOnSurface();
10709 }
10710 }
10711 }
10712 }
10713 }
10714
10716 {
10718 {
10719 if (ScriptInputUserData.CanStoreInputUserData())
10720 {
10721 ScriptInputUserData ctx = new ScriptInputUserData;
10726 dst.WriteToContext(ctx);
10728 }
10729 }
10730 else if (!
g_Game.IsMultiplayer())
10731 {
10733 }
10734 }
10735
10737 {
10739 {
10740 if (ScriptInputUserData.CanStoreInputUserData())
10741 {
10742 ScriptInputUserData ctx = new ScriptInputUserData;
10747 ctx.
Write(destination_entity);
10753 }
10754 }
10755 else if (!
g_Game.IsMultiplayer())
10756 {
10758 }
10759 }
10760
10762 {
10764 }
10765
10767 {
10769 float split_quantity_new;
10771 if (dst.IsValid())
10772 {
10773 int slot_id = dst.GetSlot();
10775
10776 if (quantity > stack_max)
10777 split_quantity_new = stack_max;
10778 else
10779 split_quantity_new = quantity;
10780
10782 {
10784
10785 if (new_item)
10786 {
10787 new_item.SetResultOfSplit(true);
10788 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10790 new_item.
SetQuantity(split_quantity_new,
false,
true);
10791 }
10792
10793 return new_item;
10794 }
10795 }
10796
10797 return null;
10798 }
10799
10801 {
10803 float split_quantity_new;
10805 if (destination_entity)
10806 {
10808 if (quantity > stackable)
10809 split_quantity_new = stackable;
10810 else
10811 split_quantity_new = quantity;
10812
10814 {
10815 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10816 if (new_item)
10817 {
10818 new_item.SetResultOfSplit(true);
10819 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10821 new_item.
SetQuantity(split_quantity_new,
false,
true);
10822 }
10823 }
10824 }
10825 }
10826
10828 {
10830 {
10831 if (ScriptInputUserData.CanStoreInputUserData())
10832 {
10833 ScriptInputUserData ctx = new ScriptInputUserData;
10838 ItemBase destination_entity =
this;
10839 ctx.
Write(destination_entity);
10843 }
10844 }
10845 else if (!
g_Game.IsMultiplayer())
10846 {
10848 }
10849 }
10850
10852 {
10854 float split_quantity_new;
10856 if (player)
10857 {
10859 if (quantity > stackable)
10860 split_quantity_new = stackable;
10861 else
10862 split_quantity_new = quantity;
10863
10865 {
10866 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10867 new_item =
ItemBase.Cast(in_hands);
10868 if (new_item)
10869 {
10870 new_item.SetResultOfSplit(true);
10871 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10873 new_item.SetQuantity(split_quantity_new, false, true);
10874 }
10875 }
10876 }
10877 }
10878
10880 {
10882 float split_quantity_new = Math.Floor(quantity * 0.5);
10883
10885 return;
10886
10888
10889 if (new_item)
10890 {
10891 if (new_item.GetQuantityMax() < split_quantity_new)
10892 {
10893 split_quantity_new = new_item.GetQuantityMax();
10894 }
10895
10896 new_item.SetResultOfSplit(true);
10897 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10898
10900 {
10903 }
10904 else
10905 {
10907 new_item.
SetQuantity(split_quantity_new,
false,
true);
10908 }
10909 }
10910 }
10911
10913 {
10915 float split_quantity_new = Math.Floor(quantity / 2);
10916
10918 return;
10919
10920 InventoryLocation invloc = new InventoryLocation;
10922
10924 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10925
10926 if (new_item)
10927 {
10928 if (new_item.GetQuantityMax() < split_quantity_new)
10929 {
10930 split_quantity_new = new_item.GetQuantityMax();
10931 }
10933 {
10936 }
10937 else if (split_quantity_new > 1)
10938 {
10940 new_item.
SetQuantity(split_quantity_new,
false,
true);
10941 }
10942 }
10943 }
10944
10947 {
10948 SetWeightDirty();
10950
10951 if (parent)
10952 parent.OnAttachmentQuantityChangedEx(this, delta);
10953
10955 {
10957 {
10959 }
10961 {
10962 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10964 }
10965 }
10966 }
10967
10970 {
10971
10972 }
10973
10976 {
10978 }
10979
10981 {
10982 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10983
10985 {
10986 if (newLevel == GameConstants.STATE_RUINED)
10987 {
10989 EntityAI parent = GetHierarchyParent();
10990 if (parent && parent.IsFireplace())
10991 {
10992 CargoBase cargo = GetInventory().GetCargo();
10993 if (cargo)
10994 {
10996 {
10998 }
10999 }
11000 }
11001 }
11002
11004 {
11005
11007 return;
11008 }
11009
11010 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11011 {
11013 }
11014 }
11015 }
11016
11017
11019 {
11020 super.OnRightClick();
11021
11023 {
11025 {
11026 if (ScriptInputUserData.CanStoreInputUserData())
11027 {
11028 EntityAI root = GetHierarchyRoot();
11029 Man playerOwner = GetHierarchyRootPlayer();
11030 InventoryLocation dst = new InventoryLocation;
11031
11032
11033 if (!playerOwner && root && root == this)
11034 {
11036 }
11037 else
11038 {
11039
11040 GetInventory().GetCurrentInventoryLocation(dst);
11042 {
11043 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11045 {
11047 }
11048 else
11049 {
11051
11052
11053 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11054 {
11056 }
11057 else
11058 {
11059 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11060 }
11061 }
11062 }
11063 }
11064
11065 ScriptInputUserData ctx = new ScriptInputUserData;
11073 }
11074 }
11075 else if (!
g_Game.IsMultiplayer())
11076 {
11078 }
11079 }
11080 }
11081
11083 {
11084 if (root)
11085 {
11086 vector m4[4];
11087 root.GetTransform(m4);
11088 dst.SetGround(this, m4);
11089 }
11090 else
11091 {
11092 GetInventory().GetCurrentInventoryLocation(dst);
11093 }
11094 }
11095
11096 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11097 {
11098
11099 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11100 return false;
11101
11102 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11103 return false;
11104
11105
11107 return false;
11108
11109
11110 Magazine mag = Magazine.Cast(this);
11111 if (mag)
11112 {
11113 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11114 return false;
11115
11116 if (stack_max_limit)
11117 {
11118 Magazine other_mag = Magazine.Cast(other_item);
11119 if (other_item)
11120 {
11121 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11122 return false;
11123 }
11124
11125 }
11126 }
11127 else
11128 {
11129
11131 return false;
11132
11134 return false;
11135 }
11136
11137 PlayerBase player = null;
11138 if (CastTo(player, GetHierarchyRootPlayer()))
11139 {
11140 if (player.GetInventory().HasAttachment(this))
11141 return false;
11142
11143 if (player.IsItemsToDelete())
11144 return false;
11145 }
11146
11147 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11148 return false;
11149
11150 int slotID;
11152 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11153 return false;
11154
11155 return true;
11156 }
11157
11159 {
11161 }
11162
11164 {
11165 return m_IsResultOfSplit;
11166 }
11167
11169 {
11170 m_IsResultOfSplit = value;
11171 }
11172
11174 {
11176 }
11177
11179 {
11180 float other_item_quantity = other_item.GetQuantity();
11181 float this_free_space;
11182
11184
11186
11187 if (other_item_quantity > this_free_space)
11188 {
11189 return this_free_space;
11190 }
11191 else
11192 {
11193 return other_item_quantity;
11194 }
11195 }
11196
11198 {
11200 }
11201
11203 {
11205 return;
11206
11207 if (!IsMagazine() && other_item)
11208 {
11210 if (quantity_used != 0)
11211 {
11212 float hp1 = GetHealth01("","");
11213 float hp2 = other_item.GetHealth01("","");
11214 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11215 hpResult = hpResult / (
GetQuantity() + quantity_used);
11216
11217 hpResult *= GetMaxHealth();
11218 Math.Round(hpResult);
11219 SetHealth("", "Health", hpResult);
11220
11222 other_item.AddQuantity(-quantity_used);
11223 }
11224 }
11226 }
11227
11229 {
11230 #ifdef SERVER
11231 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11232 GetHierarchyParent().IncreaseLifetimeUp();
11233 #endif
11234 };
11235
11237 {
11238 PlayerBase p = PlayerBase.Cast(player);
11239
11240 array<int> recipesIds = p.m_Recipes;
11241 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11242 if (moduleRecipesManager)
11243 {
11244 EntityAI itemInHands = player.GetEntityInHands();
11245 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11246 }
11247
11248 for (int i = 0;i < recipesIds.Count(); i++)
11249 {
11250 int key = recipesIds.Get(i);
11251 string recipeName = moduleRecipesManager.GetRecipeName(key);
11253 }
11254 }
11255
11256
11257 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11258 {
11259 super.GetDebugActions(outputList);
11260
11261
11267
11268
11273
11278
11279
11283
11284
11286 {
11290 }
11291
11294
11295
11299
11301
11302 InventoryLocation loc = new InventoryLocation();
11303 GetInventory().GetCurrentInventoryLocation(loc);
11305 {
11306 if (Gizmo_IsSupported())
11309 }
11310
11312 }
11313
11314
11315
11316
11318 {
11319 super.OnAction(action_id, player, ctx);
11320
11322 {
11323 switch (action_id)
11324 {
11328 return true;
11332 return true;
11333 }
11334 }
11335
11337 {
11338 switch (action_id)
11339 {
11341 Delete();
11342 return true;
11343 }
11344 }
11345
11346 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11347 {
11348 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11349 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11350 PlayerBase p = PlayerBase.Cast(player);
11351 if (
EActions.RECIPES_RANGE_START < 1000)
11352 {
11353 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11354 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11355 }
11356 }
11357 #ifndef SERVER
11358 else if (action_id ==
EActions.WATCH_PLAYER)
11359 {
11360 PluginDeveloper.SetDeveloperItemClientEx(player);
11361 }
11362 #endif
11364 {
11365 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11366 {
11367 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11368 OnDebugButtonPressServer(id + 1);
11369 }
11370
11371 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11372 {
11373 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11375 }
11376
11377 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11378 {
11379 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11381 }
11382
11383 else if (action_id ==
EActions.ADD_QUANTITY)
11384 {
11385 if (IsMagazine())
11386 {
11387 Magazine mag = Magazine.Cast(this);
11388 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11389 }
11390 else
11391 {
11393 }
11394
11395 if (m_EM)
11396 {
11397 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11398 }
11399
11400 }
11401
11402 else if (action_id ==
EActions.REMOVE_QUANTITY)
11403 {
11404 if (IsMagazine())
11405 {
11406 Magazine mag2 = Magazine.Cast(this);
11407 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11408 }
11409 else
11410 {
11412 }
11413 if (m_EM)
11414 {
11415 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11416 }
11417
11418 }
11419
11420 else if (action_id ==
EActions.SET_QUANTITY_0)
11421 {
11423
11424 if (m_EM)
11425 {
11426 m_EM.SetEnergy(0);
11427 }
11428 }
11429
11430 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11431 {
11433
11434 if (m_EM)
11435 {
11436 m_EM.SetEnergy(m_EM.GetEnergyMax());
11437 }
11438 }
11439
11440 else if (action_id ==
EActions.ADD_HEALTH)
11441 {
11442 AddHealth("","",GetMaxHealth("","Health")/5);
11443 }
11444 else if (action_id ==
EActions.REMOVE_HEALTH)
11445 {
11446 AddHealth("","",-GetMaxHealth("","Health")/5);
11447 }
11448 else if (action_id ==
EActions.DESTROY_HEALTH)
11449 {
11450 SetHealth01("","",0);
11451 }
11452 else if (action_id ==
EActions.WATCH_ITEM)
11453 {
11455 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11456 #ifdef DEVELOPER
11457 SetDebugDeveloper_item(this);
11458 #endif
11459 }
11460
11461 else if (action_id ==
EActions.ADD_TEMPERATURE)
11462 {
11463 AddTemperature(20);
11464
11465 }
11466
11467 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11468 {
11469 AddTemperature(-20);
11470
11471 }
11472
11473 else if (action_id ==
EActions.FLIP_FROZEN)
11474 {
11475 SetFrozen(!GetIsFrozen());
11476
11477 }
11478
11479 else if (action_id ==
EActions.ADD_WETNESS)
11480 {
11482
11483 }
11484
11485 else if (action_id ==
EActions.REMOVE_WETNESS)
11486 {
11488
11489 }
11490
11491 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11492 {
11495
11496
11497 }
11498
11499 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11500 {
11503 }
11504
11505 else if (action_id ==
EActions.MAKE_SPECIAL)
11506 {
11507 auto debugParams = DebugSpawnParams.WithPlayer(player);
11508 OnDebugSpawnEx(debugParams);
11509 }
11510
11511 }
11512
11513
11514 return false;
11515 }
11516
11517
11518
11519
11523
11526
11527
11528
11530 {
11531 return false;
11532 }
11533
11534
11536 {
11537 return true;
11538 }
11539
11540
11542 {
11543 return true;
11544 }
11545
11546
11547
11549 {
11550 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11551 return g_Game.ConfigIsExisting(config_path);
11552 }
11553
11556 {
11557 return null;
11558 }
11559
11561 {
11562 return false;
11563 }
11564
11566 {
11567 return false;
11568 }
11569
11573
11574
11576 {
11577 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11578 return module_repairing.CanRepair(this, item_repair_kit);
11579 }
11580
11581
11582 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11583 {
11584 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11585 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11586 }
11587
11588
11590 {
11591
11592
11593
11594
11595
11596
11597
11598
11599 return 1;
11600 }
11601
11602
11603
11605 {
11607 }
11608
11609
11610
11612 {
11614 }
11615
11616
11625 {
11626 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11627
11628 if (player)
11629 {
11630 player.MessageStatus(text);
11631 }
11632 }
11633
11634
11643 {
11644 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11645
11646 if (player)
11647 {
11648 player.MessageAction(text);
11649 }
11650 }
11651
11652
11661 {
11662 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11663
11664 if (player)
11665 {
11666 player.MessageFriendly(text);
11667 }
11668 }
11669
11670
11679 {
11680 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11681
11682 if (player)
11683 {
11684 player.MessageImportant(text);
11685 }
11686 }
11687
11689 {
11690 return true;
11691 }
11692
11693
11694 override bool KindOf(
string tag)
11695 {
11696 bool found = false;
11697 string item_name = this.
GetType();
11699 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11700
11701 int array_size = item_tag_array.Count();
11702 for (int i = 0; i < array_size; i++)
11703 {
11704 if (item_tag_array.Get(i) == tag)
11705 {
11706 found = true;
11707 break;
11708 }
11709 }
11710 return found;
11711 }
11712
11713
11715 {
11716
11717 super.OnRPC(sender, rpc_type,ctx);
11718
11719
11720 switch (rpc_type)
11721 {
11722 #ifndef SERVER
11723 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11724 Param2<bool, string> p = new Param2<bool, string>(false, "");
11725
11727 return;
11728
11729 bool play = p.param1;
11730 string soundSet = p.param2;
11731
11732 if (play)
11733 {
11735 {
11737 {
11739 }
11740 }
11741 else
11742 {
11744 }
11745 }
11746 else
11747 {
11749 }
11750
11751 break;
11752 #endif
11753
11754 }
11755
11757 {
11759 }
11760 }
11761
11762
11763
11764
11766 {
11767 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11768 return plugin.GetID(
name);
11769 }
11770
11772 {
11773 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11774 return plugin.GetName(id);
11775 }
11776
11779 {
11780
11781
11782 int varFlags;
11783 if (!ctx.
Read(varFlags))
11784 return;
11785
11786 if (varFlags & ItemVariableFlags.FLOAT)
11787 {
11789 }
11790 }
11791
11793 {
11794
11795 super.SerializeNumericalVars(floats_out);
11796
11797
11798
11800 {
11802 }
11803
11805 {
11807 }
11808
11810 {
11812 }
11813
11815 {
11820 }
11821
11823 {
11825 }
11826 }
11827
11829 {
11830
11831 super.DeSerializeNumericalVars(floats);
11832
11833
11834 int index = 0;
11835 int mask = Math.Round(floats.Get(index));
11836
11837 index++;
11838
11840 {
11842 {
11844 }
11845 else
11846 {
11847 float quantity = floats.Get(index);
11848 SetQuantity(quantity,
true,
false,
false,
false);
11849 }
11850 index++;
11851 }
11852
11854 {
11855 float wet = floats.Get(index);
11857 index++;
11858 }
11859
11861 {
11862 int liquidtype = Math.Round(floats.Get(index));
11864 index++;
11865 }
11866
11868 {
11870 index++;
11872 index++;
11874 index++;
11876 index++;
11877 }
11878
11880 {
11881 int cleanness = Math.Round(floats.Get(index));
11883 index++;
11884 }
11885 }
11886
11888 {
11889 super.WriteVarsToCTX(ctx);
11890
11891
11893 {
11895 }
11896
11898 {
11900 }
11901
11903 {
11905 }
11906
11908 {
11909 int r,g,b,a;
11915 }
11916
11918 {
11920 }
11921 }
11922
11924 {
11925 if (!super.ReadVarsFromCTX(ctx,version))
11926 return false;
11927
11928 int intValue;
11929 float value;
11930
11931 if (version < 140)
11932 {
11933 if (!ctx.
Read(intValue))
11934 return false;
11935
11936 m_VariablesMask = intValue;
11937 }
11938
11940 {
11941 if (!ctx.
Read(value))
11942 return false;
11943
11945 {
11947 }
11948 else
11949 {
11951 }
11952 }
11953
11954 if (version < 140)
11955 {
11957 {
11958 if (!ctx.
Read(value))
11959 return false;
11960 SetTemperatureDirect(value);
11961 }
11962 }
11963
11965 {
11966 if (!ctx.
Read(value))
11967 return false;
11969 }
11970
11972 {
11973 if (!ctx.
Read(intValue))
11974 return false;
11976 }
11977
11979 {
11980 int r,g,b,a;
11982 return false;
11984 return false;
11986 return false;
11988 return false;
11989
11991 }
11992
11994 {
11995 if (!ctx.
Read(intValue))
11996 return false;
11998 }
11999
12000 if (version >= 138 && version < 140)
12001 {
12003 {
12004 if (!ctx.
Read(intValue))
12005 return false;
12006 SetFrozen(intValue);
12007 }
12008 }
12009
12010 return true;
12011 }
12012
12013
12015 {
12018 {
12020 }
12021
12022 if (!super.OnStoreLoad(ctx, version))
12023 {
12025 return false;
12026 }
12027
12028 if (version >= 114)
12029 {
12030 bool hasQuickBarIndexSaved;
12031
12032 if (!ctx.
Read(hasQuickBarIndexSaved))
12033 {
12035 return false;
12036 }
12037
12038 if (hasQuickBarIndexSaved)
12039 {
12040 int itmQBIndex;
12041
12042
12043 if (!ctx.
Read(itmQBIndex))
12044 {
12046 return false;
12047 }
12048
12049 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12050 if (itmQBIndex != -1 && parentPlayer)
12051 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12052 }
12053 }
12054 else
12055 {
12056
12057 PlayerBase player;
12058 int itemQBIndex;
12059 if (version ==
int.
MAX)
12060 {
12061 if (!ctx.
Read(itemQBIndex))
12062 {
12064 return false;
12065 }
12066 }
12067 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12068 {
12069
12070 if (!ctx.
Read(itemQBIndex))
12071 {
12073 return false;
12074 }
12075 if (itemQBIndex != -1 && player)
12076 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12077 }
12078 }
12079
12080 if (version < 140)
12081 {
12082
12083 if (!LoadVariables(ctx, version))
12084 {
12086 return false;
12087 }
12088 }
12089
12090
12092 {
12094 return false;
12095 }
12096 if (version >= 132)
12097 {
12099 if (raib)
12100 {
12102 {
12104 return false;
12105 }
12106 }
12107 }
12108
12110 return true;
12111 }
12112
12113
12114
12116 {
12117 super.OnStoreSave(ctx);
12118
12119 PlayerBase player;
12120 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12121 {
12123
12124 int itemQBIndex = -1;
12125 itemQBIndex = player.FindQuickBarEntityIndex(this);
12126 ctx.
Write(itemQBIndex);
12127 }
12128 else
12129 {
12131 }
12132
12134
12136 if (raib)
12137 {
12139 }
12140 }
12141
12142
12144 {
12145 super.AfterStoreLoad();
12146
12148 {
12150 }
12151
12153 {
12156 }
12157 }
12158
12160 {
12161 super.EEOnAfterLoad();
12162
12164 {
12166 }
12167
12170 }
12171
12173 {
12174 return false;
12175 }
12176
12177
12178
12180 {
12182 {
12183 #ifdef PLATFORM_CONSOLE
12184
12186 {
12188 if (menu)
12189 {
12191 }
12192 }
12193 #endif
12194 }
12195
12197 {
12200 }
12201
12203 {
12204 SetWeightDirty();
12206 }
12208 {
12211 }
12212
12214 {
12217
12220 }
12222 {
12226 }
12227
12228 super.OnVariablesSynchronized();
12229 }
12230
12231
12232
12234 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12235 {
12236 if (!IsServerCheck(allow_client))
12237 return false;
12238
12240 return false;
12241
12244
12245 if (value <= (min + 0.001))
12246 value = min;
12247
12248 if (value == min)
12249 {
12250 if (destroy_config)
12251 {
12252 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12253 if (dstr)
12254 {
12256 this.Delete();
12257 return true;
12258 }
12259 }
12260 else if (destroy_forced)
12261 {
12263 this.Delete();
12264 return true;
12265 }
12266
12268 }
12269
12272
12274 {
12275 EntityAI parent = GetHierarchyRoot();
12276 InventoryLocation iLoc = new InventoryLocation();
12277 GetInventory().GetCurrentInventoryLocation(iLoc);
12279 {
12280 int iLocSlot = iLoc.
GetSlot();
12282 {
12284 }
12286 {
12288 }
12289 }
12290 }
12291
12293 {
12295
12296 if (delta)
12298 }
12299
12301
12302 return false;
12303 }
12304
12305
12307 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12308 {
12310 }
12311
12313 {
12316 }
12317
12319 {
12322 }
12323
12325 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12326 {
12327 float value_clamped = Math.Clamp(value, 0, 1);
12329 SetQuantity(result, destroy_config, destroy_forced);
12330 }
12331
12332
12335 {
12337 }
12338
12340 {
12342 }
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12354 {
12355 int slot = -1;
12356 GameInventory inventory = GetInventory();
12357 if (inventory)
12358 {
12359 InventoryLocation il = new InventoryLocation;
12362 }
12363
12365 }
12366
12368 {
12369 float quantity_max = 0;
12370
12372 {
12373 if (attSlotID != -1)
12374 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12375
12376 if (quantity_max <= 0)
12378 }
12379
12380 if (quantity_max <= 0)
12382
12383 return quantity_max;
12384 }
12385
12387 {
12389 }
12390
12392 {
12394 }
12395
12396
12398 {
12400 }
12401
12403 {
12405 }
12406
12408 {
12410 }
12411
12412
12414 {
12415
12416 float weightEx = GetWeightEx();
12417 float special = GetInventoryAndCargoWeight();
12418 return weightEx - special;
12419 }
12420
12421
12423 {
12425 }
12426
12428 {
12430 {
12431 #ifdef DEVELOPER
12432 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12433 {
12434 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12436 }
12437 #endif
12438
12439 return GetQuantity() * GetConfigWeightModified();
12440 }
12441 else if (HasEnergyManager())
12442 {
12443 #ifdef DEVELOPER
12444 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12445 {
12446 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12447 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12448 }
12449 #endif
12450 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12451 }
12452 else
12453 {
12454 #ifdef DEVELOPER
12455 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12456 {
12457 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12458 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12459 }
12460 #endif
12461 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12462 }
12463 }
12464
12467 {
12468 int item_count = 0;
12470
12471 GameInventory inventory = GetInventory();
12472 CargoBase cargo = inventory.
GetCargo();
12473 if (cargo != NULL)
12474 {
12476 }
12477
12479 for (int i = 0; i < nAttachments; ++i)
12480 {
12482 if (item)
12483 item_count += item.GetNumberOfItems();
12484 }
12485 return item_count;
12486 }
12487
12490 {
12491 float weight = 0;
12492 float wetness = 1;
12493 if (include_wetness)
12496 {
12497 weight = wetness * m_ConfigWeight;
12498 }
12500 {
12501 weight = 1;
12502 }
12503 return weight;
12504 }
12505
12506
12507
12509 {
12510 GameInventory inventory = GetInventory();
12511 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12512 {
12513 array<EntityAI> items = new array<EntityAI>;
12515 for (int i = 0; i < items.Count(); ++i)
12516 {
12518 if (item)
12519 {
12520 g_Game.ObjectDelete(item);
12521 }
12522 }
12523 }
12524 }
12525
12526
12527
12528
12530 {
12531 float energy = 0;
12532 if (HasEnergyManager())
12533 {
12534 energy = GetCompEM().GetEnergy();
12535 }
12536 return energy;
12537 }
12538
12539
12541 {
12542 super.OnEnergyConsumed();
12543
12545 }
12546
12548 {
12549 super.OnEnergyAdded();
12550
12552 }
12553
12554
12556 {
12557 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12558 {
12560 {
12561 float energy_0to1 = GetCompEM().GetEnergy0To1();
12563 }
12564 }
12565 }
12566
12567
12569 {
12570 return ConfigGetFloat("heatIsolation");
12571 }
12572
12574 {
12576 }
12577
12579 {
12580 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12581 if (
g_Game.ConfigIsExisting(paramPath))
12582 return g_Game.ConfigGetFloat(paramPath);
12583
12584 return 0.0;
12585 }
12586
12588 {
12589 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12590 if (
g_Game.ConfigIsExisting(paramPath))
12591 return g_Game.ConfigGetFloat(paramPath);
12592
12593 return 0.0;
12594 }
12595
12596 override void SetWet(
float value,
bool allow_client =
false)
12597 {
12598 if (!IsServerCheck(allow_client))
12599 return;
12600
12603
12605
12606 m_VarWet = Math.Clamp(value, min, max);
12607
12609 {
12612 }
12613 }
12614
12615 override void AddWet(
float value)
12616 {
12618 }
12619
12621 {
12623 }
12624
12626 {
12628 }
12629
12631 {
12633 }
12634
12636 {
12638 }
12639
12641 {
12643 }
12644
12645 override void OnWetChanged(
float newVal,
float oldVal)
12646 {
12649 if (newLevel != oldLevel)
12650 {
12652 }
12653 }
12654
12656 {
12657 SetWeightDirty();
12658 }
12659
12661 {
12662 return GetWetLevelInternal(
m_VarWet);
12663 }
12664
12665
12666
12668 {
12670 }
12671
12673 {
12675 }
12676
12678 {
12680 }
12681
12683 {
12685 }
12686
12687
12688
12690 {
12691 if (ConfigIsExisting("itemModelLength"))
12692 {
12693 return ConfigGetFloat("itemModelLength");
12694 }
12695 return 0;
12696 }
12697
12699 {
12700 if (ConfigIsExisting("itemAttachOffset"))
12701 {
12702 return ConfigGetFloat("itemAttachOffset");
12703 }
12704 return 0;
12705 }
12706
12707 override void SetCleanness(
int value,
bool allow_client =
false)
12708 {
12709 if (!IsServerCheck(allow_client))
12710 return;
12711
12713
12715
12718 }
12719
12721 {
12723 }
12724
12726 {
12727 return true;
12728 }
12729
12730
12731
12732
12734 {
12736 }
12737
12739 {
12741 }
12742
12743
12744
12745
12746 override void SetColor(
int r,
int g,
int b,
int a)
12747 {
12753 }
12755 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12756 {
12761 }
12762
12764 {
12766 }
12767
12770 {
12771 int r,g,b,a;
12773 r = r/255;
12774 g = g/255;
12775 b = b/255;
12776 a = a/255;
12777 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12778 }
12779
12780
12781
12782 override void SetLiquidType(
int value,
bool allow_client =
false)
12783 {
12784 if (!IsServerCheck(allow_client))
12785 return;
12786
12791 }
12792
12794 {
12795 return ConfigGetInt("varLiquidTypeInit");
12796 }
12797
12799 {
12801 }
12802
12804 {
12806 SetFrozen(false);
12807 }
12808
12811 {
12812 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12813 }
12814
12815
12818 {
12819 PlayerBase nplayer;
12820 if (PlayerBase.CastTo(nplayer, player))
12821 {
12823 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12824 }
12825 }
12826
12827
12830 {
12831 PlayerBase nplayer;
12832 if (PlayerBase.CastTo(nplayer,player))
12833 {
12834 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12835 }
12836
12837 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12838
12839 if (HasEnergyManager())
12840 {
12841 GetCompEM().UpdatePlugState();
12842 }
12843 }
12844
12845
12847 {
12848 super.OnPlacementStarted(player);
12849
12851 }
12852
12853 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12854 {
12856 {
12857 m_AdminLog.OnPlacementComplete(player,
this);
12858 }
12859
12860 super.OnPlacementComplete(player, position, orientation);
12861 }
12862
12863
12864
12865
12866
12868 {
12870 {
12871 return true;
12872 }
12873 else
12874 {
12875 return false;
12876 }
12877 }
12878
12879
12881 {
12883 {
12885 }
12886 }
12887
12888
12890 {
12892 }
12893
12895 {
12897 }
12898
12899 override void InsertAgent(
int agent,
float count = 1)
12900 {
12901 if (count < 1)
12902 return;
12903
12905 }
12906
12909 {
12911 }
12912
12913
12915 {
12917 }
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
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
12961 {
12963 return false;
12964 return true;
12965 }
12966
12968 {
12969
12971 }
12972
12973
12976 {
12977 super.CheckForRoofLimited(timeTresholdMS);
12978
12979 float time =
g_Game.GetTime();
12980 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12981 {
12982 m_PreviousRoofTestTime = time;
12983 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12984 }
12985 }
12986
12987
12989 {
12991 {
12992 return 0;
12993 }
12994
12995 if (GetInventory().GetAttachmentSlotsCount() != 0)
12996 {
12997 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12998 if (filter)
12999 return filter.GetProtectionLevel(type, false, system);
13000 else
13001 return 0;
13002 }
13003
13004 string subclassPath, entryName;
13005
13006 switch (type)
13007 {
13009 entryName = "biological";
13010 break;
13012 entryName = "chemical";
13013 break;
13014 default:
13015 entryName = "biological";
13016 break;
13017 }
13018
13019 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13020
13021 return g_Game.ConfigGetFloat(subclassPath + entryName);
13022 }
13023
13024
13025
13028 {
13029 if (!IsMagazine())
13031
13033 }
13034
13035
13036
13037
13038
13043 {
13044 return true;
13045 }
13046
13048 {
13050 }
13051
13052
13053
13054
13055
13057 {
13058 if (parent)
13059 {
13060 if (parent.IsInherited(DayZInfected))
13061 return true;
13062
13063 if (!parent.IsRuined())
13064 return true;
13065 }
13066
13067 return true;
13068 }
13069
13071 {
13072 if (!super.CanPutAsAttachment(parent))
13073 {
13074 return false;
13075 }
13076
13077 if (!IsRuined() && !parent.IsRuined())
13078 {
13079 return true;
13080 }
13081
13082 return false;
13083 }
13084
13086 {
13087
13088
13089
13090
13091 return super.CanReceiveItemIntoCargo(item);
13092 }
13093
13095 {
13096
13097
13098
13099
13100 GameInventory attachmentInv = attachment.GetInventory();
13102 {
13103 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13104 return false;
13105 }
13106
13107 InventoryLocation loc = new InventoryLocation();
13108 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13109 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13110 return false;
13111
13112 return super.CanReceiveAttachment(attachment, slotId);
13113 }
13114
13116 {
13117 if (!super.CanReleaseAttachment(attachment))
13118 return false;
13119
13120 return GetInventory().AreChildrenAccessible();
13121 }
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13144 {
13145 int id = muzzle_owner.GetMuzzleID();
13146 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13147
13148 if (WPOF_array)
13149 {
13150 for (int i = 0; i < WPOF_array.Count(); i++)
13151 {
13152 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13153
13154 if (WPOF)
13155 {
13156 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13157 }
13158 }
13159 }
13160 }
13161
13162
13164 {
13165 int id = muzzle_owner.GetMuzzleID();
13167
13168 if (WPOBE_array)
13169 {
13170 for (int i = 0; i < WPOBE_array.Count(); i++)
13171 {
13172 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13173
13174 if (WPOBE)
13175 {
13176 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13177 }
13178 }
13179 }
13180 }
13181
13182
13184 {
13185 int id = muzzle_owner.GetMuzzleID();
13186 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13187
13188 if (WPOOH_array)
13189 {
13190 for (int i = 0; i < WPOOH_array.Count(); i++)
13191 {
13192 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13193
13194 if (WPOOH)
13195 {
13196 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13197 }
13198 }
13199 }
13200 }
13201
13202
13204 {
13205 int id = muzzle_owner.GetMuzzleID();
13206 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13207
13208 if (WPOOH_array)
13209 {
13210 for (int i = 0; i < WPOOH_array.Count(); i++)
13211 {
13212 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13213
13214 if (WPOOH)
13215 {
13216 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13217 }
13218 }
13219 }
13220 }
13221
13222
13224 {
13225 int id = muzzle_owner.GetMuzzleID();
13226 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13227
13228 if (WPOOH_array)
13229 {
13230 for (int i = 0; i < WPOOH_array.Count(); i++)
13231 {
13232 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13233
13234 if (WPOOH)
13235 {
13236 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13237 }
13238 }
13239 }
13240 }
13241
13242
13243
13245 {
13247 {
13248 return true;
13249 }
13250
13251 return false;
13252 }
13253
13255 {
13257 {
13258 return true;
13259 }
13260
13261 return false;
13262 }
13263
13265 {
13267 {
13268 return true;
13269 }
13270
13271 return false;
13272 }
13273
13275 {
13276 return false;
13277 }
13278
13281 {
13282 return UATimeSpent.DEFAULT_DEPLOY;
13283 }
13284
13285
13286
13287
13289 {
13291 SetSynchDirty();
13292 }
13293
13295 {
13297 }
13298
13299
13301 {
13302 return false;
13303 }
13304
13307 {
13308 string att_type = "None";
13309
13310 if (ConfigIsExisting("soundAttType"))
13311 {
13312 att_type = ConfigGetString("soundAttType");
13313 }
13314
13316 }
13317
13319 {
13321 }
13322
13323
13324
13325
13326
13332
13334 {
13337
13339 }
13340
13341
13343 {
13345 return;
13346
13348
13351
13354
13355 SoundParameters params = new SoundParameters();
13359 }
13360
13361
13363 {
13365 {
13368
13369 SetSynchDirty();
13370
13373 }
13374 }
13375
13377 {
13379 }
13380
13381
13383 {
13385 return;
13386
13388 SetSynchDirty();
13389
13392 }
13393
13395 {
13398 }
13399
13401 {
13403 }
13404
13405 void OnApply(PlayerBase player);
13406
13408 {
13409 return 1.0;
13410 };
13411
13413 {
13415 }
13416
13418 {
13420 }
13421
13423
13425 {
13426 SetDynamicPhysicsLifeTime(0.01);
13428 }
13429
13431 {
13432 array<string> zone_names = new array<string>;
13433 GetDamageZones(zone_names);
13434 for (int i = 0; i < zone_names.Count(); i++)
13435 {
13436 SetHealthMax(zone_names.Get(i),"Health");
13437 }
13438 SetHealthMax("","Health");
13439 }
13440
13443 {
13444 float global_health = GetHealth01("","Health");
13445 array<string> zones = new array<string>;
13446 GetDamageZones(zones);
13447
13448 for (int i = 0; i < zones.Count(); i++)
13449 {
13450 SetHealth01(zones.Get(i),"Health",global_health);
13451 }
13452 }
13453
13456 {
13457 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13458 }
13459
13461 {
13462 if (!hasRootAsPlayer)
13463 {
13464 if (refParentIB)
13465 {
13466
13467 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13468 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13469
13470 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13471 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13472
13475 }
13476 else
13477 {
13478
13481 }
13482 }
13483 }
13484
13486 {
13488 {
13489 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13490 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13491 {
13492 float heatPermCoef = 1.0;
13494 while (ent)
13495 {
13496 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13497 ent = ent.GetHierarchyParent();
13498 }
13499
13500 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13501 }
13502 }
13503 }
13504
13506 {
13507
13508 EntityAI parent = GetHierarchyParent();
13509 if (!parent)
13510 {
13511 hasParent = false;
13512 hasRootAsPlayer = false;
13513 }
13514 else
13515 {
13516 hasParent = true;
13517 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13518 refParentIB =
ItemBase.Cast(parent);
13519 }
13520 }
13521
13522 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13523 {
13524
13525 }
13526
13528 {
13529
13530 return false;
13531 }
13532
13534 {
13535
13536
13537 return false;
13538 }
13539
13541 {
13542
13543 return false;
13544 }
13545
13548 {
13549 return !GetIsFrozen() &&
IsOpen();
13550 }
13551
13553 {
13554 bool hasParent = false, hasRootAsPlayer = false;
13556
13557 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13558 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13559
13560 if (wwtu || foodDecay)
13561 {
13565
13566 if (processWetness || processTemperature || processDecay)
13567 {
13569
13570 if (processWetness)
13571 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13572
13573 if (processTemperature)
13575
13576 if (processDecay)
13577 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13578 }
13579 }
13580 }
13581
13584 {
13586 }
13587
13589 {
13592
13593 return super.GetTemperatureFreezeThreshold();
13594 }
13595
13597 {
13600
13601 return super.GetTemperatureThawThreshold();
13602 }
13603
13605 {
13608
13609 return super.GetItemOverheatThreshold();
13610 }
13611
13613 {
13615 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13616
13617 return super.GetTemperatureFreezeTime();
13618 }
13619
13621 {
13623 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13624
13625 return super.GetTemperatureThawTime();
13626 }
13627
13632
13634 {
13635 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13636 }
13637
13639 {
13640 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13641 }
13642
13645 {
13647 }
13648
13650 {
13652 }
13653
13655 {
13657 }
13658
13661 {
13662 return null;
13663 }
13664
13667 {
13668 return false;
13669 }
13670
13672 {
13674 {
13677 if (!trg)
13678 {
13680 explosive = this;
13681 }
13682
13683 explosive.PairRemote(trg);
13685
13686 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13687 trg.SetPersistentPairID(persistentID);
13688 explosive.SetPersistentPairID(persistentID);
13689
13690 return true;
13691 }
13692 return false;
13693 }
13694
13697 {
13698 float ret = 1.0;
13701 ret *= GetHealth01();
13702
13703 return ret;
13704 }
13705
13706 #ifdef DEVELOPER
13707 override void SetDebugItem()
13708 {
13709 super.SetDebugItem();
13710 _itemBase = this;
13711 }
13712
13714 {
13715 string text = super.GetDebugText();
13716
13718 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13719
13720 return text;
13721 }
13722 #endif
13723
13725 {
13726 return true;
13727 }
13728
13730
13732
13734 {
13737 }
13738
13739
13747
13763
13764 [
Obsolete(
"Use ItemSoundHandler instead")]
13767 {
13768 if (!
g_Game.IsDedicatedServer())
13769 {
13770 if (ConfigIsExisting("attachSoundSet"))
13771 {
13772 string cfg_path = "";
13773 string soundset = "";
13774 string type_name =
GetType();
13775
13778 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13779 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13780
13781 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13782 {
13783 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13784 {
13785 if (cfg_slot_array[i] == slot_type)
13786 {
13787 soundset = cfg_soundset_array[i];
13788 break;
13789 }
13790 }
13791 }
13792
13793 if (soundset != "")
13794 {
13795 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13797 }
13798 }
13799 }
13800 }
13801
13803}
13804
13806{
13808 if (entity)
13809 {
13810 bool is_item = entity.IsInherited(
ItemBase);
13811 if (is_item && full_quantity)
13812 {
13815 }
13816 }
13817 else
13818 {
13820 return NULL;
13821 }
13822 return entity;
13823}
13824
13826{
13827 if (item)
13828 {
13829 if (health > 0)
13830 item.SetHealth("", "", health);
13831
13832 if (item.CanHaveTemperature())
13833 {
13835 if (item.CanFreeze())
13836 item.SetFrozen(false);
13837 }
13838
13839 if (item.HasEnergyManager())
13840 {
13841 if (quantity >= 0)
13842 {
13843 item.GetCompEM().SetEnergy0To1(quantity);
13844 }
13845 else
13846 {
13848 }
13849 }
13850 else if (item.IsMagazine())
13851 {
13852 Magazine mag = Magazine.Cast(item);
13853 if (quantity >= 0)
13854 {
13855 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13856 }
13857 else
13858 {
13860 }
13861
13862 }
13863 else
13864 {
13865 if (quantity >= 0)
13866 {
13867 item.SetQuantityNormalized(quantity, false);
13868 }
13869 else
13870 {
13872 }
13873
13874 }
13875 }
13876}
13877
13878#ifdef DEVELOPER
13880#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.