7082{
7084 {
7085 return true;
7086 }
7087};
7088
7089
7090
7092{
7096
7098
7101
7102
7103
7104
7105
7114
7120
7125
7130
7151 protected bool m_IsResultOfSplit
7152
7154
7159
7160
7161
7163
7167
7168
7169
7171
7174
7175
7176
7182
7183
7191
7194
7195
7197
7198
7200
7201
7206
7207
7212
7213
7215
7216
7218 {
7223
7224 if (!
GetGame().IsDedicatedServer())
7225 {
7227 {
7229
7231 {
7233 }
7234 }
7235
7238 }
7239
7240 m_OldLocation = null;
7241
7243 {
7245 }
7246
7247 if (ConfigIsExisting("headSelectionsToHide"))
7248 {
7251 }
7252
7254 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7255 {
7257 }
7258
7260
7261 m_IsResultOfSplit = false;
7262
7264 }
7265
7267 {
7268 super.InitItemVariables();
7269
7275 m_Count = ConfigGetInt(
"count");
7276
7279
7284
7287
7292
7304
7308
7309
7312 if (ConfigIsExisting("canBeSplit"))
7313 {
7316 }
7317
7319 if (ConfigIsExisting("itemBehaviour"))
7321
7322
7325 RegisterNetSyncVariableInt("m_VarLiquidType");
7326 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7327
7328 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7329 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7330 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7331
7332 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7333 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7334 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7335 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7336
7337 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7338 RegisterNetSyncVariableBool("m_IsTakeable");
7339 RegisterNetSyncVariableBool("m_IsHologram");
7340
7343 {
7346 }
7347
7349
7351 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7353
7354 }
7355
7357 {
7359 }
7360
7362 {
7365 {
7370 }
7371 }
7372
7373 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7374 {
7376 {
7379 }
7380
7382 }
7383
7385 {
7391 }
7392
7394
7396 {
7398
7399 if (!action)
7400 {
7401 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7402 return;
7403 }
7404
7406 if (!ai)
7407 {
7409 return;
7410 }
7411
7413 if (!action_array)
7414 {
7415 action_array = new array<ActionBase_Basic>;
7417 }
7418 if (LogManager.IsActionLogEnable())
7419 {
7420 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7421 }
7422
7423 if (action_array.Find(action) != -1)
7424 {
7425 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7426 }
7427 else
7428 {
7429 action_array.Insert(action);
7430 }
7431 }
7432
7434 {
7436 ActionBase action = player.GetActionManager().GetAction(actionName);
7439
7440 if (action_array)
7441 {
7442 action_array.RemoveItem(action);
7443 }
7444 }
7445
7446
7447
7449 {
7450 ActionOverrideData overrideData = new ActionOverrideData();
7454
7456 if (!actionMap)
7457 {
7460 }
7461
7462 actionMap.Insert(this.
Type(), overrideData);
7463
7464 }
7465
7467
7469
7470
7472 {
7475
7478
7479 string config_to_search = "CfgVehicles";
7480 string muzzle_owner_config;
7481
7483 {
7484 if (IsInherited(Weapon))
7485 config_to_search = "CfgWeapons";
7486
7487 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7488
7489 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7490
7492
7493 if (config_OnFire_subclass_count > 0)
7494 {
7495 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7496
7497 for (int i = 0; i < config_OnFire_subclass_count; i++)
7498 {
7499 string particle_class = "";
7501 string config_OnFire_entry = config_OnFire_class + particle_class;
7502 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7503 WPOF_array.Insert(WPOF);
7504 }
7505
7506
7508 }
7509 }
7510
7512 {
7513 config_to_search = "CfgWeapons";
7514 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7515
7516 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7517
7519
7520 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7521 {
7522 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7523
7524 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7525 {
7526 string particle_class2 = "";
7528 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7529 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7530 WPOBE_array.Insert(WPOBE);
7531 }
7532
7533
7535 }
7536 }
7537 }
7538
7539
7541 {
7544
7546 {
7547 string config_to_search = "CfgVehicles";
7548
7549 if (IsInherited(Weapon))
7550 config_to_search = "CfgWeapons";
7551
7552 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7553 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7554
7555 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7556 {
7557
7559
7561 {
7563 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7565 return;
7566 }
7567
7570
7571
7572
7574 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7575
7576 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7577 {
7578 string particle_class = "";
7580 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7582
7583 if (entry_type == CT_CLASS)
7584 {
7585 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7586 WPOOH_array.Insert(WPOF);
7587 }
7588 }
7589
7590
7592 }
7593 }
7594 }
7595
7597 {
7599 }
7600
7602 {
7604 {
7606
7609
7612
7613 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7614 }
7615 }
7616
7618 {
7620 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7621
7623 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7624
7626 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7627
7629 {
7631 }
7632 }
7633
7635 {
7637 }
7638
7640 {
7643 else
7645
7647 {
7650 }
7651 else
7652 {
7655
7658 }
7659
7661 }
7662
7664 {
7666 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7667 }
7668
7670 {
7672 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7674 }
7675
7677 {
7679 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7680 }
7681
7683 {
7686
7687 OverheatingParticle OP = new OverheatingParticle();
7692
7694 }
7695
7697 {
7700
7701 return -1;
7702 }
7703
7705 {
7707 {
7710
7711 for (int i = count; i > 0; --i)
7712 {
7713 int id = i - 1;
7716
7719
7720 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7721 {
7722 if (p)
7723 {
7726 }
7727 }
7728 }
7729 }
7730 }
7731
7733 {
7735 {
7737 {
7738 int id = i - 1;
7740
7741 if (OP)
7742 {
7744
7745 if (p)
7746 {
7748 }
7749
7750 delete OP;
7751 }
7752 }
7753
7756 }
7757 }
7758
7761 {
7762 return 0.0;
7763 }
7764
7765
7767 {
7768 return 250;
7769 }
7770
7772 {
7773 return 0;
7774 }
7775
7778 {
7780 return true;
7781
7782 return false;
7783 }
7784
7787 {
7790
7792 {
7794 }
7795 else
7796 {
7797
7799 }
7800
7802 }
7803
7810 {
7811 return -1;
7812 }
7813
7814
7815
7816
7818 {
7820 {
7822 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7823
7824 if (r_index >= 0)
7825 {
7826 InventoryLocation r_il = new InventoryLocation;
7827 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7828
7829 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7832 {
7833 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7834 }
7836 {
7837 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7838 }
7839
7840 }
7841
7842 player.GetHumanInventory().ClearUserReservedLocation(this);
7843 }
7844
7847 }
7848
7849
7850
7851
7853 {
7854 return ItemBase.m_DebugActionsMask;
7855 }
7856
7858 {
7859 return ItemBase.m_DebugActionsMask & mask;
7860 }
7861
7863 {
7864 ItemBase.m_DebugActionsMask = mask;
7865 }
7866
7868 {
7869 ItemBase.m_DebugActionsMask |= mask;
7870 }
7871
7873 {
7874 ItemBase.m_DebugActionsMask &= ~mask;
7875 }
7876
7878 {
7880 {
7882 }
7883 else
7884 {
7886 }
7887 }
7888
7889
7891 {
7892 if (GetEconomyProfile())
7893 {
7894 float q_max = GetEconomyProfile().GetQuantityMax();
7895 if (q_max > 0)
7896 {
7897 float q_min = GetEconomyProfile().GetQuantityMin();
7898 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7899
7901 {
7902 ComponentEnergyManager comp = GetCompEM();
7904 {
7906 }
7907 }
7909 {
7911
7912 }
7913
7914 }
7915 }
7916 }
7917
7920 {
7921 EntityAI parent = GetHierarchyParent();
7922
7923 if (parent)
7924 {
7925 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7926 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7927 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7928 }
7929 }
7930
7933 {
7934 EntityAI parent = GetHierarchyParent();
7935
7936 if (parent)
7937 {
7938 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7939 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7940 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7941 }
7942 }
7943
7945 {
7946
7947
7948
7949
7951
7953 {
7954 if (ScriptInputUserData.CanStoreInputUserData())
7955 {
7956 ScriptInputUserData ctx = new ScriptInputUserData;
7962 ctx.
Write(use_stack_max);
7965
7967 {
7968 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7969 }
7970 }
7971 }
7972 else if (!
GetGame().IsMultiplayer())
7973 {
7975 }
7976 }
7977
7979 {
7981 }
7982
7984 {
7986 }
7987
7989 {
7991 }
7992
7994 {
7995
7996 return false;
7997 }
7998
8000 {
8001 return false;
8002 }
8003
8007 {
8008 return false;
8009 }
8010
8012 {
8013 return "";
8014 }
8015
8017
8019 {
8020 return false;
8021 }
8022
8024 {
8025 return true;
8026 }
8027
8028
8029
8031 {
8032 return true;
8033 }
8034
8036 {
8037 return true;
8038 }
8039
8041 {
8042 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8044 }
8045
8047 {
8049 }
8050
8052 {
8054 if (!is_being_placed)
8056 SetSynchDirty();
8057 }
8058
8059
8061
8063 {
8065 }
8066
8068 {
8070 }
8071
8073 {
8074 return 1;
8075 }
8076
8078 {
8079 return false;
8080 }
8081
8083 {
8085 SetSynchDirty();
8086 }
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8123 {
8124 super.OnMovedInsideCargo(container);
8125
8126 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8127 }
8128
8129 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8130 {
8131 super.EEItemLocationChanged(oldLoc,newLoc);
8132
8133 PlayerBase new_player = null;
8134 PlayerBase old_player = null;
8135
8136 if (newLoc.GetParent())
8137 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8138
8139 if (oldLoc.GetParent())
8140 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8141
8143 {
8144 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8145
8146 if (r_index >= 0)
8147 {
8148 InventoryLocation r_il = new InventoryLocation;
8149 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8150
8151 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8154 {
8155 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8156 }
8158 {
8159 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8160 }
8161
8162 }
8163 }
8164
8166 {
8167 if (new_player)
8168 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8169
8170 if (new_player == old_player)
8171 {
8172
8173 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8174 {
8176 {
8177 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8178 {
8179 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8180 }
8181 }
8182 else
8183 {
8184 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8185 }
8186 }
8187
8188 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8189 {
8190 int type = oldLoc.GetType();
8192 {
8193 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8194 }
8196 {
8197 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8198 }
8199 }
8200 if (!m_OldLocation)
8201 {
8202 m_OldLocation = new InventoryLocation;
8203 }
8204 m_OldLocation.Copy(oldLoc);
8205 }
8206 else
8207 {
8208 if (m_OldLocation)
8209 {
8210 m_OldLocation.Reset();
8211 }
8212 }
8213
8215 }
8216 else
8217 {
8218 if (new_player)
8219 {
8220 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8221 if (res_index >= 0)
8222 {
8223 InventoryLocation il = new InventoryLocation;
8224 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8226 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8229 {
8230 il.
GetParent().GetOnReleaseLock().Invoke(it);
8231 }
8233 {
8235 }
8236
8237 }
8238 }
8240 {
8241
8243 }
8244
8245 if (m_OldLocation)
8246 {
8247 m_OldLocation.Reset();
8248 }
8249 }
8250 }
8251
8252 override void EOnContact(IEntity other, Contact extra)
8253 {
8255 {
8256 int liquidType = -1;
8258 if (impactSpeed > 0.0)
8259 {
8261 #ifndef SERVER
8263 #else
8265 SetSynchDirty();
8266 #endif
8268 }
8269 }
8270
8271 #ifdef SERVER
8272 if (GetCompEM() && GetCompEM().IsPlugged())
8273 {
8274 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8275 GetCompEM().UnplugThis();
8276 }
8277 #endif
8278 }
8279
8281
8283 {
8285 }
8286
8288 {
8289
8290 }
8291
8293 {
8294 super.OnItemLocationChanged(old_owner, new_owner);
8295
8296 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8297 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8298
8299 if (!relatedPlayer && playerNew)
8300 relatedPlayer = playerNew;
8301
8302 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8303 {
8305 if (actionMgr)
8306 {
8307 ActionBase currentAction = actionMgr.GetRunningAction();
8308 if (currentAction)
8310 }
8311 }
8312
8313 Man ownerPlayerOld = null;
8314 Man ownerPlayerNew = null;
8315
8316 if (old_owner)
8317 {
8318 if (old_owner.
IsMan())
8319 {
8320 ownerPlayerOld = Man.Cast(old_owner);
8321 }
8322 else
8323 {
8324 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8325 }
8326 }
8327 else
8328 {
8330 {
8332
8333 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8334 {
8335 GetCompEM().UnplugThis();
8336 }
8337 }
8338 }
8339
8340 if (new_owner)
8341 {
8342 if (new_owner.
IsMan())
8343 {
8344 ownerPlayerNew = Man.Cast(new_owner);
8345 }
8346 else
8347 {
8348 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8349 }
8350 }
8351
8352 if (ownerPlayerOld != ownerPlayerNew)
8353 {
8354 if (ownerPlayerOld)
8355 {
8356 array<EntityAI> subItemsExit = new array<EntityAI>;
8358 for (int i = 0; i < subItemsExit.Count(); i++)
8359 {
8362 }
8363 }
8364
8365 if (ownerPlayerNew)
8366 {
8367 array<EntityAI> subItemsEnter = new array<EntityAI>;
8369 for (int j = 0; j < subItemsEnter.Count(); j++)
8370 {
8373 }
8374 }
8375 }
8376 else if (ownerPlayerNew != null)
8377 {
8378 PlayerBase nplayer;
8379 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8380 {
8381 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8383 for (int k = 0; k < subItemsUpdate.Count(); k++)
8384 {
8386 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8387 }
8388 }
8389 }
8390
8391 if (old_owner)
8392 old_owner.OnChildItemRemoved(this);
8393 if (new_owner)
8394 new_owner.OnChildItemReceived(this);
8395 }
8396
8397
8399 {
8400 super.EEDelete(parent);
8401 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8402 if (player)
8403 {
8405
8406 if (player.IsAlive())
8407 {
8408 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8409 if (r_index >= 0)
8410 {
8411 InventoryLocation r_il = new InventoryLocation;
8412 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8413
8414 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8417 {
8418 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8419 }
8421 {
8422 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8423 }
8424
8425 }
8426
8427 player.RemoveQuickBarEntityShortcut(this);
8428 }
8429 }
8430 }
8431
8433 {
8434 super.EEKilled(killer);
8435
8438 {
8439 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8440 {
8441 if (IsMagazine())
8442 {
8443 if (Magazine.Cast(this).GetAmmoCount() > 0)
8444 {
8446 }
8447 }
8448 else
8449 {
8451 }
8452 }
8453 }
8454 }
8455
8457 {
8458 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8459
8460 super.OnWasAttached(parent, slot_id);
8461
8464
8466 }
8467
8469 {
8470 super.OnWasDetached(parent, slot_id);
8471
8474 }
8475
8477 {
8478 int idx;
8481
8482 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8483 if (inventory_slots.Count() < 1)
8484 {
8485 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8486 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8487 }
8488 else
8489 {
8490 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8491 }
8492
8493 idx = inventory_slots.Find(slot);
8494 if (idx < 0)
8495 return "";
8496
8497 return attach_types.Get(idx);
8498 }
8499
8501 {
8502 int idx = -1;
8503 string slot;
8504
8507
8508 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8509 if (inventory_slots.Count() < 1)
8510 {
8511 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8512 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8513 }
8514 else
8515 {
8516 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8517 if (detach_types.Count() < 1)
8518 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8519 }
8520
8521 for (int i = 0; i < inventory_slots.Count(); i++)
8522 {
8523 slot = inventory_slots.Get(i);
8524 }
8525
8526 if (slot != "")
8527 {
8528 if (detach_types.Count() == 1)
8529 idx = 0;
8530 else
8531 idx = inventory_slots.Find(slot);
8532 }
8533 if (idx < 0)
8534 return "";
8535
8536 return detach_types.Get(idx);
8537 }
8538
8540 {
8541
8543
8544
8545 float min_time = 1;
8546 float max_time = 3;
8547 float delay = Math.RandomFloat(min_time, max_time);
8548
8549 explode_timer.Run(delay, this, "DoAmmoExplosion");
8550 }
8551
8553 {
8554 Magazine magazine = Magazine.Cast(this);
8555 int pop_sounds_count = 6;
8556 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8557
8558
8559 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8560 string sound_name = pop_sounds[ sound_idx ];
8562
8563
8564 magazine.ServerAddAmmoCount(-1);
8565
8566
8567 float min_temp_to_explode = 100;
8568
8569 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8570 {
8572 }
8573 }
8574
8575
8576 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8577 {
8578 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8579
8580 const int CHANCE_DAMAGE_CARGO = 4;
8581 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8582 const int CHANCE_DAMAGE_NOTHING = 2;
8583
8585 {
8586 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8587 int chances;
8588 int rnd;
8589
8590 if (GetInventory().GetCargo())
8591 {
8592 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8593 rnd = Math.RandomInt(0,chances);
8594
8595 if (rnd < CHANCE_DAMAGE_CARGO)
8596 {
8598 }
8599 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8600 {
8602 }
8603 }
8604 else
8605 {
8606 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8607 rnd = Math.RandomInt(0,chances);
8608
8609 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8610 {
8612 }
8613 }
8614 }
8615 }
8616
8618 {
8619 if (GetInventory().GetCargo())
8620 {
8621 int item_count = GetInventory().GetCargo().GetItemCount();
8622 if (item_count > 0)
8623 {
8624 int random_pick = Math.RandomInt(0, item_count);
8626 if (!item.IsExplosive())
8627 {
8628 item.AddHealth("","",damage);
8629 return true;
8630 }
8631 }
8632 }
8633 return false;
8634 }
8635
8637 {
8638 int attachment_count = GetInventory().AttachmentCount();
8639 if (attachment_count > 0)
8640 {
8641 int random_pick = Math.RandomInt(0, attachment_count);
8642 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8643 if (!attachment.IsExplosive())
8644 {
8645 attachment.AddHealth("","",damage);
8646 return true;
8647 }
8648 }
8649 return false;
8650 }
8651
8653 {
8655 }
8656
8658 {
8660 return GetInventory().CanRemoveEntity();
8661
8662 return false;
8663 }
8664
8666 {
8667
8669 return false;
8670
8671
8673 return false;
8674
8675
8676
8678 if (delta == 0)
8679 return false;
8680
8681
8682 return true;
8683 }
8684
8686 {
8688 {
8689 if (ScriptInputUserData.CanStoreInputUserData())
8690 {
8691 ScriptInputUserData ctx = new ScriptInputUserData;
8696 ctx.
Write(destination_entity);
8700 }
8701 }
8702 else if (!
GetGame().IsMultiplayer())
8703 {
8705 }
8706 }
8707
8709 {
8710 float split_quantity_new;
8714 InventoryLocation loc = new InventoryLocation;
8715
8716 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8717 {
8719 split_quantity_new = stack_max;
8720 else
8722
8724 {
8725 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8726 if (new_item)
8727 {
8728 new_item.SetResultOfSplit(true);
8729 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8731 new_item.
SetQuantity(split_quantity_new,
false,
true);
8732 }
8733 }
8734 }
8735 else if (destination_entity && slot_id == -1)
8736 {
8737 if (quantity > stack_max)
8738 split_quantity_new = stack_max;
8739 else
8740 split_quantity_new = quantity;
8741
8743 {
8745 {
8748 }
8749
8750 if (new_item)
8751 {
8752 new_item.SetResultOfSplit(true);
8753 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8755 new_item.
SetQuantity(split_quantity_new,
false,
true);
8756 }
8757 }
8758 }
8759 else
8760 {
8761 if (stack_max != 0)
8762 {
8764 {
8766 }
8767
8768 if (split_quantity_new == 0)
8769 {
8770 if (!
GetGame().IsMultiplayer())
8771 player.PhysicalPredictiveDropItem(this);
8772 else
8773 player.ServerDropEntity(this);
8774 return;
8775 }
8776
8778 {
8780
8781 if (new_item)
8782 {
8783 new_item.SetResultOfSplit(true);
8784 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8787 new_item.PlaceOnSurface();
8788 }
8789 }
8790 }
8791 }
8792 }
8793
8795 {
8796 float split_quantity_new;
8800 InventoryLocation loc = new InventoryLocation;
8801
8802 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8803 {
8805 split_quantity_new = stack_max;
8806 else
8808
8810 {
8811 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8812 if (new_item)
8813 {
8814 new_item.SetResultOfSplit(true);
8815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8817 new_item.
SetQuantity(split_quantity_new,
false,
true);
8818 }
8819 }
8820 }
8821 else if (destination_entity && slot_id == -1)
8822 {
8823 if (quantity > stack_max)
8824 split_quantity_new = stack_max;
8825 else
8826 split_quantity_new = quantity;
8827
8829 {
8831 {
8834 }
8835
8836 if (new_item)
8837 {
8838 new_item.SetResultOfSplit(true);
8839 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8841 new_item.
SetQuantity(split_quantity_new,
false,
true);
8842 }
8843 }
8844 }
8845 else
8846 {
8847 if (stack_max != 0)
8848 {
8850 {
8852 }
8853
8855 {
8857
8858 if (new_item)
8859 {
8860 new_item.SetResultOfSplit(true);
8861 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8864 new_item.PlaceOnSurface();
8865 }
8866 }
8867 }
8868 }
8869 }
8870
8872 {
8874 {
8875 if (ScriptInputUserData.CanStoreInputUserData())
8876 {
8877 ScriptInputUserData ctx = new ScriptInputUserData;
8882 dst.WriteToContext(ctx);
8884 }
8885 }
8886 else if (!
GetGame().IsMultiplayer())
8887 {
8889 }
8890 }
8891
8893 {
8895 {
8896 if (ScriptInputUserData.CanStoreInputUserData())
8897 {
8898 ScriptInputUserData ctx = new ScriptInputUserData;
8903 ctx.
Write(destination_entity);
8909 }
8910 }
8911 else if (!
GetGame().IsMultiplayer())
8912 {
8914 }
8915 }
8916
8918 {
8920 }
8921
8923 {
8925 float split_quantity_new;
8927 if (dst.IsValid())
8928 {
8929 int slot_id = dst.GetSlot();
8931
8932 if (quantity > stack_max)
8933 split_quantity_new = stack_max;
8934 else
8935 split_quantity_new = quantity;
8936
8938 {
8940
8941 if (new_item)
8942 {
8943 new_item.SetResultOfSplit(true);
8944 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8946 new_item.
SetQuantity(split_quantity_new,
false,
true);
8947 }
8948
8949 return new_item;
8950 }
8951 }
8952
8953 return null;
8954 }
8955
8957 {
8959 float split_quantity_new;
8961 if (destination_entity)
8962 {
8964 if (quantity > stackable)
8965 split_quantity_new = stackable;
8966 else
8967 split_quantity_new = quantity;
8968
8970 {
8971 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8972 if (new_item)
8973 {
8974 new_item.SetResultOfSplit(true);
8975 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8977 new_item.
SetQuantity(split_quantity_new,
false,
true);
8978 }
8979 }
8980 }
8981 }
8982
8984 {
8986 {
8987 if (ScriptInputUserData.CanStoreInputUserData())
8988 {
8989 ScriptInputUserData ctx = new ScriptInputUserData;
8994 ItemBase destination_entity =
this;
8995 ctx.
Write(destination_entity);
8999 }
9000 }
9001 else if (!
GetGame().IsMultiplayer())
9002 {
9004 }
9005 }
9006
9008 {
9010 float split_quantity_new;
9012 if (player)
9013 {
9015 if (quantity > stackable)
9016 split_quantity_new = stackable;
9017 else
9018 split_quantity_new = quantity;
9019
9021 {
9022 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9023 new_item =
ItemBase.Cast(in_hands);
9024 if (new_item)
9025 {
9026 new_item.SetResultOfSplit(true);
9027 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9029 new_item.SetQuantity(split_quantity_new, false, true);
9030 }
9031 }
9032 }
9033 }
9034
9036 {
9038 float split_quantity_new = Math.Floor(quantity * 0.5);
9039
9041 return;
9042
9044
9045 if (new_item)
9046 {
9047 if (new_item.GetQuantityMax() < split_quantity_new)
9048 {
9049 split_quantity_new = new_item.GetQuantityMax();
9050 }
9051
9052 new_item.SetResultOfSplit(true);
9053 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9054
9056 {
9059 }
9060 else
9061 {
9063 new_item.
SetQuantity(split_quantity_new,
false,
true);
9064 }
9065 }
9066 }
9067
9069 {
9071 float split_quantity_new = Math.Floor(quantity / 2);
9072
9074 return;
9075
9076 InventoryLocation invloc = new InventoryLocation;
9078
9080 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9081
9082 if (new_item)
9083 {
9084 if (new_item.GetQuantityMax() < split_quantity_new)
9085 {
9086 split_quantity_new = new_item.GetQuantityMax();
9087 }
9089 {
9092 }
9093 else if (split_quantity_new > 1)
9094 {
9096 new_item.
SetQuantity(split_quantity_new,
false,
true);
9097 }
9098 }
9099 }
9100
9103 {
9104 SetWeightDirty();
9106
9107 if (parent)
9108 parent.OnAttachmentQuantityChangedEx(this, delta);
9109
9111 {
9113 {
9115 }
9117 {
9118 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9120 }
9121 }
9122
9123 }
9124
9127 {
9128
9129 }
9130
9133 {
9135 }
9136
9138 {
9139 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9140
9142 {
9143 if (newLevel == GameConstants.STATE_RUINED)
9144 {
9146 EntityAI parent = GetHierarchyParent();
9147 if (parent && parent.IsFireplace())
9148 {
9149 CargoBase cargo = GetInventory().GetCargo();
9150 if (cargo)
9151 {
9153 {
9155 }
9156 }
9157 }
9158 }
9159
9161 {
9162
9164 return;
9165 }
9166
9167 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9168 {
9170 }
9171 }
9172 }
9173
9174
9176 {
9177 super.OnRightClick();
9178
9180 {
9182 {
9183 if (ScriptInputUserData.CanStoreInputUserData())
9184 {
9185 EntityAI root = GetHierarchyRoot();
9186 Man playerOwner = GetHierarchyRootPlayer();
9187 InventoryLocation dst = new InventoryLocation;
9188
9189
9190 if (!playerOwner && root && root == this)
9191 {
9193 }
9194 else
9195 {
9196
9197 GetInventory().GetCurrentInventoryLocation(dst);
9199 {
9202 {
9204 }
9205 else
9206 {
9208
9209
9210 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9211 {
9213 }
9214 else
9215 {
9216 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9217 }
9218 }
9219 }
9220 }
9221
9222 ScriptInputUserData ctx = new ScriptInputUserData;
9230 }
9231 }
9232 else if (!
GetGame().IsMultiplayer())
9233 {
9235 }
9236 }
9237 }
9238
9240 {
9241 if (root)
9242 {
9243 vector m4[4];
9244 root.GetTransform(m4);
9245 dst.SetGround(this, m4);
9246 }
9247 else
9248 {
9249 GetInventory().GetCurrentInventoryLocation(dst);
9250 }
9251 }
9252
9253 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9254 {
9255
9256 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9257 return false;
9258
9259 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9260 return false;
9261
9262
9264 return false;
9265
9266
9267 Magazine mag = Magazine.Cast(this);
9268 if (mag)
9269 {
9270 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9271 return false;
9272
9273 if (stack_max_limit)
9274 {
9275 Magazine other_mag = Magazine.Cast(other_item);
9276 if (other_item)
9277 {
9278 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9279 return false;
9280 }
9281
9282 }
9283 }
9284 else
9285 {
9286
9288 return false;
9289
9291 return false;
9292 }
9293
9294 PlayerBase player = null;
9295 if (CastTo(player, GetHierarchyRootPlayer()))
9296 {
9297 if (player.GetInventory().HasAttachment(this))
9298 return false;
9299
9300 if (player.IsItemsToDelete())
9301 return false;
9302 }
9303
9304 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9305 return false;
9306
9307 int slotID;
9309 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9310 return false;
9311
9312 return true;
9313 }
9314
9316 {
9318 }
9319
9321 {
9322 return m_IsResultOfSplit;
9323 }
9324
9326 {
9327 m_IsResultOfSplit = value;
9328 }
9329
9331 {
9333 }
9334
9336 {
9337 float other_item_quantity = other_item.GetQuantity();
9338 float this_free_space;
9339
9341
9343
9344 if (other_item_quantity > this_free_space)
9345 {
9346 return this_free_space;
9347 }
9348 else
9349 {
9350 return other_item_quantity;
9351 }
9352 }
9353
9355 {
9357 }
9358
9360 {
9362 return;
9363
9364 if (!IsMagazine() && other_item)
9365 {
9367 if (quantity_used != 0)
9368 {
9369 float hp1 = GetHealth01("","");
9370 float hp2 = other_item.GetHealth01("","");
9371 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9372 hpResult = hpResult / (
GetQuantity() + quantity_used);
9373
9374 hpResult *= GetMaxHealth();
9375 Math.Round(hpResult);
9376 SetHealth("", "Health", hpResult);
9377
9379 other_item.AddQuantity(-quantity_used);
9380 }
9381 }
9383 }
9384
9386 {
9387 #ifdef SERVER
9388 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9389 GetHierarchyParent().IncreaseLifetimeUp();
9390 #endif
9391 };
9392
9394 {
9395 PlayerBase p = PlayerBase.Cast(player);
9396
9397 array<int> recipesIds = p.m_Recipes;
9398 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9399 if (moduleRecipesManager)
9400 {
9401 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9402 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9403 }
9404
9405 for (int i = 0;i < recipesIds.Count(); i++)
9406 {
9407 int key = recipesIds.Get(i);
9408 string recipeName = moduleRecipesManager.GetRecipeName(key);
9410 }
9411 }
9412
9413
9414 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9415 {
9416 super.GetDebugActions(outputList);
9417
9418
9424
9425
9430
9435
9436
9440
9441
9443 {
9447 }
9448
9451
9452
9456
9458
9459 InventoryLocation loc = new InventoryLocation();
9460 GetInventory().GetCurrentInventoryLocation(loc);
9462 {
9463 if (Gizmo_IsSupported())
9466 }
9467
9469 }
9470
9471
9472
9473
9475 {
9476 super.OnAction(action_id, player, ctx);
9477
9479 {
9480 switch (action_id)
9481 {
9484 return true;
9487 return true;
9488 }
9489 }
9490
9492 {
9493 switch (action_id)
9494 {
9496 Delete();
9497 return true;
9498 }
9499 }
9500
9501 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9502 {
9503 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9504 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9505 PlayerBase p = PlayerBase.Cast(player);
9506 if (
EActions.RECIPES_RANGE_START < 1000)
9507 {
9508 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9509 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9510 }
9511 }
9512 #ifndef SERVER
9513 else if (action_id ==
EActions.WATCH_PLAYER)
9514 {
9515 PluginDeveloper.SetDeveloperItemClientEx(player);
9516 }
9517 #endif
9519 {
9520 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9521 {
9522 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9523 OnDebugButtonPressServer(id + 1);
9524 }
9525
9526 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9527 {
9528 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9530 }
9531
9532 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9533 {
9534 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9536 }
9537
9538 else if (action_id ==
EActions.ADD_QUANTITY)
9539 {
9540 if (IsMagazine())
9541 {
9542 Magazine mag = Magazine.Cast(this);
9543 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9544 }
9545 else
9546 {
9548 }
9549
9550 if (m_EM)
9551 {
9552 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9553 }
9554
9555 }
9556
9557 else if (action_id ==
EActions.REMOVE_QUANTITY)
9558 {
9559 if (IsMagazine())
9560 {
9561 Magazine mag2 = Magazine.Cast(this);
9562 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9563 }
9564 else
9565 {
9567 }
9568 if (m_EM)
9569 {
9570 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9571 }
9572
9573 }
9574
9575 else if (action_id ==
EActions.SET_QUANTITY_0)
9576 {
9578
9579 if (m_EM)
9580 {
9581 m_EM.SetEnergy(0);
9582 }
9583 }
9584
9585 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9586 {
9588
9589 if (m_EM)
9590 {
9591 m_EM.SetEnergy(m_EM.GetEnergyMax());
9592 }
9593 }
9594
9595 else if (action_id ==
EActions.ADD_HEALTH)
9596 {
9597 AddHealth("","",GetMaxHealth("","Health")/5);
9598 }
9599 else if (action_id ==
EActions.REMOVE_HEALTH)
9600 {
9601 AddHealth("","",-GetMaxHealth("","Health")/5);
9602 }
9603 else if (action_id ==
EActions.DESTROY_HEALTH)
9604 {
9605 SetHealth01("","",0);
9606 }
9607 else if (action_id ==
EActions.WATCH_ITEM)
9608 {
9610 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9611 #ifdef DEVELOPER
9612 SetDebugDeveloper_item(this);
9613 #endif
9614 }
9615
9616 else if (action_id ==
EActions.ADD_TEMPERATURE)
9617 {
9618 AddTemperature(20);
9619
9620 }
9621
9622 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9623 {
9624 AddTemperature(-20);
9625
9626 }
9627
9628 else if (action_id ==
EActions.FLIP_FROZEN)
9629 {
9630 SetFrozen(!GetIsFrozen());
9631
9632 }
9633
9634 else if (action_id ==
EActions.ADD_WETNESS)
9635 {
9637
9638 }
9639
9640 else if (action_id ==
EActions.REMOVE_WETNESS)
9641 {
9643
9644 }
9645
9646 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9647 {
9650
9651
9652 }
9653
9654 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9655 {
9658 }
9659
9660 else if (action_id ==
EActions.MAKE_SPECIAL)
9661 {
9662 auto debugParams = DebugSpawnParams.WithPlayer(player);
9663 OnDebugSpawnEx(debugParams);
9664 }
9665
9666 }
9667
9668
9669 return false;
9670 }
9671
9672
9673
9674
9678
9681
9682
9683
9685 {
9686 return false;
9687 }
9688
9689
9691 {
9692 return true;
9693 }
9694
9695
9697 {
9698 return true;
9699 }
9700
9701
9702
9704 {
9705 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9707 }
9708
9711 {
9712 return null;
9713 }
9714
9716 {
9717 return false;
9718 }
9719
9721 {
9722 return false;
9723 }
9724
9728
9729
9731 {
9732 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9733 return module_repairing.CanRepair(this, item_repair_kit);
9734 }
9735
9736
9737 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9738 {
9739 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9740 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9741 }
9742
9743
9745 {
9746
9747
9748
9749
9750
9751
9752
9753
9754 return 1;
9755 }
9756
9757
9758
9760 {
9762 }
9763
9764
9765
9767 {
9769 }
9770
9771
9780 {
9781 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9782
9783 if (player)
9784 {
9785 player.MessageStatus(text);
9786 }
9787 }
9788
9789
9798 {
9799 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9800
9801 if (player)
9802 {
9803 player.MessageAction(text);
9804 }
9805 }
9806
9807
9816 {
9817 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9818
9819 if (player)
9820 {
9821 player.MessageFriendly(text);
9822 }
9823 }
9824
9825
9834 {
9835 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9836
9837 if (player)
9838 {
9839 player.MessageImportant(text);
9840 }
9841 }
9842
9844 {
9845 return true;
9846 }
9847
9848
9849 override bool KindOf(
string tag)
9850 {
9851 bool found = false;
9852 string item_name = this.
GetType();
9855
9856 int array_size = item_tag_array.Count();
9857 for (int i = 0; i < array_size; i++)
9858 {
9859 if (item_tag_array.Get(i) == tag)
9860 {
9861 found = true;
9862 break;
9863 }
9864 }
9865 return found;
9866 }
9867
9868
9870 {
9871
9872 super.OnRPC(sender, rpc_type,ctx);
9873
9874
9875 switch (rpc_type)
9876 {
9877 #ifndef SERVER
9878 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9879 Param2<bool, string> p = new Param2<bool, string>(false, "");
9880
9882 return;
9883
9884 bool play = p.param1;
9885 string soundSet = p.param2;
9886
9887 if (play)
9888 {
9890 {
9892 {
9894 }
9895 }
9896 else
9897 {
9899 }
9900 }
9901 else
9902 {
9904 }
9905
9906 break;
9907 #endif
9908
9909 }
9910
9912 {
9914 }
9915 }
9916
9917
9918
9919
9921 {
9922 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9923 return plugin.GetID(
name);
9924 }
9925
9927 {
9928 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9929 return plugin.GetName(id);
9930 }
9931
9934 {
9935
9936
9937 int varFlags;
9938 if (!ctx.
Read(varFlags))
9939 return;
9940
9941 if (varFlags & ItemVariableFlags.FLOAT)
9942 {
9944 }
9945 }
9946
9948 {
9949
9950 super.SerializeNumericalVars(floats_out);
9951
9952
9953
9955 {
9957 }
9958
9960 {
9962 }
9963
9965 {
9967 }
9968
9970 {
9975 }
9976
9978 {
9980 }
9981 }
9982
9984 {
9985
9986 super.DeSerializeNumericalVars(floats);
9987
9988
9989 int index = 0;
9990 int mask = Math.Round(floats.Get(index));
9991
9992 index++;
9993
9995 {
9997 {
9999 }
10000 else
10001 {
10002 float quantity = floats.Get(index);
10003 SetQuantity(quantity,
true,
false,
false,
false);
10004 }
10005 index++;
10006 }
10007
10009 {
10010 float wet = floats.Get(index);
10012 index++;
10013 }
10014
10016 {
10017 int liquidtype = Math.Round(floats.Get(index));
10019 index++;
10020 }
10021
10023 {
10025 index++;
10027 index++;
10029 index++;
10031 index++;
10032 }
10033
10035 {
10036 int cleanness = Math.Round(floats.Get(index));
10038 index++;
10039 }
10040 }
10041
10043 {
10044 super.WriteVarsToCTX(ctx);
10045
10046
10048 {
10050 }
10051
10053 {
10055 }
10056
10058 {
10060 }
10061
10063 {
10064 int r,g,b,a;
10070 }
10071
10073 {
10075 }
10076 }
10077
10079 {
10080 if (!super.ReadVarsFromCTX(ctx,version))
10081 return false;
10082
10083 int intValue;
10084 float value;
10085
10086 if (version < 140)
10087 {
10088 if (!ctx.
Read(intValue))
10089 return false;
10090
10091 m_VariablesMask = intValue;
10092 }
10093
10095 {
10096 if (!ctx.
Read(value))
10097 return false;
10098
10100 {
10102 }
10103 else
10104 {
10106 }
10107 }
10108
10109 if (version < 140)
10110 {
10112 {
10113 if (!ctx.
Read(value))
10114 return false;
10115 SetTemperatureDirect(value);
10116 }
10117 }
10118
10120 {
10121 if (!ctx.
Read(value))
10122 return false;
10124 }
10125
10127 {
10128 if (!ctx.
Read(intValue))
10129 return false;
10131 }
10132
10134 {
10135 int r,g,b,a;
10137 return false;
10139 return false;
10141 return false;
10143 return false;
10144
10146 }
10147
10149 {
10150 if (!ctx.
Read(intValue))
10151 return false;
10153 }
10154
10155 if (version >= 138 && version < 140)
10156 {
10158 {
10159 if (!ctx.
Read(intValue))
10160 return false;
10161 SetFrozen(intValue);
10162 }
10163 }
10164
10165 return true;
10166 }
10167
10168
10170 {
10173 {
10175 }
10176
10177 if (!super.OnStoreLoad(ctx, version))
10178 {
10180 return false;
10181 }
10182
10183 if (version >= 114)
10184 {
10185 bool hasQuickBarIndexSaved;
10186
10187 if (!ctx.
Read(hasQuickBarIndexSaved))
10188 {
10190 return false;
10191 }
10192
10193 if (hasQuickBarIndexSaved)
10194 {
10195 int itmQBIndex;
10196
10197
10198 if (!ctx.
Read(itmQBIndex))
10199 {
10201 return false;
10202 }
10203
10204 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10205 if (itmQBIndex != -1 && parentPlayer)
10206 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10207 }
10208 }
10209 else
10210 {
10211
10212 PlayerBase player;
10213 int itemQBIndex;
10214 if (version ==
int.
MAX)
10215 {
10216 if (!ctx.
Read(itemQBIndex))
10217 {
10219 return false;
10220 }
10221 }
10222 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10223 {
10224
10225 if (!ctx.
Read(itemQBIndex))
10226 {
10228 return false;
10229 }
10230 if (itemQBIndex != -1 && player)
10231 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10232 }
10233 }
10234
10235 if (version < 140)
10236 {
10237
10238 if (!LoadVariables(ctx, version))
10239 {
10241 return false;
10242 }
10243 }
10244
10245
10247 {
10249 return false;
10250 }
10251 if (version >= 132)
10252 {
10254 if (raib)
10255 {
10257 {
10259 return false;
10260 }
10261 }
10262 }
10263
10265 return true;
10266 }
10267
10268
10269
10271 {
10272 super.OnStoreSave(ctx);
10273
10274 PlayerBase player;
10275 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10276 {
10278
10279 int itemQBIndex = -1;
10280 itemQBIndex = player.FindQuickBarEntityIndex(this);
10281 ctx.
Write(itemQBIndex);
10282 }
10283 else
10284 {
10286 }
10287
10289
10291 if (raib)
10292 {
10294 }
10295 }
10296
10297
10299 {
10300 super.AfterStoreLoad();
10301
10303 {
10305 }
10306
10308 {
10311 }
10312 }
10313
10315 {
10316 super.EEOnAfterLoad();
10317
10319 {
10321 }
10322
10325 }
10326
10328 {
10329 return false;
10330 }
10331
10332
10333
10335 {
10337 {
10338 #ifdef PLATFORM_CONSOLE
10339
10341 {
10343 if (menu)
10344 {
10346 }
10347 }
10348 #endif
10349 }
10350
10352 {
10355 }
10356
10358 {
10359 SetWeightDirty();
10361 }
10363 {
10366 }
10367
10369 {
10372 }
10374 {
10377 }
10378
10379 super.OnVariablesSynchronized();
10380 }
10381
10382
10383
10385 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10386 {
10387 if (!IsServerCheck(allow_client))
10388 return false;
10389
10391 return false;
10392
10395
10396 if (value <= (min + 0.001))
10397 value = min;
10398
10399 if (value == min)
10400 {
10401 if (destroy_config)
10402 {
10403 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10404 if (dstr)
10405 {
10407 this.Delete();
10408 return true;
10409 }
10410 }
10411 else if (destroy_forced)
10412 {
10414 this.Delete();
10415 return true;
10416 }
10417
10419 }
10420
10423
10425 {
10427
10428 if (delta)
10430 }
10431
10433
10434 return false;
10435 }
10436
10437
10439 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10440 {
10442 }
10443
10445 {
10448 }
10449
10451 {
10454 }
10455
10457 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10458 {
10459 float value_clamped = Math.Clamp(value, 0, 1);
10461 SetQuantity(result, destroy_config, destroy_forced);
10462 }
10463
10464
10467 {
10469 }
10470
10472 {
10474 }
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10486 {
10487 int slot = -1;
10488 if (GetInventory())
10489 {
10490 InventoryLocation il = new InventoryLocation;
10491 GetInventory().GetCurrentInventoryLocation(il);
10493 }
10494
10496 }
10497
10499 {
10500 float quantity_max = 0;
10501
10503 {
10504 if (attSlotID != -1)
10505 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10506
10507 if (quantity_max <= 0)
10509 }
10510
10511 if (quantity_max <= 0)
10513
10514 return quantity_max;
10515 }
10516
10518 {
10520 }
10521
10523 {
10525 }
10526
10527
10529 {
10531 }
10532
10534 {
10536 }
10537
10539 {
10541 }
10542
10543
10545 {
10546
10547 float weightEx = GetWeightEx();
10548 float special = GetInventoryAndCargoWeight();
10549 return weightEx - special;
10550 }
10551
10552
10554 {
10556 }
10557
10559 {
10561 {
10562 #ifdef DEVELOPER
10563 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10564 {
10565 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10567 }
10568 #endif
10569
10570 return GetQuantity() * GetConfigWeightModified();
10571 }
10572 else if (HasEnergyManager())
10573 {
10574 #ifdef DEVELOPER
10575 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10576 {
10577 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10578 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10579 }
10580 #endif
10581 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10582 }
10583 else
10584 {
10585 #ifdef DEVELOPER
10586 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10587 {
10588 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10589 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10590 }
10591 #endif
10592 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10593 }
10594 }
10595
10598 {
10599 int item_count = 0;
10601
10602 if (GetInventory().GetCargo() != NULL)
10603 {
10604 item_count = GetInventory().GetCargo().GetItemCount();
10605 }
10606
10607 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10608 {
10609 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10610 if (item)
10611 item_count += item.GetNumberOfItems();
10612 }
10613 return item_count;
10614 }
10615
10618 {
10619 float weight = 0;
10620 float wetness = 1;
10621 if (include_wetness)
10624 {
10625 weight = wetness * m_ConfigWeight;
10626 }
10628 {
10629 weight = 1;
10630 }
10631 return weight;
10632 }
10633
10634
10635
10637 {
10638 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10639 {
10640 GameInventory inv = GetInventory();
10641 array<EntityAI> items = new array<EntityAI>;
10643 for (int i = 0; i < items.Count(); i++)
10644 {
10646 if (item)
10647 {
10649 }
10650 }
10651 }
10652 }
10653
10654
10655
10656
10658 {
10659 float energy = 0;
10660 if (HasEnergyManager())
10661 {
10662 energy = GetCompEM().GetEnergy();
10663 }
10664 return energy;
10665 }
10666
10667
10669 {
10670 super.OnEnergyConsumed();
10671
10673 }
10674
10676 {
10677 super.OnEnergyAdded();
10678
10680 }
10681
10682
10684 {
10685 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10686 {
10688 {
10689 float energy_0to1 = GetCompEM().GetEnergy0To1();
10691 }
10692 }
10693 }
10694
10695
10697 {
10698 return ConfigGetFloat("heatIsolation");
10699 }
10700
10702 {
10704 }
10705
10707 {
10708 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10709 if (
GetGame().ConfigIsExisting(paramPath))
10711
10712 return 0.0;
10713 }
10714
10716 {
10717 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10718 if (
GetGame().ConfigIsExisting(paramPath))
10720
10721 return 0.0;
10722 }
10723
10724 override void SetWet(
float value,
bool allow_client =
false)
10725 {
10726 if (!IsServerCheck(allow_client))
10727 return;
10728
10731
10733
10734 m_VarWet = Math.Clamp(value, min, max);
10735
10737 {
10740 }
10741 }
10742
10743 override void AddWet(
float value)
10744 {
10746 }
10747
10749 {
10751 }
10752
10754 {
10756 }
10757
10759 {
10761 }
10762
10764 {
10766 }
10767
10769 {
10771 }
10772
10773 override void OnWetChanged(
float newVal,
float oldVal)
10774 {
10777 if (newLevel != oldLevel)
10778 {
10780 }
10781 }
10782
10784 {
10785 SetWeightDirty();
10786 }
10787
10789 {
10790 return GetWetLevelInternal(
m_VarWet);
10791 }
10792
10793
10794
10796 {
10798 }
10799
10801 {
10803 }
10804
10806 {
10808 }
10809
10811 {
10813 }
10814
10815
10816
10818 {
10819 if (ConfigIsExisting("itemModelLength"))
10820 {
10821 return ConfigGetFloat("itemModelLength");
10822 }
10823 return 0;
10824 }
10825
10827 {
10828 if (ConfigIsExisting("itemAttachOffset"))
10829 {
10830 return ConfigGetFloat("itemAttachOffset");
10831 }
10832 return 0;
10833 }
10834
10835 override void SetCleanness(
int value,
bool allow_client =
false)
10836 {
10837 if (!IsServerCheck(allow_client))
10838 return;
10839
10841
10843
10846 }
10847
10849 {
10851 }
10852
10854 {
10855 return true;
10856 }
10857
10858
10859
10860
10862 {
10864 }
10865
10867 {
10869 }
10870
10871
10872
10873
10874 override void SetColor(
int r,
int g,
int b,
int a)
10875 {
10881 }
10883 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10884 {
10889 }
10890
10892 {
10894 }
10895
10898 {
10899 int r,g,b,a;
10901 r = r/255;
10902 g = g/255;
10903 b = b/255;
10904 a = a/255;
10905 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10906 }
10907
10908
10909
10910 override void SetLiquidType(
int value,
bool allow_client =
false)
10911 {
10912 if (!IsServerCheck(allow_client))
10913 return;
10914
10919 }
10920
10922 {
10923 return ConfigGetInt("varLiquidTypeInit");
10924 }
10925
10927 {
10929 }
10930
10932 {
10934 SetFrozen(false);
10935 }
10936
10939 {
10940 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10941 }
10942
10943
10946 {
10947 PlayerBase nplayer;
10948 if (PlayerBase.CastTo(nplayer, player))
10949 {
10951
10952 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10953 }
10954 }
10955
10956
10959 {
10960 PlayerBase nplayer;
10961 if (PlayerBase.CastTo(nplayer,player))
10962 {
10963
10964 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10965
10966 }
10967
10968
10969 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10970
10971
10972 if (HasEnergyManager())
10973 {
10974 GetCompEM().UpdatePlugState();
10975 }
10976 }
10977
10978
10980 {
10981 super.OnPlacementStarted(player);
10982
10984 }
10985
10986 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10987 {
10989 {
10990 m_AdminLog.OnPlacementComplete(player,
this);
10991 }
10992
10993 super.OnPlacementComplete(player, position, orientation);
10994 }
10995
10996
10997
10998
10999
11001 {
11003 {
11004 return true;
11005 }
11006 else
11007 {
11008 return false;
11009 }
11010 }
11011
11012
11014 {
11016 {
11018 }
11019 }
11020
11021
11023 {
11025 }
11026
11028 {
11030 }
11031
11032 override void InsertAgent(
int agent,
float count = 1)
11033 {
11034 if (count < 1)
11035 return;
11036
11038 }
11039
11042 {
11044 }
11045
11046
11048 {
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
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11094 {
11096 return false;
11097 return true;
11098 }
11099
11101 {
11102
11104 }
11105
11106
11109 {
11110 super.CheckForRoofLimited(timeTresholdMS);
11111
11113 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11114 {
11115 m_PreviousRoofTestTime = time;
11116 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11117 }
11118 }
11119
11120
11122 {
11124 {
11125 return 0;
11126 }
11127
11128 if (GetInventory().GetAttachmentSlotsCount() != 0)
11129 {
11130 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11131 if (filter)
11132 return filter.GetProtectionLevel(type, false, system);
11133 else
11134 return 0;
11135 }
11136
11137 string subclassPath, entryName;
11138
11139 switch (type)
11140 {
11142 entryName = "biological";
11143 break;
11145 entryName = "chemical";
11146 break;
11147 default:
11148 entryName = "biological";
11149 break;
11150 }
11151
11152 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11153
11155 }
11156
11157
11158
11161 {
11162 if (!IsMagazine())
11164
11166 }
11167
11168
11169
11170
11171
11176 {
11177 return true;
11178 }
11179
11181 {
11183 }
11184
11185
11186
11187
11188
11190 {
11191 if (parent)
11192 {
11193 if (parent.IsInherited(DayZInfected))
11194 return true;
11195
11196 if (!parent.IsRuined())
11197 return true;
11198 }
11199
11200 return true;
11201 }
11202
11204 {
11205 if (!super.CanPutAsAttachment(parent))
11206 {
11207 return false;
11208 }
11209
11210 if (!IsRuined() && !parent.IsRuined())
11211 {
11212 return true;
11213 }
11214
11215 return false;
11216 }
11217
11219 {
11220
11221
11222
11223
11224 return super.CanReceiveItemIntoCargo(item);
11225 }
11226
11228 {
11229
11230
11231
11232
11233 GameInventory attachmentInv = attachment.GetInventory();
11235 {
11236 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11237 return false;
11238 }
11239
11240 InventoryLocation loc = new InventoryLocation();
11241 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11242 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11243 return false;
11244
11245 return super.CanReceiveAttachment(attachment, slotId);
11246 }
11247
11249 {
11250 if (!super.CanReleaseAttachment(attachment))
11251 return false;
11252
11253 return GetInventory().AreChildrenAccessible();
11254 }
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11277 {
11278 int id = muzzle_owner.GetMuzzleID();
11279 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11280
11281 if (WPOF_array)
11282 {
11283 for (int i = 0; i < WPOF_array.Count(); i++)
11284 {
11285 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11286
11287 if (WPOF)
11288 {
11289 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11290 }
11291 }
11292 }
11293 }
11294
11295
11297 {
11298 int id = muzzle_owner.GetMuzzleID();
11300
11301 if (WPOBE_array)
11302 {
11303 for (int i = 0; i < WPOBE_array.Count(); i++)
11304 {
11305 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11306
11307 if (WPOBE)
11308 {
11309 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11310 }
11311 }
11312 }
11313 }
11314
11315
11317 {
11318 int id = muzzle_owner.GetMuzzleID();
11319 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11320
11321 if (WPOOH_array)
11322 {
11323 for (int i = 0; i < WPOOH_array.Count(); i++)
11324 {
11325 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11326
11327 if (WPOOH)
11328 {
11329 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11330 }
11331 }
11332 }
11333 }
11334
11335
11337 {
11338 int id = muzzle_owner.GetMuzzleID();
11339 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11340
11341 if (WPOOH_array)
11342 {
11343 for (int i = 0; i < WPOOH_array.Count(); i++)
11344 {
11345 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11346
11347 if (WPOOH)
11348 {
11349 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11350 }
11351 }
11352 }
11353 }
11354
11355
11357 {
11358 int id = muzzle_owner.GetMuzzleID();
11359 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11360
11361 if (WPOOH_array)
11362 {
11363 for (int i = 0; i < WPOOH_array.Count(); i++)
11364 {
11365 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11366
11367 if (WPOOH)
11368 {
11369 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11370 }
11371 }
11372 }
11373 }
11374
11375
11376
11378 {
11380 {
11381 return true;
11382 }
11383
11384 return false;
11385 }
11386
11388 {
11390 {
11391 return true;
11392 }
11393
11394 return false;
11395 }
11396
11398 {
11400 {
11401 return true;
11402 }
11403
11404 return false;
11405 }
11406
11408 {
11409 return false;
11410 }
11411
11414 {
11415 return UATimeSpent.DEFAULT_DEPLOY;
11416 }
11417
11418
11419
11420
11422 {
11424 SetSynchDirty();
11425 }
11426
11428 {
11430 }
11431
11432
11434 {
11435 return false;
11436 }
11437
11440 {
11441 string att_type = "None";
11442
11443 if (ConfigIsExisting("soundAttType"))
11444 {
11445 att_type = ConfigGetString("soundAttType");
11446 }
11447
11449 }
11450
11452 {
11454 }
11455
11456
11457
11458
11459
11465
11467 {
11470
11472 }
11473
11474
11476 {
11478 return;
11479
11481
11484
11487
11488 SoundParameters params = new SoundParameters();
11492 }
11493
11494
11496 {
11498 return;
11499
11501 SetSynchDirty();
11502
11505 }
11506
11507
11509 {
11511 return;
11512
11514 SetSynchDirty();
11515
11518 }
11519
11521 {
11523 }
11524
11526 {
11528 }
11529
11532 {
11533 if (!
GetGame().IsDedicatedServer())
11534 {
11535 if (ConfigIsExisting("attachSoundSet"))
11536 {
11537 string cfg_path = "";
11538 string soundset = "";
11539 string type_name =
GetType();
11540
11543 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11544 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11545
11546 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11547 {
11548 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11549 {
11550 if (cfg_slot_array[i] == slot_type)
11551 {
11552 soundset = cfg_soundset_array[i];
11553 break;
11554 }
11555 }
11556 }
11557
11558 if (soundset != "")
11559 {
11560 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11562 }
11563 }
11564 }
11565 }
11566
11568 {
11569
11570 }
11571
11572 void OnApply(PlayerBase player);
11573
11575 {
11576 return 1.0;
11577 };
11578
11580 {
11582 }
11583
11585 {
11587 }
11588
11590
11592 {
11593 SetDynamicPhysicsLifeTime(0.01);
11595 }
11596
11598 {
11599 array<string> zone_names = new array<string>;
11600 GetDamageZones(zone_names);
11601 for (int i = 0; i < zone_names.Count(); i++)
11602 {
11603 SetHealthMax(zone_names.Get(i),"Health");
11604 }
11605 SetHealthMax("","Health");
11606 }
11607
11610 {
11611 float global_health = GetHealth01("","Health");
11612 array<string> zones = new array<string>;
11613 GetDamageZones(zones);
11614
11615 for (int i = 0; i < zones.Count(); i++)
11616 {
11617 SetHealth01(zones.Get(i),"Health",global_health);
11618 }
11619 }
11620
11623 {
11624 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11625 }
11626
11628 {
11629 if (!hasRootAsPlayer)
11630 {
11631 if (refParentIB)
11632 {
11633
11634 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11635 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11636
11637 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11638 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11639
11642 }
11643 else
11644 {
11645
11648 }
11649 }
11650 }
11651
11653 {
11655 {
11656 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11657 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11658 {
11659 float heatPermCoef = 1.0;
11661 while (ent)
11662 {
11663 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11664 ent = ent.GetHierarchyParent();
11665 }
11666
11667 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11668 }
11669 }
11670 }
11671
11673 {
11674
11675 EntityAI parent = GetHierarchyParent();
11676 if (!parent)
11677 {
11678 hasParent = false;
11679 hasRootAsPlayer = false;
11680 }
11681 else
11682 {
11683 hasParent = true;
11684 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11685 refParentIB =
ItemBase.Cast(parent);
11686 }
11687 }
11688
11689 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11690 {
11691
11692 }
11693
11695 {
11696
11697 return false;
11698 }
11699
11701 {
11702
11703
11704 return false;
11705 }
11706
11708 {
11709
11710 return false;
11711 }
11712
11715 {
11716 return !GetIsFrozen() &&
IsOpen();
11717 }
11718
11720 {
11721 bool hasParent = false, hasRootAsPlayer = false;
11723
11724 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11725 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11726
11727 if (wwtu || foodDecay)
11728 {
11732
11733 if (processWetness || processTemperature || processDecay)
11734 {
11736
11737 if (processWetness)
11738 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11739
11740 if (processTemperature)
11742
11743 if (processDecay)
11744 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11745 }
11746 }
11747 }
11748
11751 {
11753 }
11754
11756 {
11759
11760 return super.GetTemperatureFreezeThreshold();
11761 }
11762
11764 {
11767
11768 return super.GetTemperatureThawThreshold();
11769 }
11770
11772 {
11775
11776 return super.GetItemOverheatThreshold();
11777 }
11778
11780 {
11782 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11783
11784 return super.GetTemperatureFreezeTime();
11785 }
11786
11788 {
11790 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11791
11792 return super.GetTemperatureThawTime();
11793 }
11794
11799
11801 {
11802 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11803 }
11804
11806 {
11807 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11808 }
11809
11812 {
11814 }
11815
11817 {
11819 }
11820
11822 {
11824 }
11825
11828 {
11829 return null;
11830 }
11831
11834 {
11835 return false;
11836 }
11837
11839 {
11841 {
11844 if (!trg)
11845 {
11847 explosive = this;
11848 }
11849
11850 explosive.PairRemote(trg);
11852
11853 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11854 trg.SetPersistentPairID(persistentID);
11855 explosive.SetPersistentPairID(persistentID);
11856
11857 return true;
11858 }
11859 return false;
11860 }
11861
11864 {
11865 float ret = 1.0;
11868 ret *= GetHealth01();
11869
11870 return ret;
11871 }
11872
11873 #ifdef DEVELOPER
11874 override void SetDebugItem()
11875 {
11876 super.SetDebugItem();
11877 _itemBase = this;
11878 }
11879
11881 {
11882 string text = super.GetDebugText();
11883
11885 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11886
11887 return text;
11888 }
11889 #endif
11890
11892 {
11893 return true;
11894 }
11895
11897
11899
11901 {
11904 }
11905
11906
11914
11930}
11931
11933{
11935 if (entity)
11936 {
11937 bool is_item = entity.IsInherited(
ItemBase);
11938 if (is_item && full_quantity)
11939 {
11942 }
11943 }
11944 else
11945 {
11947 return NULL;
11948 }
11949 return entity;
11950}
11951
11953{
11954 if (item)
11955 {
11956 if (health > 0)
11957 item.SetHealth("", "", health);
11958
11959 if (item.CanHaveTemperature())
11960 {
11962 if (item.CanFreeze())
11963 item.SetFrozen(false);
11964 }
11965
11966 if (item.HasEnergyManager())
11967 {
11968 if (quantity >= 0)
11969 {
11970 item.GetCompEM().SetEnergy0To1(quantity);
11971 }
11972 else
11973 {
11975 }
11976 }
11977 else if (item.IsMagazine())
11978 {
11979 Magazine mag = Magazine.Cast(item);
11980 if (quantity >= 0)
11981 {
11982 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11983 }
11984 else
11985 {
11987 }
11988
11989 }
11990 else
11991 {
11992 if (quantity >= 0)
11993 {
11994 item.SetQuantityNormalized(quantity, false);
11995 }
11996 else
11997 {
11999 }
12000
12001 }
12002 }
12003}
12004
12005#ifdef DEVELOPER
12007#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.