7019{
7021 {
7022 return true;
7023 }
7024};
7025
7027{
7028
7029};
7030
7031
7032
7034{
7038
7040
7043
7044
7045
7046
7047
7056
7062
7067
7072
7093 protected bool m_IsResultOfSplit
7094
7096
7101
7102
7103
7105
7109
7110
7111
7113
7116
7117
7118
7124
7125
7133
7136
7137
7139
7140
7142
7143
7148
7149
7154
7156
7157
7159
7160
7162 {
7167
7168 if (!
g_Game.IsDedicatedServer())
7169 {
7171 {
7173
7175 {
7177 }
7178 }
7179
7182 }
7183
7184 m_OldLocation = null;
7185
7187 {
7189 }
7190
7191 if (ConfigIsExisting("headSelectionsToHide"))
7192 {
7195 }
7196
7198 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7199 {
7201 }
7202
7204
7205 m_IsResultOfSplit = false;
7206
7208 }
7209
7211 {
7212 super.InitItemVariables();
7213
7219 m_Count = ConfigGetInt(
"count");
7220
7223
7228
7231
7236
7248
7252
7253
7256 if (ConfigIsExisting("canBeSplit"))
7257 {
7260 }
7261
7263 if (ConfigIsExisting("itemBehaviour"))
7265
7266
7269 RegisterNetSyncVariableInt("m_VarLiquidType");
7270 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7271
7272 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7273 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7274 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7275
7276 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7277 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7278 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7279 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7280
7281 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7282 RegisterNetSyncVariableBool("m_IsTakeable");
7283 RegisterNetSyncVariableBool("m_IsHologram");
7284
7287 {
7290 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7291 }
7292
7294
7296 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7298
7300 }
7301
7303 {
7305 }
7306
7308 {
7311 {
7316 }
7317 }
7318
7319 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7320 {
7322 {
7325 }
7326
7328 }
7329
7331 {
7337 }
7338
7340
7342 {
7344
7345 if (!action)
7346 {
7347 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7348 return;
7349 }
7350
7352 if (!ai)
7353 {
7355 return;
7356 }
7357
7359 if (!action_array)
7360 {
7361 action_array = new array<ActionBase_Basic>;
7363 }
7364 if (LogManager.IsActionLogEnable())
7365 {
7366 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7367 }
7368
7369 if (action_array.Find(action) != -1)
7370 {
7371 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7372 }
7373 else
7374 {
7375 action_array.Insert(action);
7376 }
7377 }
7378
7380 {
7381 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7382 ActionBase action = player.GetActionManager().GetAction(actionName);
7385
7386 if (action_array)
7387 {
7388 action_array.RemoveItem(action);
7389 }
7390 }
7391
7392
7393
7395 {
7396 ActionOverrideData overrideData = new ActionOverrideData();
7400
7402 if (!actionMap)
7403 {
7406 }
7407
7408 actionMap.Insert(this.
Type(), overrideData);
7409
7410 }
7411
7413
7415
7416
7418 {
7421
7424
7425 string config_to_search = "CfgVehicles";
7426 string muzzle_owner_config;
7427
7429 {
7430 if (IsInherited(Weapon))
7431 config_to_search = "CfgWeapons";
7432
7433 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7434
7435 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7436
7437 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7438
7439 if (config_OnFire_subclass_count > 0)
7440 {
7441 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7442
7443 for (int i = 0; i < config_OnFire_subclass_count; i++)
7444 {
7445 string particle_class = "";
7446 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7447 string config_OnFire_entry = config_OnFire_class + particle_class;
7448 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7449 WPOF_array.Insert(WPOF);
7450 }
7451
7452
7454 }
7455 }
7456
7458 {
7459 config_to_search = "CfgWeapons";
7460 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7461
7462 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7463
7464 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7465
7466 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7467 {
7468 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7469
7470 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7471 {
7472 string particle_class2 = "";
7473 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7474 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7475 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7476 WPOBE_array.Insert(WPOBE);
7477 }
7478
7479
7481 }
7482 }
7483 }
7484
7485
7487 {
7490
7492 {
7493 string config_to_search = "CfgVehicles";
7494
7495 if (IsInherited(Weapon))
7496 config_to_search = "CfgWeapons";
7497
7498 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7499 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7500
7501 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7502 {
7503
7505
7507 {
7509 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7511 return;
7512 }
7513
7516
7517
7518
7519 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7520 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7521
7522 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7523 {
7524 string particle_class = "";
7525 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7526 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7527 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7528
7529 if (entry_type == CT_CLASS)
7530 {
7531 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7532 WPOOH_array.Insert(WPOF);
7533 }
7534 }
7535
7536
7538 }
7539 }
7540 }
7541
7543 {
7545 }
7546
7548 {
7550 {
7552
7555
7558
7559 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7560 }
7561 }
7562
7564 {
7566 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7567
7569 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7570
7572 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7573
7575 {
7577 }
7578 }
7579
7581 {
7583 }
7584
7586 {
7589 else
7591
7593 {
7596 }
7597 else
7598 {
7601
7604 }
7605
7607 }
7608
7610 {
7612 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7613 }
7614
7616 {
7618 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7620 }
7621
7623 {
7625 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7626 }
7627
7629 {
7632
7633 OverheatingParticle OP = new OverheatingParticle();
7638
7640 }
7641
7643 {
7646
7647 return -1;
7648 }
7649
7651 {
7653 {
7656
7657 for (int i = count; i > 0; --i)
7658 {
7659 int id = i - 1;
7662
7665
7666 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7667 {
7668 if (p)
7669 {
7672 }
7673 }
7674 }
7675 }
7676 }
7677
7679 {
7681 {
7683 {
7684 int id = i - 1;
7686
7687 if (OP)
7688 {
7690
7691 if (p)
7692 {
7694 }
7695
7696 delete OP;
7697 }
7698 }
7699
7702 }
7703 }
7704
7707 {
7708 return 0.0;
7709 }
7710
7711
7713 {
7714 return 250;
7715 }
7716
7718 {
7719 return 0;
7720 }
7721
7724 {
7726 return true;
7727
7728 return false;
7729 }
7730
7733 {
7736
7738 {
7740 }
7741 else
7742 {
7743
7745 }
7746
7748 }
7749
7756 {
7757 return -1;
7758 }
7759
7760
7761
7762
7764 {
7766 {
7767 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7768 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7769
7770 if (r_index >= 0)
7771 {
7772 InventoryLocation r_il = new InventoryLocation;
7773 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7774
7775 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7778 {
7779 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7780 }
7782 {
7783 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7784 }
7785
7786 }
7787
7788 player.GetHumanInventory().ClearUserReservedLocation(this);
7789 }
7790
7793 }
7794
7795
7796
7797
7799 {
7800 return ItemBase.m_DebugActionsMask;
7801 }
7802
7804 {
7805 return ItemBase.m_DebugActionsMask & mask;
7806 }
7807
7809 {
7810 ItemBase.m_DebugActionsMask = mask;
7811 }
7812
7814 {
7815 ItemBase.m_DebugActionsMask |= mask;
7816 }
7817
7819 {
7820 ItemBase.m_DebugActionsMask &= ~mask;
7821 }
7822
7824 {
7826 {
7828 }
7829 else
7830 {
7832 }
7833 }
7834
7835
7837 {
7838 if (GetEconomyProfile())
7839 {
7840 float q_max = GetEconomyProfile().GetQuantityMax();
7841 if (q_max > 0)
7842 {
7843 float q_min = GetEconomyProfile().GetQuantityMin();
7844 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7845
7847 {
7848 ComponentEnergyManager comp = GetCompEM();
7850 {
7852 }
7853 }
7855 {
7857
7858 }
7859
7860 }
7861 }
7862 }
7863
7866 {
7867 EntityAI parent = GetHierarchyParent();
7868
7869 if (parent)
7870 {
7871 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7872 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7873 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7874 }
7875 }
7876
7879 {
7880 EntityAI parent = GetHierarchyParent();
7881
7882 if (parent)
7883 {
7884 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7885 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7886 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7887 }
7888 }
7889
7891 {
7892
7893
7894
7895
7897
7899 {
7900 if (ScriptInputUserData.CanStoreInputUserData())
7901 {
7902 ScriptInputUserData ctx = new ScriptInputUserData;
7908 ctx.
Write(use_stack_max);
7911
7913 {
7914 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7915 }
7916 }
7917 }
7918 else if (!
g_Game.IsMultiplayer())
7919 {
7921 }
7922 }
7923
7925 {
7927 }
7928
7930 {
7932 }
7933
7935 {
7937 }
7938
7940 {
7941
7942 return false;
7943 }
7944
7946 {
7947 return false;
7948 }
7949
7953 {
7954 return false;
7955 }
7956
7958 {
7959 return "";
7960 }
7961
7963
7965 {
7966 return false;
7967 }
7968
7970 {
7971 return true;
7972 }
7973
7974
7975
7977 {
7978 return true;
7979 }
7980
7982 {
7983 return true;
7984 }
7985
7987 {
7988 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7990 }
7991
7993 {
7995 }
7996
7998 {
8000 if (!is_being_placed)
8002 SetSynchDirty();
8003 }
8004
8005
8007
8009 {
8011 }
8012
8014 {
8016 }
8017
8019 {
8020 return 1;
8021 }
8022
8024 {
8025 return false;
8026 }
8027
8029 {
8031 SetSynchDirty();
8032 }
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8069 {
8070 super.OnMovedInsideCargo(container);
8071
8072 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8073 }
8074
8075 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8076 {
8077 super.EEItemLocationChanged(oldLoc, newLoc);
8078
8079 PlayerBase newPlayer = null;
8080 PlayerBase oldPlayer = null;
8081
8082 if (newLoc.GetParent())
8083 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8084
8085 if (oldLoc.GetParent())
8086 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8087
8089 {
8090 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8091
8092 if (rIndex >= 0)
8093 {
8094 InventoryLocation rIl = new InventoryLocation;
8095 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8096
8097 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8100 {
8101 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8102 }
8104 {
8106 }
8107
8108 }
8109 }
8110
8112 {
8113 if (newPlayer)
8114 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8115
8116 if (newPlayer == oldPlayer)
8117 {
8118 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8119 {
8121 {
8122 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8123 {
8124 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8125 }
8126 }
8127 else
8128 {
8129 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8130 }
8131 }
8132
8133 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8134 {
8135 int type = oldLoc.GetType();
8137 {
8138 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8139 }
8141 {
8142 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8143 }
8144 }
8145 if (!m_OldLocation)
8146 {
8147 m_OldLocation = new InventoryLocation;
8148 }
8149 m_OldLocation.Copy(oldLoc);
8150 }
8151 else
8152 {
8153 if (m_OldLocation)
8154 {
8155 m_OldLocation.Reset();
8156 }
8157 }
8158
8159 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8160 }
8161 else
8162 {
8163 if (newPlayer)
8164 {
8165 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8166 if (resIndex >= 0)
8167 {
8168 InventoryLocation il = new InventoryLocation;
8169 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8171 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8174 {
8175 il.
GetParent().GetOnReleaseLock().Invoke(it);
8176 }
8178 {
8180 }
8181
8182 }
8183 }
8185 {
8186
8188 }
8189
8190 if (m_OldLocation)
8191 {
8192 m_OldLocation.Reset();
8193 }
8194 }
8195
8197 {
8198 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8199 }
8200
8202 {
8203 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8204 }
8205 }
8206
8207 override void EOnContact(IEntity other, Contact extra)
8208 {
8210 {
8211 int liquidType = -1;
8213 if (impactSpeed > 0.0)
8214 {
8216 #ifndef SERVER
8218 #else
8220 SetSynchDirty();
8221 #endif
8223 }
8224 }
8225
8226 #ifdef SERVER
8227 if (GetCompEM() && GetCompEM().IsPlugged())
8228 {
8229 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8230 GetCompEM().UnplugThis();
8231 }
8232 #endif
8233 }
8234
8236
8238 {
8240 }
8241
8243 {
8244
8245 }
8246
8248 {
8249 super.OnItemLocationChanged(old_owner, new_owner);
8250
8251 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8252 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8253
8254 if (!relatedPlayer && playerNew)
8255 relatedPlayer = playerNew;
8256
8257 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8258 {
8260 if (actionMgr)
8261 {
8262 ActionBase currentAction = actionMgr.GetRunningAction();
8263 if (currentAction)
8265 }
8266 }
8267
8268 Man ownerPlayerOld = null;
8269 Man ownerPlayerNew = null;
8270
8271 if (old_owner)
8272 {
8273 if (old_owner.
IsMan())
8274 {
8275 ownerPlayerOld = Man.Cast(old_owner);
8276 }
8277 else
8278 {
8279 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8280 }
8281 }
8282 else
8283 {
8285 {
8287
8288 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8289 {
8290 GetCompEM().UnplugThis();
8291 }
8292 }
8293 }
8294
8295 if (new_owner)
8296 {
8297 if (new_owner.
IsMan())
8298 {
8299 ownerPlayerNew = Man.Cast(new_owner);
8300 }
8301 else
8302 {
8303 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8304 }
8305 }
8306
8307 if (ownerPlayerOld != ownerPlayerNew)
8308 {
8309 if (ownerPlayerOld)
8310 {
8311 array<EntityAI> subItemsExit = new array<EntityAI>;
8313 for (int i = 0; i < subItemsExit.Count(); i++)
8314 {
8317 }
8318 }
8319
8320 if (ownerPlayerNew)
8321 {
8322 array<EntityAI> subItemsEnter = new array<EntityAI>;
8324 for (int j = 0; j < subItemsEnter.Count(); j++)
8325 {
8328 }
8329 }
8330 }
8331 else if (ownerPlayerNew != null)
8332 {
8333 PlayerBase nplayer;
8334 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8335 {
8336 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8338 for (int k = 0; k < subItemsUpdate.Count(); k++)
8339 {
8341 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8342 }
8343 }
8344 }
8345
8346 if (old_owner)
8347 old_owner.OnChildItemRemoved(this);
8348 if (new_owner)
8349 new_owner.OnChildItemReceived(this);
8350 }
8351
8352
8354 {
8355 super.EEDelete(parent);
8356 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8357 if (player)
8358 {
8360
8361 if (player.IsAlive())
8362 {
8363 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8364 if (r_index >= 0)
8365 {
8366 InventoryLocation r_il = new InventoryLocation;
8367 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8368
8369 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8372 {
8373 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8374 }
8376 {
8377 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8378 }
8379
8380 }
8381
8382 player.RemoveQuickBarEntityShortcut(this);
8383 }
8384 }
8385 }
8386
8388 {
8389 super.EEKilled(killer);
8390
8393 {
8394 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8395 {
8396 if (IsMagazine())
8397 {
8398 if (Magazine.Cast(this).GetAmmoCount() > 0)
8399 {
8401 }
8402 }
8403 else
8404 {
8406 }
8407 }
8408 }
8409 }
8410
8412 {
8413 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8414
8415 super.OnWasAttached(parent, slot_id);
8416
8419
8422 }
8423
8425 {
8426 super.OnWasDetached(parent, slot_id);
8427
8430
8433 }
8434
8436 {
8437 int idx;
8440
8441 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8442 if (inventory_slots.Count() < 1)
8443 {
8444 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8445 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8446 }
8447 else
8448 {
8449 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8450 }
8451
8452 idx = inventory_slots.Find(slot);
8453 if (idx < 0)
8454 return "";
8455
8456 return attach_types.Get(idx);
8457 }
8458
8460 {
8461 int idx = -1;
8462 string slot;
8463
8466
8467 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8468 if (inventory_slots.Count() < 1)
8469 {
8470 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8471 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8472 }
8473 else
8474 {
8475 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8476 if (detach_types.Count() < 1)
8477 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8478 }
8479
8480 for (int i = 0; i < inventory_slots.Count(); i++)
8481 {
8482 slot = inventory_slots.Get(i);
8483 }
8484
8485 if (slot != "")
8486 {
8487 if (detach_types.Count() == 1)
8488 idx = 0;
8489 else
8490 idx = inventory_slots.Find(slot);
8491 }
8492 if (idx < 0)
8493 return "";
8494
8495 return detach_types.Get(idx);
8496 }
8497
8499 {
8500
8502
8503
8504 float min_time = 1;
8505 float max_time = 3;
8506 float delay = Math.RandomFloat(min_time, max_time);
8507
8508 explode_timer.Run(delay, this, "DoAmmoExplosion");
8509 }
8510
8512 {
8513 Magazine magazine = Magazine.Cast(this);
8514 int pop_sounds_count = 6;
8515 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8516
8517
8518 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8519 string sound_name = pop_sounds[ sound_idx ];
8520 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8521
8522
8523 magazine.ServerAddAmmoCount(-1);
8524
8525
8526 float min_temp_to_explode = 100;
8527
8528 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8529 {
8531 }
8532 }
8533
8534
8535 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8536 {
8537 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8538
8539 const int CHANCE_DAMAGE_CARGO = 4;
8540 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8541 const int CHANCE_DAMAGE_NOTHING = 2;
8542
8544 {
8545 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8546 int chances;
8547 int rnd;
8548
8549 if (GetInventory().GetCargo())
8550 {
8551 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8552 rnd = Math.RandomInt(0,chances);
8553
8554 if (rnd < CHANCE_DAMAGE_CARGO)
8555 {
8557 }
8558 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8559 {
8561 }
8562 }
8563 else
8564 {
8565 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8566 rnd = Math.RandomInt(0,chances);
8567
8568 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8569 {
8571 }
8572 }
8573 }
8574 }
8575
8577 {
8578 CargoBase cargo = GetInventory().GetCargo();
8579 if (cargo)
8580 {
8582 if (item_count > 0)
8583 {
8584 int random_pick = Math.RandomInt(0, item_count);
8586 if (!item.IsExplosive())
8587 {
8588 item.AddHealth("","",damage);
8589 return true;
8590 }
8591 }
8592 }
8593 return false;
8594 }
8595
8597 {
8598 GameInventory inventory = GetInventory();
8600 if (attachment_count > 0)
8601 {
8602 int random_pick = Math.RandomInt(0, attachment_count);
8604 if (!attachment.IsExplosive())
8605 {
8606 attachment.AddHealth("","",damage);
8607 return true;
8608 }
8609 }
8610 return false;
8611 }
8612
8614 {
8616 }
8617
8619 {
8621 return GetInventory().CanRemoveEntity();
8622
8623 return false;
8624 }
8625
8627 {
8628
8630 return false;
8631
8632
8634 return false;
8635
8636
8637
8639 if (delta == 0)
8640 return false;
8641
8642
8643 return true;
8644 }
8645
8647 {
8649 {
8650 if (ScriptInputUserData.CanStoreInputUserData())
8651 {
8652 ScriptInputUserData ctx = new ScriptInputUserData;
8657 ctx.
Write(destination_entity);
8661 }
8662 }
8663 else if (!
g_Game.IsMultiplayer())
8664 {
8666 }
8667 }
8668
8670 {
8671 float split_quantity_new;
8675 InventoryLocation loc = new InventoryLocation;
8676
8677 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8678 {
8680 split_quantity_new = stack_max;
8681 else
8683
8685 {
8686 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8687 if (new_item)
8688 {
8689 new_item.SetResultOfSplit(true);
8690 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8692 new_item.
SetQuantity(split_quantity_new,
false,
true);
8693 }
8694 }
8695 }
8696 else if (destination_entity && slot_id == -1)
8697 {
8698 if (quantity > stack_max)
8699 split_quantity_new = stack_max;
8700 else
8701 split_quantity_new = quantity;
8702
8704 {
8705 GameInventory destinationInventory = destination_entity.GetInventory();
8707 {
8710 }
8711
8712 if (new_item)
8713 {
8714 new_item.SetResultOfSplit(true);
8715 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8717 new_item.
SetQuantity(split_quantity_new,
false,
true);
8718 }
8719 }
8720 }
8721 else
8722 {
8723 if (stack_max != 0)
8724 {
8726 {
8728 }
8729
8730 if (split_quantity_new == 0)
8731 {
8732 if (!
g_Game.IsMultiplayer())
8733 player.PhysicalPredictiveDropItem(this);
8734 else
8735 player.ServerDropEntity(this);
8736 return;
8737 }
8738
8740 {
8742
8743 if (new_item)
8744 {
8745 new_item.SetResultOfSplit(true);
8746 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8749 new_item.PlaceOnSurface();
8750 }
8751 }
8752 }
8753 }
8754 }
8755
8757 {
8758 float split_quantity_new;
8762 InventoryLocation loc = new InventoryLocation;
8763
8764 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8765 {
8767 split_quantity_new = stack_max;
8768 else
8770
8772 {
8773 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8774 if (new_item)
8775 {
8776 new_item.SetResultOfSplit(true);
8777 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8779 new_item.
SetQuantity(split_quantity_new,
false,
true);
8780 }
8781 }
8782 }
8783 else if (destination_entity && slot_id == -1)
8784 {
8785 if (quantity > stack_max)
8786 split_quantity_new = stack_max;
8787 else
8788 split_quantity_new = quantity;
8789
8791 {
8792 GameInventory destinationInventory = destination_entity.GetInventory();
8794 {
8797 }
8798
8799 if (new_item)
8800 {
8801 new_item.SetResultOfSplit(true);
8802 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8804 new_item.
SetQuantity(split_quantity_new,
false,
true);
8805 }
8806 }
8807 }
8808 else
8809 {
8810 if (stack_max != 0)
8811 {
8813 {
8815 }
8816
8818 {
8820
8821 if (new_item)
8822 {
8823 new_item.SetResultOfSplit(true);
8824 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8827 new_item.PlaceOnSurface();
8828 }
8829 }
8830 }
8831 }
8832 }
8833
8835 {
8837 {
8838 if (ScriptInputUserData.CanStoreInputUserData())
8839 {
8840 ScriptInputUserData ctx = new ScriptInputUserData;
8845 dst.WriteToContext(ctx);
8847 }
8848 }
8849 else if (!
g_Game.IsMultiplayer())
8850 {
8852 }
8853 }
8854
8856 {
8858 {
8859 if (ScriptInputUserData.CanStoreInputUserData())
8860 {
8861 ScriptInputUserData ctx = new ScriptInputUserData;
8866 ctx.
Write(destination_entity);
8872 }
8873 }
8874 else if (!
g_Game.IsMultiplayer())
8875 {
8877 }
8878 }
8879
8881 {
8883 }
8884
8886 {
8888 float split_quantity_new;
8890 if (dst.IsValid())
8891 {
8892 int slot_id = dst.GetSlot();
8894
8895 if (quantity > stack_max)
8896 split_quantity_new = stack_max;
8897 else
8898 split_quantity_new = quantity;
8899
8901 {
8903
8904 if (new_item)
8905 {
8906 new_item.SetResultOfSplit(true);
8907 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8909 new_item.
SetQuantity(split_quantity_new,
false,
true);
8910 }
8911
8912 return new_item;
8913 }
8914 }
8915
8916 return null;
8917 }
8918
8920 {
8922 float split_quantity_new;
8924 if (destination_entity)
8925 {
8927 if (quantity > stackable)
8928 split_quantity_new = stackable;
8929 else
8930 split_quantity_new = quantity;
8931
8933 {
8934 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8935 if (new_item)
8936 {
8937 new_item.SetResultOfSplit(true);
8938 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8940 new_item.
SetQuantity(split_quantity_new,
false,
true);
8941 }
8942 }
8943 }
8944 }
8945
8947 {
8949 {
8950 if (ScriptInputUserData.CanStoreInputUserData())
8951 {
8952 ScriptInputUserData ctx = new ScriptInputUserData;
8957 ItemBase destination_entity =
this;
8958 ctx.
Write(destination_entity);
8962 }
8963 }
8964 else if (!
g_Game.IsMultiplayer())
8965 {
8967 }
8968 }
8969
8971 {
8973 float split_quantity_new;
8975 if (player)
8976 {
8978 if (quantity > stackable)
8979 split_quantity_new = stackable;
8980 else
8981 split_quantity_new = quantity;
8982
8984 {
8985 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8986 new_item =
ItemBase.Cast(in_hands);
8987 if (new_item)
8988 {
8989 new_item.SetResultOfSplit(true);
8990 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8992 new_item.SetQuantity(split_quantity_new, false, true);
8993 }
8994 }
8995 }
8996 }
8997
8999 {
9001 float split_quantity_new = Math.Floor(quantity * 0.5);
9002
9004 return;
9005
9007
9008 if (new_item)
9009 {
9010 if (new_item.GetQuantityMax() < split_quantity_new)
9011 {
9012 split_quantity_new = new_item.GetQuantityMax();
9013 }
9014
9015 new_item.SetResultOfSplit(true);
9016 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9017
9019 {
9022 }
9023 else
9024 {
9026 new_item.
SetQuantity(split_quantity_new,
false,
true);
9027 }
9028 }
9029 }
9030
9032 {
9034 float split_quantity_new = Math.Floor(quantity / 2);
9035
9037 return;
9038
9039 InventoryLocation invloc = new InventoryLocation;
9041
9043 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9044
9045 if (new_item)
9046 {
9047 if (new_item.GetQuantityMax() < split_quantity_new)
9048 {
9049 split_quantity_new = new_item.GetQuantityMax();
9050 }
9052 {
9055 }
9056 else if (split_quantity_new > 1)
9057 {
9059 new_item.
SetQuantity(split_quantity_new,
false,
true);
9060 }
9061 }
9062 }
9063
9066 {
9067 SetWeightDirty();
9069
9070 if (parent)
9071 parent.OnAttachmentQuantityChangedEx(this, delta);
9072
9074 {
9076 {
9078 }
9080 {
9081 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9083 }
9084 }
9085 }
9086
9089 {
9090
9091 }
9092
9095 {
9097 }
9098
9100 {
9101 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9102
9104 {
9105 if (newLevel == GameConstants.STATE_RUINED)
9106 {
9108 EntityAI parent = GetHierarchyParent();
9109 if (parent && parent.IsFireplace())
9110 {
9111 CargoBase cargo = GetInventory().GetCargo();
9112 if (cargo)
9113 {
9115 {
9117 }
9118 }
9119 }
9120 }
9121
9123 {
9124
9126 return;
9127 }
9128
9129 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9130 {
9132 }
9133 }
9134 }
9135
9136
9138 {
9139 super.OnRightClick();
9140
9142 {
9144 {
9145 if (ScriptInputUserData.CanStoreInputUserData())
9146 {
9147 EntityAI root = GetHierarchyRoot();
9148 Man playerOwner = GetHierarchyRootPlayer();
9149 InventoryLocation dst = new InventoryLocation;
9150
9151
9152 if (!playerOwner && root && root == this)
9153 {
9155 }
9156 else
9157 {
9158
9159 GetInventory().GetCurrentInventoryLocation(dst);
9161 {
9162 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9164 {
9166 }
9167 else
9168 {
9170
9171
9172 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9173 {
9175 }
9176 else
9177 {
9178 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9179 }
9180 }
9181 }
9182 }
9183
9184 ScriptInputUserData ctx = new ScriptInputUserData;
9192 }
9193 }
9194 else if (!
g_Game.IsMultiplayer())
9195 {
9197 }
9198 }
9199 }
9200
9202 {
9203 if (root)
9204 {
9205 vector m4[4];
9206 root.GetTransform(m4);
9207 dst.SetGround(this, m4);
9208 }
9209 else
9210 {
9211 GetInventory().GetCurrentInventoryLocation(dst);
9212 }
9213 }
9214
9215 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9216 {
9217
9218 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9219 return false;
9220
9221 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9222 return false;
9223
9224
9226 return false;
9227
9228
9229 Magazine mag = Magazine.Cast(this);
9230 if (mag)
9231 {
9232 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9233 return false;
9234
9235 if (stack_max_limit)
9236 {
9237 Magazine other_mag = Magazine.Cast(other_item);
9238 if (other_item)
9239 {
9240 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9241 return false;
9242 }
9243
9244 }
9245 }
9246 else
9247 {
9248
9250 return false;
9251
9253 return false;
9254 }
9255
9256 PlayerBase player = null;
9257 if (CastTo(player, GetHierarchyRootPlayer()))
9258 {
9259 if (player.GetInventory().HasAttachment(this))
9260 return false;
9261
9262 if (player.IsItemsToDelete())
9263 return false;
9264 }
9265
9266 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9267 return false;
9268
9269 int slotID;
9271 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9272 return false;
9273
9274 return true;
9275 }
9276
9278 {
9280 }
9281
9283 {
9284 return m_IsResultOfSplit;
9285 }
9286
9288 {
9289 m_IsResultOfSplit = value;
9290 }
9291
9293 {
9295 }
9296
9298 {
9299 float other_item_quantity = other_item.GetQuantity();
9300 float this_free_space;
9301
9303
9305
9306 if (other_item_quantity > this_free_space)
9307 {
9308 return this_free_space;
9309 }
9310 else
9311 {
9312 return other_item_quantity;
9313 }
9314 }
9315
9317 {
9319 }
9320
9322 {
9324 return;
9325
9326 if (!IsMagazine() && other_item)
9327 {
9329 if (quantity_used != 0)
9330 {
9331 float hp1 = GetHealth01("","");
9332 float hp2 = other_item.GetHealth01("","");
9333 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9334 hpResult = hpResult / (
GetQuantity() + quantity_used);
9335
9336 hpResult *= GetMaxHealth();
9337 Math.Round(hpResult);
9338 SetHealth("", "Health", hpResult);
9339
9341 other_item.AddQuantity(-quantity_used);
9342 }
9343 }
9345 }
9346
9348 {
9349 #ifdef SERVER
9350 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9351 GetHierarchyParent().IncreaseLifetimeUp();
9352 #endif
9353 };
9354
9356 {
9357 PlayerBase p = PlayerBase.Cast(player);
9358
9359 array<int> recipesIds = p.m_Recipes;
9360 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9361 if (moduleRecipesManager)
9362 {
9363 EntityAI itemInHands = player.GetEntityInHands();
9364 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9365 }
9366
9367 for (int i = 0;i < recipesIds.Count(); i++)
9368 {
9369 int key = recipesIds.Get(i);
9370 string recipeName = moduleRecipesManager.GetRecipeName(key);
9372 }
9373 }
9374
9375
9376 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9377 {
9378 super.GetDebugActions(outputList);
9379
9380
9386
9387
9392
9397
9398
9402
9403
9405 {
9409 }
9410
9413
9414
9418
9420
9421 InventoryLocation loc = new InventoryLocation();
9422 GetInventory().GetCurrentInventoryLocation(loc);
9424 {
9425 if (Gizmo_IsSupported())
9428 }
9429
9431 }
9432
9433
9434
9435
9437 {
9438 super.OnAction(action_id, player, ctx);
9439
9441 {
9442 switch (action_id)
9443 {
9447 return true;
9451 return true;
9452 }
9453 }
9454
9456 {
9457 switch (action_id)
9458 {
9460 Delete();
9461 return true;
9462 }
9463 }
9464
9465 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9466 {
9467 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9468 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9469 PlayerBase p = PlayerBase.Cast(player);
9470 if (
EActions.RECIPES_RANGE_START < 1000)
9471 {
9472 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9473 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9474 }
9475 }
9476 #ifndef SERVER
9477 else if (action_id ==
EActions.WATCH_PLAYER)
9478 {
9479 PluginDeveloper.SetDeveloperItemClientEx(player);
9480 }
9481 #endif
9483 {
9484 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9485 {
9486 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9487 OnDebugButtonPressServer(id + 1);
9488 }
9489
9490 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9491 {
9492 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9494 }
9495
9496 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9497 {
9498 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9500 }
9501
9502 else if (action_id ==
EActions.ADD_QUANTITY)
9503 {
9504 if (IsMagazine())
9505 {
9506 Magazine mag = Magazine.Cast(this);
9507 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9508 }
9509 else
9510 {
9512 }
9513
9514 if (m_EM)
9515 {
9516 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9517 }
9518
9519 }
9520
9521 else if (action_id ==
EActions.REMOVE_QUANTITY)
9522 {
9523 if (IsMagazine())
9524 {
9525 Magazine mag2 = Magazine.Cast(this);
9526 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9527 }
9528 else
9529 {
9531 }
9532 if (m_EM)
9533 {
9534 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9535 }
9536
9537 }
9538
9539 else if (action_id ==
EActions.SET_QUANTITY_0)
9540 {
9542
9543 if (m_EM)
9544 {
9545 m_EM.SetEnergy(0);
9546 }
9547 }
9548
9549 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9550 {
9552
9553 if (m_EM)
9554 {
9555 m_EM.SetEnergy(m_EM.GetEnergyMax());
9556 }
9557 }
9558
9559 else if (action_id ==
EActions.ADD_HEALTH)
9560 {
9561 AddHealth("","",GetMaxHealth("","Health")/5);
9562 }
9563 else if (action_id ==
EActions.REMOVE_HEALTH)
9564 {
9565 AddHealth("","",-GetMaxHealth("","Health")/5);
9566 }
9567 else if (action_id ==
EActions.DESTROY_HEALTH)
9568 {
9569 SetHealth01("","",0);
9570 }
9571 else if (action_id ==
EActions.WATCH_ITEM)
9572 {
9574 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9575 #ifdef DEVELOPER
9576 SetDebugDeveloper_item(this);
9577 #endif
9578 }
9579
9580 else if (action_id ==
EActions.ADD_TEMPERATURE)
9581 {
9582 AddTemperature(20);
9583
9584 }
9585
9586 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9587 {
9588 AddTemperature(-20);
9589
9590 }
9591
9592 else if (action_id ==
EActions.FLIP_FROZEN)
9593 {
9594 SetFrozen(!GetIsFrozen());
9595
9596 }
9597
9598 else if (action_id ==
EActions.ADD_WETNESS)
9599 {
9601
9602 }
9603
9604 else if (action_id ==
EActions.REMOVE_WETNESS)
9605 {
9607
9608 }
9609
9610 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9611 {
9614
9615
9616 }
9617
9618 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9619 {
9622 }
9623
9624 else if (action_id ==
EActions.MAKE_SPECIAL)
9625 {
9626 auto debugParams = DebugSpawnParams.WithPlayer(player);
9627 OnDebugSpawnEx(debugParams);
9628 }
9629
9630 }
9631
9632
9633 return false;
9634 }
9635
9636
9637
9638
9642
9645
9646
9647
9649 {
9650 return false;
9651 }
9652
9653
9655 {
9656 return true;
9657 }
9658
9659
9661 {
9662 return true;
9663 }
9664
9665
9666
9668 {
9669 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9670 return g_Game.ConfigIsExisting(config_path);
9671 }
9672
9675 {
9676 return null;
9677 }
9678
9680 {
9681 return false;
9682 }
9683
9685 {
9686 return false;
9687 }
9688
9692
9693
9695 {
9696 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9697 return module_repairing.CanRepair(this, item_repair_kit);
9698 }
9699
9700
9701 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9702 {
9703 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9704 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9705 }
9706
9707
9709 {
9710
9711
9712
9713
9714
9715
9716
9717
9718 return 1;
9719 }
9720
9721
9722
9724 {
9726 }
9727
9728
9729
9731 {
9733 }
9734
9735
9744 {
9745 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9746
9747 if (player)
9748 {
9749 player.MessageStatus(text);
9750 }
9751 }
9752
9753
9762 {
9763 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9764
9765 if (player)
9766 {
9767 player.MessageAction(text);
9768 }
9769 }
9770
9771
9780 {
9781 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9782
9783 if (player)
9784 {
9785 player.MessageFriendly(text);
9786 }
9787 }
9788
9789
9798 {
9799 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9800
9801 if (player)
9802 {
9803 player.MessageImportant(text);
9804 }
9805 }
9806
9808 {
9809 return true;
9810 }
9811
9812
9813 override bool KindOf(
string tag)
9814 {
9815 bool found = false;
9816 string item_name = this.
GetType();
9818 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9819
9820 int array_size = item_tag_array.Count();
9821 for (int i = 0; i < array_size; i++)
9822 {
9823 if (item_tag_array.Get(i) == tag)
9824 {
9825 found = true;
9826 break;
9827 }
9828 }
9829 return found;
9830 }
9831
9832
9834 {
9835
9836 super.OnRPC(sender, rpc_type,ctx);
9837
9838
9839 switch (rpc_type)
9840 {
9841 #ifndef SERVER
9842 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9843 Param2<bool, string> p = new Param2<bool, string>(false, "");
9844
9846 return;
9847
9848 bool play = p.param1;
9849 string soundSet = p.param2;
9850
9851 if (play)
9852 {
9854 {
9856 {
9858 }
9859 }
9860 else
9861 {
9863 }
9864 }
9865 else
9866 {
9868 }
9869
9870 break;
9871 #endif
9872
9873 }
9874
9876 {
9878 }
9879 }
9880
9881
9882
9883
9885 {
9886 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9887 return plugin.GetID(
name);
9888 }
9889
9891 {
9892 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9893 return plugin.GetName(id);
9894 }
9895
9898 {
9899
9900
9901 int varFlags;
9902 if (!ctx.
Read(varFlags))
9903 return;
9904
9905 if (varFlags & ItemVariableFlags.FLOAT)
9906 {
9908 }
9909 }
9910
9912 {
9913
9914 super.SerializeNumericalVars(floats_out);
9915
9916
9917
9919 {
9921 }
9922
9924 {
9926 }
9927
9929 {
9931 }
9932
9934 {
9939 }
9940
9942 {
9944 }
9945 }
9946
9948 {
9949
9950 super.DeSerializeNumericalVars(floats);
9951
9952
9953 int index = 0;
9954 int mask = Math.Round(floats.Get(index));
9955
9956 index++;
9957
9959 {
9961 {
9963 }
9964 else
9965 {
9966 float quantity = floats.Get(index);
9968 }
9969 index++;
9970 }
9971
9973 {
9974 float wet = floats.Get(index);
9976 index++;
9977 }
9978
9980 {
9981 int liquidtype = Math.Round(floats.Get(index));
9983 index++;
9984 }
9985
9987 {
9989 index++;
9991 index++;
9993 index++;
9995 index++;
9996 }
9997
9999 {
10000 int cleanness = Math.Round(floats.Get(index));
10002 index++;
10003 }
10004 }
10005
10007 {
10008 super.WriteVarsToCTX(ctx);
10009
10010
10012 {
10014 }
10015
10017 {
10019 }
10020
10022 {
10024 }
10025
10027 {
10028 int r,g,b,a;
10034 }
10035
10037 {
10039 }
10040 }
10041
10043 {
10044 if (!super.ReadVarsFromCTX(ctx,version))
10045 return false;
10046
10047 int intValue;
10048 float value;
10049
10050 if (version < 140)
10051 {
10052 if (!ctx.
Read(intValue))
10053 return false;
10054
10055 m_VariablesMask = intValue;
10056 }
10057
10059 {
10060 if (!ctx.
Read(value))
10061 return false;
10062
10064 {
10066 }
10067 else
10068 {
10070 }
10071 }
10072
10073 if (version < 140)
10074 {
10076 {
10077 if (!ctx.
Read(value))
10078 return false;
10079 SetTemperatureDirect(value);
10080 }
10081 }
10082
10084 {
10085 if (!ctx.
Read(value))
10086 return false;
10088 }
10089
10091 {
10092 if (!ctx.
Read(intValue))
10093 return false;
10095 }
10096
10098 {
10099 int r,g,b,a;
10101 return false;
10103 return false;
10105 return false;
10107 return false;
10108
10110 }
10111
10113 {
10114 if (!ctx.
Read(intValue))
10115 return false;
10117 }
10118
10119 if (version >= 138 && version < 140)
10120 {
10122 {
10123 if (!ctx.
Read(intValue))
10124 return false;
10125 SetFrozen(intValue);
10126 }
10127 }
10128
10129 return true;
10130 }
10131
10132
10134 {
10137 {
10139 }
10140
10141 if (!super.OnStoreLoad(ctx, version))
10142 {
10144 return false;
10145 }
10146
10147 if (version >= 114)
10148 {
10149 bool hasQuickBarIndexSaved;
10150
10151 if (!ctx.
Read(hasQuickBarIndexSaved))
10152 {
10154 return false;
10155 }
10156
10157 if (hasQuickBarIndexSaved)
10158 {
10159 int itmQBIndex;
10160
10161
10162 if (!ctx.
Read(itmQBIndex))
10163 {
10165 return false;
10166 }
10167
10168 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10169 if (itmQBIndex != -1 && parentPlayer)
10170 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10171 }
10172 }
10173 else
10174 {
10175
10176 PlayerBase player;
10177 int itemQBIndex;
10178 if (version ==
int.
MAX)
10179 {
10180 if (!ctx.
Read(itemQBIndex))
10181 {
10183 return false;
10184 }
10185 }
10186 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10187 {
10188
10189 if (!ctx.
Read(itemQBIndex))
10190 {
10192 return false;
10193 }
10194 if (itemQBIndex != -1 && player)
10195 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10196 }
10197 }
10198
10199 if (version < 140)
10200 {
10201
10202 if (!LoadVariables(ctx, version))
10203 {
10205 return false;
10206 }
10207 }
10208
10209
10211 {
10213 return false;
10214 }
10215 if (version >= 132)
10216 {
10218 if (raib)
10219 {
10221 {
10223 return false;
10224 }
10225 }
10226 }
10227
10229 return true;
10230 }
10231
10232
10233
10235 {
10236 super.OnStoreSave(ctx);
10237
10238 PlayerBase player;
10239 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10240 {
10242
10243 int itemQBIndex = -1;
10244 itemQBIndex = player.FindQuickBarEntityIndex(this);
10245 ctx.
Write(itemQBIndex);
10246 }
10247 else
10248 {
10250 }
10251
10253
10255 if (raib)
10256 {
10258 }
10259 }
10260
10261
10263 {
10264 super.AfterStoreLoad();
10265
10267 {
10269 }
10270
10272 {
10275 }
10276 }
10277
10279 {
10280 super.EEOnAfterLoad();
10281
10283 {
10285 }
10286
10289 }
10290
10292 {
10293 return false;
10294 }
10295
10296
10297
10299 {
10301 {
10302 #ifdef PLATFORM_CONSOLE
10303
10305 {
10307 if (menu)
10308 {
10310 }
10311 }
10312 #endif
10313 }
10314
10316 {
10319 }
10320
10322 {
10323 SetWeightDirty();
10325 }
10327 {
10330 }
10331
10333 {
10336
10339 }
10341 {
10345 }
10346
10347 super.OnVariablesSynchronized();
10348 }
10349
10350
10351
10353 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10354 {
10355 if (!IsServerCheck(allow_client))
10356 return false;
10357
10359 return false;
10360
10363
10364 if (value <= (min + 0.001))
10365 value = min;
10366
10367 if (value == min)
10368 {
10369 if (destroy_config)
10370 {
10371 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10372 if (dstr)
10373 {
10375 this.Delete();
10376 return true;
10377 }
10378 }
10379 else if (destroy_forced)
10380 {
10382 this.Delete();
10383 return true;
10384 }
10385
10387 }
10388
10391
10393 {
10394 EntityAI parent = GetHierarchyRoot();
10395 InventoryLocation iLoc = new InventoryLocation();
10396 GetInventory().GetCurrentInventoryLocation(iLoc);
10398 {
10399 int iLocSlot = iLoc.
GetSlot();
10401 {
10403 }
10405 {
10407 }
10408 }
10409 }
10410
10412 {
10414
10415 if (delta)
10417 }
10418
10420
10421 return false;
10422 }
10423
10424
10426 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10427 {
10429 }
10430
10432 {
10435 }
10436
10438 {
10441 }
10442
10444 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10445 {
10446 float value_clamped = Math.Clamp(value, 0, 1);
10448 SetQuantity(result, destroy_config, destroy_forced);
10449 }
10450
10451
10454 {
10456 }
10457
10459 {
10461 }
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10473 {
10474 int slot = -1;
10475 GameInventory inventory = GetInventory();
10476 if (inventory)
10477 {
10478 InventoryLocation il = new InventoryLocation;
10481 }
10482
10484 }
10485
10487 {
10488 float quantity_max = 0;
10489
10491 {
10492 if (attSlotID != -1)
10493 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10494
10495 if (quantity_max <= 0)
10497 }
10498
10499 if (quantity_max <= 0)
10501
10502 return quantity_max;
10503 }
10504
10506 {
10508 }
10509
10511 {
10513 }
10514
10515
10517 {
10519 }
10520
10522 {
10524 }
10525
10527 {
10529 }
10530
10531
10533 {
10534
10535 float weightEx = GetWeightEx();
10536 float special = GetInventoryAndCargoWeight();
10537 return weightEx - special;
10538 }
10539
10540
10542 {
10544 }
10545
10547 {
10549 {
10550 #ifdef DEVELOPER
10551 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10552 {
10553 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10555 }
10556 #endif
10557
10558 return GetQuantity() * GetConfigWeightModified();
10559 }
10560 else if (HasEnergyManager())
10561 {
10562 #ifdef DEVELOPER
10563 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10564 {
10565 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10566 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10567 }
10568 #endif
10569 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10570 }
10571 else
10572 {
10573 #ifdef DEVELOPER
10574 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10575 {
10576 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10577 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10578 }
10579 #endif
10580 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10581 }
10582 }
10583
10586 {
10587 int item_count = 0;
10589
10590 GameInventory inventory = GetInventory();
10591 CargoBase cargo = inventory.
GetCargo();
10592 if (cargo != NULL)
10593 {
10595 }
10596
10598 for (int i = 0; i < nAttachments; ++i)
10599 {
10601 if (item)
10602 item_count += item.GetNumberOfItems();
10603 }
10604 return item_count;
10605 }
10606
10609 {
10610 float weight = 0;
10611 float wetness = 1;
10612 if (include_wetness)
10615 {
10616 weight = wetness * m_ConfigWeight;
10617 }
10619 {
10620 weight = 1;
10621 }
10622 return weight;
10623 }
10624
10625
10626
10628 {
10629 GameInventory inventory = GetInventory();
10630 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10631 {
10632 array<EntityAI> items = new array<EntityAI>;
10634 for (int i = 0; i < items.Count(); ++i)
10635 {
10637 if (item)
10638 {
10639 g_Game.ObjectDelete(item);
10640 }
10641 }
10642 }
10643 }
10644
10645
10646
10647
10649 {
10650 float energy = 0;
10651 if (HasEnergyManager())
10652 {
10653 energy = GetCompEM().GetEnergy();
10654 }
10655 return energy;
10656 }
10657
10658
10660 {
10661 super.OnEnergyConsumed();
10662
10664 }
10665
10667 {
10668 super.OnEnergyAdded();
10669
10671 }
10672
10673
10675 {
10676 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10677 {
10679 {
10680 float energy_0to1 = GetCompEM().GetEnergy0To1();
10682 }
10683 }
10684 }
10685
10686
10688 {
10689 return ConfigGetFloat("heatIsolation");
10690 }
10691
10693 {
10695 }
10696
10698 {
10699 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10700 if (
g_Game.ConfigIsExisting(paramPath))
10701 return g_Game.ConfigGetFloat(paramPath);
10702
10703 return 0.0;
10704 }
10705
10707 {
10708 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10709 if (
g_Game.ConfigIsExisting(paramPath))
10710 return g_Game.ConfigGetFloat(paramPath);
10711
10712 return 0.0;
10713 }
10714
10715 override void SetWet(
float value,
bool allow_client =
false)
10716 {
10717 if (!IsServerCheck(allow_client))
10718 return;
10719
10722
10724
10725 m_VarWet = Math.Clamp(value, min, max);
10726
10728 {
10731 }
10732 }
10733
10734 override void AddWet(
float value)
10735 {
10737 }
10738
10740 {
10742 }
10743
10745 {
10747 }
10748
10750 {
10752 }
10753
10755 {
10757 }
10758
10760 {
10762 }
10763
10764 override void OnWetChanged(
float newVal,
float oldVal)
10765 {
10768 if (newLevel != oldLevel)
10769 {
10771 }
10772 }
10773
10775 {
10776 SetWeightDirty();
10777 }
10778
10780 {
10781 return GetWetLevelInternal(
m_VarWet);
10782 }
10783
10784
10785
10787 {
10789 }
10790
10792 {
10794 }
10795
10797 {
10799 }
10800
10802 {
10804 }
10805
10806
10807
10809 {
10810 if (ConfigIsExisting("itemModelLength"))
10811 {
10812 return ConfigGetFloat("itemModelLength");
10813 }
10814 return 0;
10815 }
10816
10818 {
10819 if (ConfigIsExisting("itemAttachOffset"))
10820 {
10821 return ConfigGetFloat("itemAttachOffset");
10822 }
10823 return 0;
10824 }
10825
10826 override void SetCleanness(
int value,
bool allow_client =
false)
10827 {
10828 if (!IsServerCheck(allow_client))
10829 return;
10830
10832
10834
10837 }
10838
10840 {
10842 }
10843
10845 {
10846 return true;
10847 }
10848
10849
10850
10851
10853 {
10855 }
10856
10858 {
10860 }
10861
10862
10863
10864
10865 override void SetColor(
int r,
int g,
int b,
int a)
10866 {
10872 }
10874 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10875 {
10880 }
10881
10883 {
10885 }
10886
10889 {
10890 int r,g,b,a;
10892 r = r/255;
10893 g = g/255;
10894 b = b/255;
10895 a = a/255;
10896 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10897 }
10898
10899
10900
10901 override void SetLiquidType(
int value,
bool allow_client =
false)
10902 {
10903 if (!IsServerCheck(allow_client))
10904 return;
10905
10910 }
10911
10913 {
10914 return ConfigGetInt("varLiquidTypeInit");
10915 }
10916
10918 {
10920 }
10921
10923 {
10925 SetFrozen(false);
10926 }
10927
10930 {
10931 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10932 }
10933
10934
10937 {
10938 PlayerBase nplayer;
10939 if (PlayerBase.CastTo(nplayer, player))
10940 {
10942 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10943 }
10944 }
10945
10946
10949 {
10950 PlayerBase nplayer;
10951 if (PlayerBase.CastTo(nplayer,player))
10952 {
10953 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10954 }
10955
10956 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10957
10958 if (HasEnergyManager())
10959 {
10960 GetCompEM().UpdatePlugState();
10961 }
10962 }
10963
10964
10966 {
10967 super.OnPlacementStarted(player);
10968
10970 }
10971
10972 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10973 {
10975 {
10976 m_AdminLog.OnPlacementComplete(player,
this);
10977 }
10978
10979 super.OnPlacementComplete(player, position, orientation);
10980 }
10981
10982
10983
10984
10985
10987 {
10989 {
10990 return true;
10991 }
10992 else
10993 {
10994 return false;
10995 }
10996 }
10997
10998
11000 {
11002 {
11004 }
11005 }
11006
11007
11009 {
11011 }
11012
11014 {
11016 }
11017
11018 override void InsertAgent(
int agent,
float count = 1)
11019 {
11020 if (count < 1)
11021 return;
11022
11024 }
11025
11028 {
11030 }
11031
11032
11034 {
11036 }
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11080 {
11082 return false;
11083 return true;
11084 }
11085
11087 {
11088
11090 }
11091
11092
11095 {
11096 super.CheckForRoofLimited(timeTresholdMS);
11097
11098 float time =
g_Game.GetTime();
11099 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11100 {
11101 m_PreviousRoofTestTime = time;
11102 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11103 }
11104 }
11105
11106
11108 {
11110 {
11111 return 0;
11112 }
11113
11114 if (GetInventory().GetAttachmentSlotsCount() != 0)
11115 {
11116 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11117 if (filter)
11118 return filter.GetProtectionLevel(type, false, system);
11119 else
11120 return 0;
11121 }
11122
11123 string subclassPath, entryName;
11124
11125 switch (type)
11126 {
11128 entryName = "biological";
11129 break;
11131 entryName = "chemical";
11132 break;
11133 default:
11134 entryName = "biological";
11135 break;
11136 }
11137
11138 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11139
11140 return g_Game.ConfigGetFloat(subclassPath + entryName);
11141 }
11142
11143
11144
11147 {
11148 if (!IsMagazine())
11150
11152 }
11153
11154
11155
11156
11157
11162 {
11163 return true;
11164 }
11165
11167 {
11169 }
11170
11171
11172
11173
11174
11176 {
11177 if (parent)
11178 {
11179 if (parent.IsInherited(DayZInfected))
11180 return true;
11181
11182 if (!parent.IsRuined())
11183 return true;
11184 }
11185
11186 return true;
11187 }
11188
11190 {
11191 if (!super.CanPutAsAttachment(parent))
11192 {
11193 return false;
11194 }
11195
11196 if (!IsRuined() && !parent.IsRuined())
11197 {
11198 return true;
11199 }
11200
11201 return false;
11202 }
11203
11205 {
11206
11207
11208
11209
11210 return super.CanReceiveItemIntoCargo(item);
11211 }
11212
11214 {
11215
11216
11217
11218
11219 GameInventory attachmentInv = attachment.GetInventory();
11221 {
11222 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11223 return false;
11224 }
11225
11226 InventoryLocation loc = new InventoryLocation();
11227 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11228 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11229 return false;
11230
11231 return super.CanReceiveAttachment(attachment, slotId);
11232 }
11233
11235 {
11236 if (!super.CanReleaseAttachment(attachment))
11237 return false;
11238
11239 return GetInventory().AreChildrenAccessible();
11240 }
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11263 {
11264 int id = muzzle_owner.GetMuzzleID();
11265 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11266
11267 if (WPOF_array)
11268 {
11269 for (int i = 0; i < WPOF_array.Count(); i++)
11270 {
11271 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11272
11273 if (WPOF)
11274 {
11275 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11276 }
11277 }
11278 }
11279 }
11280
11281
11283 {
11284 int id = muzzle_owner.GetMuzzleID();
11286
11287 if (WPOBE_array)
11288 {
11289 for (int i = 0; i < WPOBE_array.Count(); i++)
11290 {
11291 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11292
11293 if (WPOBE)
11294 {
11295 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11296 }
11297 }
11298 }
11299 }
11300
11301
11303 {
11304 int id = muzzle_owner.GetMuzzleID();
11305 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11306
11307 if (WPOOH_array)
11308 {
11309 for (int i = 0; i < WPOOH_array.Count(); i++)
11310 {
11311 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11312
11313 if (WPOOH)
11314 {
11315 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11316 }
11317 }
11318 }
11319 }
11320
11321
11323 {
11324 int id = muzzle_owner.GetMuzzleID();
11325 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11326
11327 if (WPOOH_array)
11328 {
11329 for (int i = 0; i < WPOOH_array.Count(); i++)
11330 {
11331 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11332
11333 if (WPOOH)
11334 {
11335 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11336 }
11337 }
11338 }
11339 }
11340
11341
11343 {
11344 int id = muzzle_owner.GetMuzzleID();
11345 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11346
11347 if (WPOOH_array)
11348 {
11349 for (int i = 0; i < WPOOH_array.Count(); i++)
11350 {
11351 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11352
11353 if (WPOOH)
11354 {
11355 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11356 }
11357 }
11358 }
11359 }
11360
11361
11362
11364 {
11366 {
11367 return true;
11368 }
11369
11370 return false;
11371 }
11372
11374 {
11376 {
11377 return true;
11378 }
11379
11380 return false;
11381 }
11382
11384 {
11386 {
11387 return true;
11388 }
11389
11390 return false;
11391 }
11392
11394 {
11395 return false;
11396 }
11397
11400 {
11401 return UATimeSpent.DEFAULT_DEPLOY;
11402 }
11403
11404
11405
11406
11408 {
11410 SetSynchDirty();
11411 }
11412
11414 {
11416 }
11417
11418
11420 {
11421 return false;
11422 }
11423
11426 {
11427 string att_type = "None";
11428
11429 if (ConfigIsExisting("soundAttType"))
11430 {
11431 att_type = ConfigGetString("soundAttType");
11432 }
11433
11435 }
11436
11438 {
11440 }
11441
11442
11443
11444
11445
11451
11453 {
11456
11458 }
11459
11460
11462 {
11464 return;
11465
11467
11470
11473
11474 SoundParameters params = new SoundParameters();
11478 }
11479
11480
11482 {
11484 {
11487
11488 SetSynchDirty();
11489
11492 }
11493 }
11494
11496 {
11498 }
11499
11500
11502 {
11504 return;
11505
11507 SetSynchDirty();
11508
11511 }
11512
11514 {
11517 }
11518
11520 {
11522 }
11523
11524 void OnApply(PlayerBase player);
11525
11527 {
11528 return 1.0;
11529 };
11530
11532 {
11534 }
11535
11537 {
11539 }
11540
11542
11544 {
11545 SetDynamicPhysicsLifeTime(0.01);
11547 }
11548
11550 {
11551 array<string> zone_names = new array<string>;
11552 GetDamageZones(zone_names);
11553 for (int i = 0; i < zone_names.Count(); i++)
11554 {
11555 SetHealthMax(zone_names.Get(i),"Health");
11556 }
11557 SetHealthMax("","Health");
11558 }
11559
11562 {
11563 float global_health = GetHealth01("","Health");
11564 array<string> zones = new array<string>;
11565 GetDamageZones(zones);
11566
11567 for (int i = 0; i < zones.Count(); i++)
11568 {
11569 SetHealth01(zones.Get(i),"Health",global_health);
11570 }
11571 }
11572
11575 {
11576 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11577 }
11578
11580 {
11581 if (!hasRootAsPlayer)
11582 {
11583 if (refParentIB)
11584 {
11585
11586 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11587 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11588
11589 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11590 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11591
11594 }
11595 else
11596 {
11597
11600 }
11601 }
11602 }
11603
11605 {
11607 {
11608 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11609 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11610 {
11611 float heatPermCoef = 1.0;
11613 while (ent)
11614 {
11615 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11616 ent = ent.GetHierarchyParent();
11617 }
11618
11619 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11620 }
11621 }
11622 }
11623
11625 {
11626
11627 EntityAI parent = GetHierarchyParent();
11628 if (!parent)
11629 {
11630 hasParent = false;
11631 hasRootAsPlayer = false;
11632 }
11633 else
11634 {
11635 hasParent = true;
11636 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11637 refParentIB =
ItemBase.Cast(parent);
11638 }
11639 }
11640
11641 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11642 {
11643
11644 }
11645
11647 {
11648
11649 return false;
11650 }
11651
11653 {
11654
11655
11656 return false;
11657 }
11658
11660 {
11661
11662 return false;
11663 }
11664
11667 {
11668 return !GetIsFrozen() &&
IsOpen();
11669 }
11670
11672 {
11673 bool hasParent = false, hasRootAsPlayer = false;
11675
11676 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11677 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11678
11679 if (wwtu || foodDecay)
11680 {
11684
11685 if (processWetness || processTemperature || processDecay)
11686 {
11688
11689 if (processWetness)
11690 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11691
11692 if (processTemperature)
11694
11695 if (processDecay)
11696 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11697 }
11698 }
11699 }
11700
11703 {
11705 }
11706
11708 {
11711
11712 return super.GetTemperatureFreezeThreshold();
11713 }
11714
11716 {
11719
11720 return super.GetTemperatureThawThreshold();
11721 }
11722
11724 {
11727
11728 return super.GetItemOverheatThreshold();
11729 }
11730
11732 {
11734 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11735
11736 return super.GetTemperatureFreezeTime();
11737 }
11738
11740 {
11742 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11743
11744 return super.GetTemperatureThawTime();
11745 }
11746
11751
11753 {
11754 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11755 }
11756
11758 {
11759 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11760 }
11761
11764 {
11766 }
11767
11769 {
11771 }
11772
11774 {
11776 }
11777
11780 {
11781 return null;
11782 }
11783
11786 {
11787 return false;
11788 }
11789
11791 {
11793 {
11796 if (!trg)
11797 {
11799 explosive = this;
11800 }
11801
11802 explosive.PairRemote(trg);
11804
11805 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11806 trg.SetPersistentPairID(persistentID);
11807 explosive.SetPersistentPairID(persistentID);
11808
11809 return true;
11810 }
11811 return false;
11812 }
11813
11816 {
11817 float ret = 1.0;
11820 ret *= GetHealth01();
11821
11822 return ret;
11823 }
11824
11825 #ifdef DEVELOPER
11826 override void SetDebugItem()
11827 {
11828 super.SetDebugItem();
11829 _itemBase = this;
11830 }
11831
11833 {
11834 string text = super.GetDebugText();
11835
11837 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11838
11839 return text;
11840 }
11841 #endif
11842
11844 {
11845 return true;
11846 }
11847
11849
11851
11853 {
11856 }
11857
11858
11866
11882
11883 [
Obsolete(
"Use ItemSoundHandler instead")]
11886 {
11887 if (!
g_Game.IsDedicatedServer())
11888 {
11889 if (ConfigIsExisting("attachSoundSet"))
11890 {
11891 string cfg_path = "";
11892 string soundset = "";
11893 string type_name =
GetType();
11894
11897 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11898 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11899
11900 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11901 {
11902 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11903 {
11904 if (cfg_slot_array[i] == slot_type)
11905 {
11906 soundset = cfg_soundset_array[i];
11907 break;
11908 }
11909 }
11910 }
11911
11912 if (soundset != "")
11913 {
11914 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11916 }
11917 }
11918 }
11919 }
11920
11922}
11923
11925{
11927 if (entity)
11928 {
11929 bool is_item = entity.IsInherited(
ItemBase);
11930 if (is_item && full_quantity)
11931 {
11934 }
11935 }
11936 else
11937 {
11939 return NULL;
11940 }
11941 return entity;
11942}
11943
11945{
11946 if (item)
11947 {
11948 if (health > 0)
11949 item.SetHealth("", "", health);
11950
11951 if (item.CanHaveTemperature())
11952 {
11954 if (item.CanFreeze())
11955 item.SetFrozen(false);
11956 }
11957
11958 if (item.HasEnergyManager())
11959 {
11960 if (quantity >= 0)
11961 {
11962 item.GetCompEM().SetEnergy0To1(quantity);
11963 }
11964 else
11965 {
11967 }
11968 }
11969 else if (item.IsMagazine())
11970 {
11971 Magazine mag = Magazine.Cast(item);
11972 if (quantity >= 0)
11973 {
11974 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11975 }
11976 else
11977 {
11979 }
11980
11981 }
11982 else
11983 {
11984 if (quantity >= 0)
11985 {
11986 item.SetQuantityNormalized(quantity, false);
11987 }
11988 else
11989 {
11991 }
11992
11993 }
11994 }
11995}
11996
11997#ifdef DEVELOPER
11999#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.