7102{
7104 {
7105 return true;
7106 }
7107};
7108
7109
7110
7112{
7116
7118
7121
7122
7123
7124
7125
7134
7140
7145
7150
7171 protected bool m_IsResultOfSplit
7172
7174
7179
7180
7181
7183
7187
7188
7189
7191
7194
7195
7196
7202
7203
7211
7214
7215
7217
7218
7220
7221
7226
7227
7232
7233
7235
7236
7238 {
7243
7244 if (!
GetGame().IsDedicatedServer())
7245 {
7247 {
7249
7251 {
7253 }
7254 }
7255
7258 }
7259
7260 m_OldLocation = null;
7261
7263 {
7265 }
7266
7267 if (ConfigIsExisting("headSelectionsToHide"))
7268 {
7271 }
7272
7274 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7275 {
7277 }
7278
7280
7281 m_IsResultOfSplit = false;
7282
7284 }
7285
7287 {
7288 super.InitItemVariables();
7289
7295 m_Count = ConfigGetInt(
"count");
7296
7299
7304
7307
7312
7324
7328
7329
7332 if (ConfigIsExisting("canBeSplit"))
7333 {
7336 }
7337
7339 if (ConfigIsExisting("itemBehaviour"))
7341
7342
7345 RegisterNetSyncVariableInt("m_VarLiquidType");
7346 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7347
7348 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7349 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7350 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7351
7352 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7353 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7354 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7355 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7356
7357 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7358 RegisterNetSyncVariableBool("m_IsTakeable");
7359 RegisterNetSyncVariableBool("m_IsHologram");
7360
7363 {
7366 }
7367
7369
7371 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7373
7374 }
7375
7377 {
7379 }
7380
7382 {
7385 {
7390 }
7391 }
7392
7393 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7394 {
7396 {
7399 }
7400
7402 }
7403
7405 {
7411 }
7412
7414
7416 {
7418
7419 if (!action)
7420 {
7421 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7422 return;
7423 }
7424
7426 if (!ai)
7427 {
7429 return;
7430 }
7431
7433 if (!action_array)
7434 {
7435 action_array = new array<ActionBase_Basic>;
7437 }
7438 if (LogManager.IsActionLogEnable())
7439 {
7440 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7441 }
7442
7443 if (action_array.Find(action) != -1)
7444 {
7445 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7446 }
7447 else
7448 {
7449 action_array.Insert(action);
7450 }
7451 }
7452
7454 {
7456 ActionBase action = player.GetActionManager().GetAction(actionName);
7459
7460 if (action_array)
7461 {
7462 action_array.RemoveItem(action);
7463 }
7464 }
7465
7466
7467
7469 {
7470 ActionOverrideData overrideData = new ActionOverrideData();
7474
7476 if (!actionMap)
7477 {
7480 }
7481
7482 actionMap.Insert(this.
Type(), overrideData);
7483
7484 }
7485
7487
7489
7490
7492 {
7495
7498
7499 string config_to_search = "CfgVehicles";
7500 string muzzle_owner_config;
7501
7503 {
7504 if (IsInherited(Weapon))
7505 config_to_search = "CfgWeapons";
7506
7507 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7508
7509 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7510
7512
7513 if (config_OnFire_subclass_count > 0)
7514 {
7515 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7516
7517 for (int i = 0; i < config_OnFire_subclass_count; i++)
7518 {
7519 string particle_class = "";
7521 string config_OnFire_entry = config_OnFire_class + particle_class;
7522 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7523 WPOF_array.Insert(WPOF);
7524 }
7525
7526
7528 }
7529 }
7530
7532 {
7533 config_to_search = "CfgWeapons";
7534 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7535
7536 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7537
7539
7540 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7541 {
7542 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7543
7544 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7545 {
7546 string particle_class2 = "";
7548 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7549 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7550 WPOBE_array.Insert(WPOBE);
7551 }
7552
7553
7555 }
7556 }
7557 }
7558
7559
7561 {
7564
7566 {
7567 string config_to_search = "CfgVehicles";
7568
7569 if (IsInherited(Weapon))
7570 config_to_search = "CfgWeapons";
7571
7572 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7573 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7574
7575 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7576 {
7577
7579
7581 {
7583 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7585 return;
7586 }
7587
7590
7591
7592
7594 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7595
7596 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7597 {
7598 string particle_class = "";
7600 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7602
7603 if (entry_type == CT_CLASS)
7604 {
7605 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7606 WPOOH_array.Insert(WPOF);
7607 }
7608 }
7609
7610
7612 }
7613 }
7614 }
7615
7617 {
7619 }
7620
7622 {
7624 {
7626
7629
7632
7633 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7634 }
7635 }
7636
7638 {
7640 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7641
7643 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7644
7646 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7647
7649 {
7651 }
7652 }
7653
7655 {
7657 }
7658
7660 {
7663 else
7665
7667 {
7670 }
7671 else
7672 {
7675
7678 }
7679
7681 }
7682
7684 {
7686 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7687 }
7688
7690 {
7692 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7694 }
7695
7697 {
7699 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7700 }
7701
7703 {
7706
7707 OverheatingParticle OP = new OverheatingParticle();
7712
7714 }
7715
7717 {
7720
7721 return -1;
7722 }
7723
7725 {
7727 {
7730
7731 for (int i = count; i > 0; --i)
7732 {
7733 int id = i - 1;
7736
7739
7740 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7741 {
7742 if (p)
7743 {
7746 }
7747 }
7748 }
7749 }
7750 }
7751
7753 {
7755 {
7757 {
7758 int id = i - 1;
7760
7761 if (OP)
7762 {
7764
7765 if (p)
7766 {
7768 }
7769
7770 delete OP;
7771 }
7772 }
7773
7776 }
7777 }
7778
7781 {
7782 return 0.0;
7783 }
7784
7785
7787 {
7788 return 250;
7789 }
7790
7792 {
7793 return 0;
7794 }
7795
7798 {
7800 return true;
7801
7802 return false;
7803 }
7804
7807 {
7810
7812 {
7814 }
7815 else
7816 {
7817
7819 }
7820
7822 }
7823
7830 {
7831 return -1;
7832 }
7833
7834
7835
7836
7838 {
7840 {
7842 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7843
7844 if (r_index >= 0)
7845 {
7846 InventoryLocation r_il = new InventoryLocation;
7847 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7848
7849 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7852 {
7853 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7854 }
7856 {
7857 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7858 }
7859
7860 }
7861
7862 player.GetHumanInventory().ClearUserReservedLocation(this);
7863 }
7864
7867 }
7868
7869
7870
7871
7873 {
7874 return ItemBase.m_DebugActionsMask;
7875 }
7876
7878 {
7879 return ItemBase.m_DebugActionsMask & mask;
7880 }
7881
7883 {
7884 ItemBase.m_DebugActionsMask = mask;
7885 }
7886
7888 {
7889 ItemBase.m_DebugActionsMask |= mask;
7890 }
7891
7893 {
7894 ItemBase.m_DebugActionsMask &= ~mask;
7895 }
7896
7898 {
7900 {
7902 }
7903 else
7904 {
7906 }
7907 }
7908
7909
7911 {
7912 if (GetEconomyProfile())
7913 {
7914 float q_max = GetEconomyProfile().GetQuantityMax();
7915 if (q_max > 0)
7916 {
7917 float q_min = GetEconomyProfile().GetQuantityMin();
7918 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7919
7921 {
7922 ComponentEnergyManager comp = GetCompEM();
7924 {
7926 }
7927 }
7929 {
7931
7932 }
7933
7934 }
7935 }
7936 }
7937
7940 {
7941 EntityAI parent = GetHierarchyParent();
7942
7943 if (parent)
7944 {
7945 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7946 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7947 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7948 }
7949 }
7950
7953 {
7954 EntityAI parent = GetHierarchyParent();
7955
7956 if (parent)
7957 {
7958 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7959 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7960 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7961 }
7962 }
7963
7965 {
7966
7967
7968
7969
7971
7973 {
7974 if (ScriptInputUserData.CanStoreInputUserData())
7975 {
7976 ScriptInputUserData ctx = new ScriptInputUserData;
7982 ctx.
Write(use_stack_max);
7985
7987 {
7988 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7989 }
7990 }
7991 }
7992 else if (!
GetGame().IsMultiplayer())
7993 {
7995 }
7996 }
7997
7999 {
8001 }
8002
8004 {
8006 }
8007
8009 {
8011 }
8012
8014 {
8015
8016 return false;
8017 }
8018
8020 {
8021 return false;
8022 }
8023
8027 {
8028 return false;
8029 }
8030
8032 {
8033 return "";
8034 }
8035
8037
8039 {
8040 return false;
8041 }
8042
8044 {
8045 return true;
8046 }
8047
8048
8049
8051 {
8052 return true;
8053 }
8054
8056 {
8057 return true;
8058 }
8059
8061 {
8062 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8064 }
8065
8067 {
8069 }
8070
8072 {
8074 if (!is_being_placed)
8076 SetSynchDirty();
8077 }
8078
8079
8081
8083 {
8085 }
8086
8088 {
8090 }
8091
8093 {
8094 return 1;
8095 }
8096
8098 {
8099 return false;
8100 }
8101
8103 {
8105 SetSynchDirty();
8106 }
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8143 {
8144 super.OnMovedInsideCargo(container);
8145
8146 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8147 }
8148
8149 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8150 {
8151 super.EEItemLocationChanged(oldLoc,newLoc);
8152
8153 PlayerBase new_player = null;
8154 PlayerBase old_player = null;
8155
8156 if (newLoc.GetParent())
8157 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8158
8159 if (oldLoc.GetParent())
8160 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8161
8163 {
8164 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8165
8166 if (r_index >= 0)
8167 {
8168 InventoryLocation r_il = new InventoryLocation;
8169 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8170
8171 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8174 {
8175 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8176 }
8178 {
8179 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8180 }
8181
8182 }
8183 }
8184
8186 {
8187 if (new_player)
8188 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8189
8190 if (new_player == old_player)
8191 {
8192
8193 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8194 {
8196 {
8197 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8198 {
8199 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8200 }
8201 }
8202 else
8203 {
8204 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8205 }
8206 }
8207
8208 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8209 {
8210 int type = oldLoc.GetType();
8212 {
8213 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8214 }
8216 {
8217 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8218 }
8219 }
8220 if (!m_OldLocation)
8221 {
8222 m_OldLocation = new InventoryLocation;
8223 }
8224 m_OldLocation.Copy(oldLoc);
8225 }
8226 else
8227 {
8228 if (m_OldLocation)
8229 {
8230 m_OldLocation.Reset();
8231 }
8232 }
8233
8235 }
8236 else
8237 {
8238 if (new_player)
8239 {
8240 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8241 if (res_index >= 0)
8242 {
8243 InventoryLocation il = new InventoryLocation;
8244 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8246 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8249 {
8250 il.
GetParent().GetOnReleaseLock().Invoke(it);
8251 }
8253 {
8255 }
8256
8257 }
8258 }
8260 {
8261
8263 }
8264
8265 if (m_OldLocation)
8266 {
8267 m_OldLocation.Reset();
8268 }
8269 }
8270 }
8271
8272 override void EOnContact(IEntity other, Contact extra)
8273 {
8275 {
8276 int liquidType = -1;
8278 if (impactSpeed > 0.0)
8279 {
8281 #ifndef SERVER
8283 #else
8285 SetSynchDirty();
8286 #endif
8288 }
8289 }
8290
8291 #ifdef SERVER
8292 if (GetCompEM() && GetCompEM().IsPlugged())
8293 {
8294 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8295 GetCompEM().UnplugThis();
8296 }
8297 #endif
8298 }
8299
8301
8303 {
8305 }
8306
8308 {
8309
8310 }
8311
8313 {
8314 super.OnItemLocationChanged(old_owner, new_owner);
8315
8316 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8317 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8318
8319 if (!relatedPlayer && playerNew)
8320 relatedPlayer = playerNew;
8321
8322 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8323 {
8325 if (actionMgr)
8326 {
8327 ActionBase currentAction = actionMgr.GetRunningAction();
8328 if (currentAction)
8330 }
8331 }
8332
8333 Man ownerPlayerOld = null;
8334 Man ownerPlayerNew = null;
8335
8336 if (old_owner)
8337 {
8338 if (old_owner.
IsMan())
8339 {
8340 ownerPlayerOld = Man.Cast(old_owner);
8341 }
8342 else
8343 {
8344 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8345 }
8346 }
8347 else
8348 {
8350 {
8352
8353 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8354 {
8355 GetCompEM().UnplugThis();
8356 }
8357 }
8358 }
8359
8360 if (new_owner)
8361 {
8362 if (new_owner.
IsMan())
8363 {
8364 ownerPlayerNew = Man.Cast(new_owner);
8365 }
8366 else
8367 {
8368 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8369 }
8370 }
8371
8372 if (ownerPlayerOld != ownerPlayerNew)
8373 {
8374 if (ownerPlayerOld)
8375 {
8376 array<EntityAI> subItemsExit = new array<EntityAI>;
8378 for (int i = 0; i < subItemsExit.Count(); i++)
8379 {
8382 }
8383 }
8384
8385 if (ownerPlayerNew)
8386 {
8387 array<EntityAI> subItemsEnter = new array<EntityAI>;
8389 for (int j = 0; j < subItemsEnter.Count(); j++)
8390 {
8393 }
8394 }
8395 }
8396 else if (ownerPlayerNew != null)
8397 {
8398 PlayerBase nplayer;
8399 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8400 {
8401 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8403 for (int k = 0; k < subItemsUpdate.Count(); k++)
8404 {
8406 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8407 }
8408 }
8409 }
8410
8411 if (old_owner)
8412 old_owner.OnChildItemRemoved(this);
8413 if (new_owner)
8414 new_owner.OnChildItemReceived(this);
8415 }
8416
8417
8419 {
8420 super.EEDelete(parent);
8421 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8422 if (player)
8423 {
8425
8426 if (player.IsAlive())
8427 {
8428 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8429 if (r_index >= 0)
8430 {
8431 InventoryLocation r_il = new InventoryLocation;
8432 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8433
8434 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8437 {
8438 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8439 }
8441 {
8442 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8443 }
8444
8445 }
8446
8447 player.RemoveQuickBarEntityShortcut(this);
8448 }
8449 }
8450 }
8451
8453 {
8454 super.EEKilled(killer);
8455
8458 {
8459 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8460 {
8461 if (IsMagazine())
8462 {
8463 if (Magazine.Cast(this).GetAmmoCount() > 0)
8464 {
8466 }
8467 }
8468 else
8469 {
8471 }
8472 }
8473 }
8474 }
8475
8477 {
8478 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8479
8480 super.OnWasAttached(parent, slot_id);
8481
8484
8486 }
8487
8489 {
8490 super.OnWasDetached(parent, slot_id);
8491
8494 }
8495
8497 {
8498 int idx;
8501
8502 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8503 if (inventory_slots.Count() < 1)
8504 {
8505 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8506 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8507 }
8508 else
8509 {
8510 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8511 }
8512
8513 idx = inventory_slots.Find(slot);
8514 if (idx < 0)
8515 return "";
8516
8517 return attach_types.Get(idx);
8518 }
8519
8521 {
8522 int idx = -1;
8523 string slot;
8524
8527
8528 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8529 if (inventory_slots.Count() < 1)
8530 {
8531 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8532 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8533 }
8534 else
8535 {
8536 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8537 if (detach_types.Count() < 1)
8538 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8539 }
8540
8541 for (int i = 0; i < inventory_slots.Count(); i++)
8542 {
8543 slot = inventory_slots.Get(i);
8544 }
8545
8546 if (slot != "")
8547 {
8548 if (detach_types.Count() == 1)
8549 idx = 0;
8550 else
8551 idx = inventory_slots.Find(slot);
8552 }
8553 if (idx < 0)
8554 return "";
8555
8556 return detach_types.Get(idx);
8557 }
8558
8560 {
8561
8563
8564
8565 float min_time = 1;
8566 float max_time = 3;
8567 float delay = Math.RandomFloat(min_time, max_time);
8568
8569 explode_timer.Run(delay, this, "DoAmmoExplosion");
8570 }
8571
8573 {
8574 Magazine magazine = Magazine.Cast(this);
8575 int pop_sounds_count = 6;
8576 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8577
8578
8579 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8580 string sound_name = pop_sounds[ sound_idx ];
8582
8583
8584 magazine.ServerAddAmmoCount(-1);
8585
8586
8587 float min_temp_to_explode = 100;
8588
8589 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8590 {
8592 }
8593 }
8594
8595
8596 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8597 {
8598 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8599
8600 const int CHANCE_DAMAGE_CARGO = 4;
8601 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8602 const int CHANCE_DAMAGE_NOTHING = 2;
8603
8605 {
8606 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8607 int chances;
8608 int rnd;
8609
8610 if (GetInventory().GetCargo())
8611 {
8612 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8613 rnd = Math.RandomInt(0,chances);
8614
8615 if (rnd < CHANCE_DAMAGE_CARGO)
8616 {
8618 }
8619 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8620 {
8622 }
8623 }
8624 else
8625 {
8626 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8627 rnd = Math.RandomInt(0,chances);
8628
8629 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8630 {
8632 }
8633 }
8634 }
8635 }
8636
8638 {
8639 if (GetInventory().GetCargo())
8640 {
8641 int item_count = GetInventory().GetCargo().GetItemCount();
8642 if (item_count > 0)
8643 {
8644 int random_pick = Math.RandomInt(0, item_count);
8646 if (!item.IsExplosive())
8647 {
8648 item.AddHealth("","",damage);
8649 return true;
8650 }
8651 }
8652 }
8653 return false;
8654 }
8655
8657 {
8658 int attachment_count = GetInventory().AttachmentCount();
8659 if (attachment_count > 0)
8660 {
8661 int random_pick = Math.RandomInt(0, attachment_count);
8662 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8663 if (!attachment.IsExplosive())
8664 {
8665 attachment.AddHealth("","",damage);
8666 return true;
8667 }
8668 }
8669 return false;
8670 }
8671
8673 {
8675 }
8676
8678 {
8680 return GetInventory().CanRemoveEntity();
8681
8682 return false;
8683 }
8684
8686 {
8687
8689 return false;
8690
8691
8693 return false;
8694
8695
8696
8698 if (delta == 0)
8699 return false;
8700
8701
8702 return true;
8703 }
8704
8706 {
8708 {
8709 if (ScriptInputUserData.CanStoreInputUserData())
8710 {
8711 ScriptInputUserData ctx = new ScriptInputUserData;
8716 ctx.
Write(destination_entity);
8720 }
8721 }
8722 else if (!
GetGame().IsMultiplayer())
8723 {
8725 }
8726 }
8727
8729 {
8730 float split_quantity_new;
8734 InventoryLocation loc = new InventoryLocation;
8735
8736 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8737 {
8739 split_quantity_new = stack_max;
8740 else
8742
8744 {
8745 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8746 if (new_item)
8747 {
8748 new_item.SetResultOfSplit(true);
8749 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8751 new_item.
SetQuantity(split_quantity_new,
false,
true);
8752 }
8753 }
8754 }
8755 else if (destination_entity && slot_id == -1)
8756 {
8757 if (quantity > stack_max)
8758 split_quantity_new = stack_max;
8759 else
8760 split_quantity_new = quantity;
8761
8763 {
8765 {
8768 }
8769
8770 if (new_item)
8771 {
8772 new_item.SetResultOfSplit(true);
8773 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8775 new_item.
SetQuantity(split_quantity_new,
false,
true);
8776 }
8777 }
8778 }
8779 else
8780 {
8781 if (stack_max != 0)
8782 {
8784 {
8786 }
8787
8788 if (split_quantity_new == 0)
8789 {
8790 if (!
GetGame().IsMultiplayer())
8791 player.PhysicalPredictiveDropItem(this);
8792 else
8793 player.ServerDropEntity(this);
8794 return;
8795 }
8796
8798 {
8800
8801 if (new_item)
8802 {
8803 new_item.SetResultOfSplit(true);
8804 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8807 new_item.PlaceOnSurface();
8808 }
8809 }
8810 }
8811 }
8812 }
8813
8815 {
8816 float split_quantity_new;
8820 InventoryLocation loc = new InventoryLocation;
8821
8822 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8823 {
8825 split_quantity_new = stack_max;
8826 else
8828
8830 {
8831 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8832 if (new_item)
8833 {
8834 new_item.SetResultOfSplit(true);
8835 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8837 new_item.
SetQuantity(split_quantity_new,
false,
true);
8838 }
8839 }
8840 }
8841 else if (destination_entity && slot_id == -1)
8842 {
8843 if (quantity > stack_max)
8844 split_quantity_new = stack_max;
8845 else
8846 split_quantity_new = quantity;
8847
8849 {
8851 {
8854 }
8855
8856 if (new_item)
8857 {
8858 new_item.SetResultOfSplit(true);
8859 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8861 new_item.
SetQuantity(split_quantity_new,
false,
true);
8862 }
8863 }
8864 }
8865 else
8866 {
8867 if (stack_max != 0)
8868 {
8870 {
8872 }
8873
8875 {
8877
8878 if (new_item)
8879 {
8880 new_item.SetResultOfSplit(true);
8881 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8884 new_item.PlaceOnSurface();
8885 }
8886 }
8887 }
8888 }
8889 }
8890
8892 {
8894 {
8895 if (ScriptInputUserData.CanStoreInputUserData())
8896 {
8897 ScriptInputUserData ctx = new ScriptInputUserData;
8902 dst.WriteToContext(ctx);
8904 }
8905 }
8906 else if (!
GetGame().IsMultiplayer())
8907 {
8909 }
8910 }
8911
8913 {
8915 {
8916 if (ScriptInputUserData.CanStoreInputUserData())
8917 {
8918 ScriptInputUserData ctx = new ScriptInputUserData;
8923 ctx.
Write(destination_entity);
8929 }
8930 }
8931 else if (!
GetGame().IsMultiplayer())
8932 {
8934 }
8935 }
8936
8938 {
8940 }
8941
8943 {
8945 float split_quantity_new;
8947 if (dst.IsValid())
8948 {
8949 int slot_id = dst.GetSlot();
8951
8952 if (quantity > stack_max)
8953 split_quantity_new = stack_max;
8954 else
8955 split_quantity_new = quantity;
8956
8958 {
8960
8961 if (new_item)
8962 {
8963 new_item.SetResultOfSplit(true);
8964 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8966 new_item.
SetQuantity(split_quantity_new,
false,
true);
8967 }
8968
8969 return new_item;
8970 }
8971 }
8972
8973 return null;
8974 }
8975
8977 {
8979 float split_quantity_new;
8981 if (destination_entity)
8982 {
8984 if (quantity > stackable)
8985 split_quantity_new = stackable;
8986 else
8987 split_quantity_new = quantity;
8988
8990 {
8991 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8992 if (new_item)
8993 {
8994 new_item.SetResultOfSplit(true);
8995 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8997 new_item.
SetQuantity(split_quantity_new,
false,
true);
8998 }
8999 }
9000 }
9001 }
9002
9004 {
9006 {
9007 if (ScriptInputUserData.CanStoreInputUserData())
9008 {
9009 ScriptInputUserData ctx = new ScriptInputUserData;
9014 ItemBase destination_entity =
this;
9015 ctx.
Write(destination_entity);
9019 }
9020 }
9021 else if (!
GetGame().IsMultiplayer())
9022 {
9024 }
9025 }
9026
9028 {
9030 float split_quantity_new;
9032 if (player)
9033 {
9035 if (quantity > stackable)
9036 split_quantity_new = stackable;
9037 else
9038 split_quantity_new = quantity;
9039
9041 {
9042 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9043 new_item =
ItemBase.Cast(in_hands);
9044 if (new_item)
9045 {
9046 new_item.SetResultOfSplit(true);
9047 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9049 new_item.SetQuantity(split_quantity_new, false, true);
9050 }
9051 }
9052 }
9053 }
9054
9056 {
9058 float split_quantity_new = Math.Floor(quantity * 0.5);
9059
9061 return;
9062
9064
9065 if (new_item)
9066 {
9067 if (new_item.GetQuantityMax() < split_quantity_new)
9068 {
9069 split_quantity_new = new_item.GetQuantityMax();
9070 }
9071
9072 new_item.SetResultOfSplit(true);
9073 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9074
9076 {
9079 }
9080 else
9081 {
9083 new_item.
SetQuantity(split_quantity_new,
false,
true);
9084 }
9085 }
9086 }
9087
9089 {
9091 float split_quantity_new = Math.Floor(quantity / 2);
9092
9094 return;
9095
9096 InventoryLocation invloc = new InventoryLocation;
9098
9100 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9101
9102 if (new_item)
9103 {
9104 if (new_item.GetQuantityMax() < split_quantity_new)
9105 {
9106 split_quantity_new = new_item.GetQuantityMax();
9107 }
9109 {
9112 }
9113 else if (split_quantity_new > 1)
9114 {
9116 new_item.
SetQuantity(split_quantity_new,
false,
true);
9117 }
9118 }
9119 }
9120
9123 {
9124 SetWeightDirty();
9126
9127 if (parent)
9128 parent.OnAttachmentQuantityChangedEx(this, delta);
9129
9131 {
9133 {
9135 }
9137 {
9138 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9140 }
9141 }
9142
9143 }
9144
9147 {
9148
9149 }
9150
9153 {
9155 }
9156
9158 {
9159 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9160
9162 {
9163 if (newLevel == GameConstants.STATE_RUINED)
9164 {
9166 EntityAI parent = GetHierarchyParent();
9167 if (parent && parent.IsFireplace())
9168 {
9169 CargoBase cargo = GetInventory().GetCargo();
9170 if (cargo)
9171 {
9173 {
9175 }
9176 }
9177 }
9178 }
9179
9181 {
9182
9184 return;
9185 }
9186
9187 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9188 {
9190 }
9191 }
9192 }
9193
9194
9196 {
9197 super.OnRightClick();
9198
9200 {
9202 {
9203 if (ScriptInputUserData.CanStoreInputUserData())
9204 {
9205 EntityAI root = GetHierarchyRoot();
9206 Man playerOwner = GetHierarchyRootPlayer();
9207 InventoryLocation dst = new InventoryLocation;
9208
9209
9210 if (!playerOwner && root && root == this)
9211 {
9213 }
9214 else
9215 {
9216
9217 GetInventory().GetCurrentInventoryLocation(dst);
9219 {
9222 {
9224 }
9225 else
9226 {
9228
9229
9230 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9231 {
9233 }
9234 else
9235 {
9236 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9237 }
9238 }
9239 }
9240 }
9241
9242 ScriptInputUserData ctx = new ScriptInputUserData;
9250 }
9251 }
9252 else if (!
GetGame().IsMultiplayer())
9253 {
9255 }
9256 }
9257 }
9258
9260 {
9261 if (root)
9262 {
9263 vector m4[4];
9264 root.GetTransform(m4);
9265 dst.SetGround(this, m4);
9266 }
9267 else
9268 {
9269 GetInventory().GetCurrentInventoryLocation(dst);
9270 }
9271 }
9272
9273 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9274 {
9275
9276 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9277 return false;
9278
9279 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9280 return false;
9281
9282
9284 return false;
9285
9286
9287 Magazine mag = Magazine.Cast(this);
9288 if (mag)
9289 {
9290 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9291 return false;
9292
9293 if (stack_max_limit)
9294 {
9295 Magazine other_mag = Magazine.Cast(other_item);
9296 if (other_item)
9297 {
9298 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9299 return false;
9300 }
9301
9302 }
9303 }
9304 else
9305 {
9306
9308 return false;
9309
9311 return false;
9312 }
9313
9314 PlayerBase player = null;
9315 if (CastTo(player, GetHierarchyRootPlayer()))
9316 {
9317 if (player.GetInventory().HasAttachment(this))
9318 return false;
9319
9320 if (player.IsItemsToDelete())
9321 return false;
9322 }
9323
9324 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9325 return false;
9326
9327 int slotID;
9329 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9330 return false;
9331
9332 return true;
9333 }
9334
9336 {
9338 }
9339
9341 {
9342 return m_IsResultOfSplit;
9343 }
9344
9346 {
9347 m_IsResultOfSplit = value;
9348 }
9349
9351 {
9353 }
9354
9356 {
9357 float other_item_quantity = other_item.GetQuantity();
9358 float this_free_space;
9359
9361
9363
9364 if (other_item_quantity > this_free_space)
9365 {
9366 return this_free_space;
9367 }
9368 else
9369 {
9370 return other_item_quantity;
9371 }
9372 }
9373
9375 {
9377 }
9378
9380 {
9382 return;
9383
9384 if (!IsMagazine() && other_item)
9385 {
9387 if (quantity_used != 0)
9388 {
9389 float hp1 = GetHealth01("","");
9390 float hp2 = other_item.GetHealth01("","");
9391 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9392 hpResult = hpResult / (
GetQuantity() + quantity_used);
9393
9394 hpResult *= GetMaxHealth();
9395 Math.Round(hpResult);
9396 SetHealth("", "Health", hpResult);
9397
9399 other_item.AddQuantity(-quantity_used);
9400 }
9401 }
9403 }
9404
9406 {
9407 #ifdef SERVER
9408 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9409 GetHierarchyParent().IncreaseLifetimeUp();
9410 #endif
9411 };
9412
9414 {
9415 PlayerBase p = PlayerBase.Cast(player);
9416
9417 array<int> recipesIds = p.m_Recipes;
9418 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9419 if (moduleRecipesManager)
9420 {
9421 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9422 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9423 }
9424
9425 for (int i = 0;i < recipesIds.Count(); i++)
9426 {
9427 int key = recipesIds.Get(i);
9428 string recipeName = moduleRecipesManager.GetRecipeName(key);
9430 }
9431 }
9432
9433
9434 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9435 {
9436 super.GetDebugActions(outputList);
9437
9438
9444
9445
9450
9455
9456
9460
9461
9463 {
9467 }
9468
9471
9472
9476
9478
9479 InventoryLocation loc = new InventoryLocation();
9480 GetInventory().GetCurrentInventoryLocation(loc);
9482 {
9483 if (Gizmo_IsSupported())
9486 }
9487
9489 }
9490
9491
9492
9493
9495 {
9496 super.OnAction(action_id, player, ctx);
9497
9499 {
9500 switch (action_id)
9501 {
9504 return true;
9507 return true;
9508 }
9509 }
9510
9512 {
9513 switch (action_id)
9514 {
9516 Delete();
9517 return true;
9518 }
9519 }
9520
9521 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9522 {
9523 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9524 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9525 PlayerBase p = PlayerBase.Cast(player);
9526 if (
EActions.RECIPES_RANGE_START < 1000)
9527 {
9528 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9529 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9530 }
9531 }
9532 #ifndef SERVER
9533 else if (action_id ==
EActions.WATCH_PLAYER)
9534 {
9535 PluginDeveloper.SetDeveloperItemClientEx(player);
9536 }
9537 #endif
9539 {
9540 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9541 {
9542 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9543 OnDebugButtonPressServer(id + 1);
9544 }
9545
9546 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9547 {
9548 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9550 }
9551
9552 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9553 {
9554 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9556 }
9557
9558 else if (action_id ==
EActions.ADD_QUANTITY)
9559 {
9560 if (IsMagazine())
9561 {
9562 Magazine mag = Magazine.Cast(this);
9563 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9564 }
9565 else
9566 {
9568 }
9569
9570 if (m_EM)
9571 {
9572 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9573 }
9574
9575 }
9576
9577 else if (action_id ==
EActions.REMOVE_QUANTITY)
9578 {
9579 if (IsMagazine())
9580 {
9581 Magazine mag2 = Magazine.Cast(this);
9582 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9583 }
9584 else
9585 {
9587 }
9588 if (m_EM)
9589 {
9590 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9591 }
9592
9593 }
9594
9595 else if (action_id ==
EActions.SET_QUANTITY_0)
9596 {
9598
9599 if (m_EM)
9600 {
9601 m_EM.SetEnergy(0);
9602 }
9603 }
9604
9605 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9606 {
9608
9609 if (m_EM)
9610 {
9611 m_EM.SetEnergy(m_EM.GetEnergyMax());
9612 }
9613 }
9614
9615 else if (action_id ==
EActions.ADD_HEALTH)
9616 {
9617 AddHealth("","",GetMaxHealth("","Health")/5);
9618 }
9619 else if (action_id ==
EActions.REMOVE_HEALTH)
9620 {
9621 AddHealth("","",-GetMaxHealth("","Health")/5);
9622 }
9623 else if (action_id ==
EActions.DESTROY_HEALTH)
9624 {
9625 SetHealth01("","",0);
9626 }
9627 else if (action_id ==
EActions.WATCH_ITEM)
9628 {
9630 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9631 #ifdef DEVELOPER
9632 SetDebugDeveloper_item(this);
9633 #endif
9634 }
9635
9636 else if (action_id ==
EActions.ADD_TEMPERATURE)
9637 {
9638 AddTemperature(20);
9639
9640 }
9641
9642 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9643 {
9644 AddTemperature(-20);
9645
9646 }
9647
9648 else if (action_id ==
EActions.FLIP_FROZEN)
9649 {
9650 SetFrozen(!GetIsFrozen());
9651
9652 }
9653
9654 else if (action_id ==
EActions.ADD_WETNESS)
9655 {
9657
9658 }
9659
9660 else if (action_id ==
EActions.REMOVE_WETNESS)
9661 {
9663
9664 }
9665
9666 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9667 {
9670
9671
9672 }
9673
9674 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9675 {
9678 }
9679
9680 else if (action_id ==
EActions.MAKE_SPECIAL)
9681 {
9682 auto debugParams = DebugSpawnParams.WithPlayer(player);
9683 OnDebugSpawnEx(debugParams);
9684 }
9685
9686 }
9687
9688
9689 return false;
9690 }
9691
9692
9693
9694
9698
9701
9702
9703
9705 {
9706 return false;
9707 }
9708
9709
9711 {
9712 return true;
9713 }
9714
9715
9717 {
9718 return true;
9719 }
9720
9721
9722
9724 {
9725 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9727 }
9728
9731 {
9732 return null;
9733 }
9734
9736 {
9737 return false;
9738 }
9739
9741 {
9742 return false;
9743 }
9744
9748
9749
9751 {
9752 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9753 return module_repairing.CanRepair(this, item_repair_kit);
9754 }
9755
9756
9757 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9758 {
9759 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9760 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9761 }
9762
9763
9765 {
9766
9767
9768
9769
9770
9771
9772
9773
9774 return 1;
9775 }
9776
9777
9778
9780 {
9782 }
9783
9784
9785
9787 {
9789 }
9790
9791
9800 {
9801 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9802
9803 if (player)
9804 {
9805 player.MessageStatus(text);
9806 }
9807 }
9808
9809
9818 {
9819 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9820
9821 if (player)
9822 {
9823 player.MessageAction(text);
9824 }
9825 }
9826
9827
9836 {
9837 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9838
9839 if (player)
9840 {
9841 player.MessageFriendly(text);
9842 }
9843 }
9844
9845
9854 {
9855 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9856
9857 if (player)
9858 {
9859 player.MessageImportant(text);
9860 }
9861 }
9862
9864 {
9865 return true;
9866 }
9867
9868
9869 override bool KindOf(
string tag)
9870 {
9871 bool found = false;
9872 string item_name = this.
GetType();
9875
9876 int array_size = item_tag_array.Count();
9877 for (int i = 0; i < array_size; i++)
9878 {
9879 if (item_tag_array.Get(i) == tag)
9880 {
9881 found = true;
9882 break;
9883 }
9884 }
9885 return found;
9886 }
9887
9888
9890 {
9891
9892 super.OnRPC(sender, rpc_type,ctx);
9893
9894
9895 switch (rpc_type)
9896 {
9897 #ifndef SERVER
9898 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9899 Param2<bool, string> p = new Param2<bool, string>(false, "");
9900
9902 return;
9903
9904 bool play = p.param1;
9905 string soundSet = p.param2;
9906
9907 if (play)
9908 {
9910 {
9912 {
9914 }
9915 }
9916 else
9917 {
9919 }
9920 }
9921 else
9922 {
9924 }
9925
9926 break;
9927 #endif
9928
9929 }
9930
9932 {
9934 }
9935 }
9936
9937
9938
9939
9941 {
9942 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9943 return plugin.GetID(
name);
9944 }
9945
9947 {
9948 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9949 return plugin.GetName(id);
9950 }
9951
9954 {
9955
9956
9957 int varFlags;
9958 if (!ctx.
Read(varFlags))
9959 return;
9960
9961 if (varFlags & ItemVariableFlags.FLOAT)
9962 {
9964 }
9965 }
9966
9968 {
9969
9970 super.SerializeNumericalVars(floats_out);
9971
9972
9973
9975 {
9977 }
9978
9980 {
9982 }
9983
9985 {
9987 }
9988
9990 {
9995 }
9996
9998 {
10000 }
10001 }
10002
10004 {
10005
10006 super.DeSerializeNumericalVars(floats);
10007
10008
10009 int index = 0;
10010 int mask = Math.Round(floats.Get(index));
10011
10012 index++;
10013
10015 {
10017 {
10019 }
10020 else
10021 {
10022 float quantity = floats.Get(index);
10023 SetQuantity(quantity,
true,
false,
false,
false);
10024 }
10025 index++;
10026 }
10027
10029 {
10030 float wet = floats.Get(index);
10032 index++;
10033 }
10034
10036 {
10037 int liquidtype = Math.Round(floats.Get(index));
10039 index++;
10040 }
10041
10043 {
10045 index++;
10047 index++;
10049 index++;
10051 index++;
10052 }
10053
10055 {
10056 int cleanness = Math.Round(floats.Get(index));
10058 index++;
10059 }
10060 }
10061
10063 {
10064 super.WriteVarsToCTX(ctx);
10065
10066
10068 {
10070 }
10071
10073 {
10075 }
10076
10078 {
10080 }
10081
10083 {
10084 int r,g,b,a;
10090 }
10091
10093 {
10095 }
10096 }
10097
10099 {
10100 if (!super.ReadVarsFromCTX(ctx,version))
10101 return false;
10102
10103 int intValue;
10104 float value;
10105
10106 if (version < 140)
10107 {
10108 if (!ctx.
Read(intValue))
10109 return false;
10110
10111 m_VariablesMask = intValue;
10112 }
10113
10115 {
10116 if (!ctx.
Read(value))
10117 return false;
10118
10120 {
10122 }
10123 else
10124 {
10126 }
10127 }
10128
10129 if (version < 140)
10130 {
10132 {
10133 if (!ctx.
Read(value))
10134 return false;
10135 SetTemperatureDirect(value);
10136 }
10137 }
10138
10140 {
10141 if (!ctx.
Read(value))
10142 return false;
10144 }
10145
10147 {
10148 if (!ctx.
Read(intValue))
10149 return false;
10151 }
10152
10154 {
10155 int r,g,b,a;
10157 return false;
10159 return false;
10161 return false;
10163 return false;
10164
10166 }
10167
10169 {
10170 if (!ctx.
Read(intValue))
10171 return false;
10173 }
10174
10175 if (version >= 138 && version < 140)
10176 {
10178 {
10179 if (!ctx.
Read(intValue))
10180 return false;
10181 SetFrozen(intValue);
10182 }
10183 }
10184
10185 return true;
10186 }
10187
10188
10190 {
10193 {
10195 }
10196
10197 if (!super.OnStoreLoad(ctx, version))
10198 {
10200 return false;
10201 }
10202
10203 if (version >= 114)
10204 {
10205 bool hasQuickBarIndexSaved;
10206
10207 if (!ctx.
Read(hasQuickBarIndexSaved))
10208 {
10210 return false;
10211 }
10212
10213 if (hasQuickBarIndexSaved)
10214 {
10215 int itmQBIndex;
10216
10217
10218 if (!ctx.
Read(itmQBIndex))
10219 {
10221 return false;
10222 }
10223
10224 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10225 if (itmQBIndex != -1 && parentPlayer)
10226 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10227 }
10228 }
10229 else
10230 {
10231
10232 PlayerBase player;
10233 int itemQBIndex;
10234 if (version ==
int.
MAX)
10235 {
10236 if (!ctx.
Read(itemQBIndex))
10237 {
10239 return false;
10240 }
10241 }
10242 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10243 {
10244
10245 if (!ctx.
Read(itemQBIndex))
10246 {
10248 return false;
10249 }
10250 if (itemQBIndex != -1 && player)
10251 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10252 }
10253 }
10254
10255 if (version < 140)
10256 {
10257
10258 if (!LoadVariables(ctx, version))
10259 {
10261 return false;
10262 }
10263 }
10264
10265
10267 {
10269 return false;
10270 }
10271 if (version >= 132)
10272 {
10274 if (raib)
10275 {
10277 {
10279 return false;
10280 }
10281 }
10282 }
10283
10285 return true;
10286 }
10287
10288
10289
10291 {
10292 super.OnStoreSave(ctx);
10293
10294 PlayerBase player;
10295 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10296 {
10298
10299 int itemQBIndex = -1;
10300 itemQBIndex = player.FindQuickBarEntityIndex(this);
10301 ctx.
Write(itemQBIndex);
10302 }
10303 else
10304 {
10306 }
10307
10309
10311 if (raib)
10312 {
10314 }
10315 }
10316
10317
10319 {
10320 super.AfterStoreLoad();
10321
10323 {
10325 }
10326
10328 {
10331 }
10332 }
10333
10335 {
10336 super.EEOnAfterLoad();
10337
10339 {
10341 }
10342
10345 }
10346
10348 {
10349 return false;
10350 }
10351
10352
10353
10355 {
10357 {
10358 #ifdef PLATFORM_CONSOLE
10359
10361 {
10363 if (menu)
10364 {
10366 }
10367 }
10368 #endif
10369 }
10370
10372 {
10375 }
10376
10378 {
10379 SetWeightDirty();
10381 }
10383 {
10386 }
10387
10389 {
10392 }
10394 {
10397 }
10398
10399 super.OnVariablesSynchronized();
10400 }
10401
10402
10403
10405 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10406 {
10407 if (!IsServerCheck(allow_client))
10408 return false;
10409
10411 return false;
10412
10415
10416 if (value <= (min + 0.001))
10417 value = min;
10418
10419 if (value == min)
10420 {
10421 if (destroy_config)
10422 {
10423 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10424 if (dstr)
10425 {
10427 this.Delete();
10428 return true;
10429 }
10430 }
10431 else if (destroy_forced)
10432 {
10434 this.Delete();
10435 return true;
10436 }
10437
10439 }
10440
10443
10445 {
10447
10448 if (delta)
10450 }
10451
10453
10454 return false;
10455 }
10456
10457
10459 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10460 {
10462 }
10463
10465 {
10468 }
10469
10471 {
10474 }
10475
10477 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10478 {
10479 float value_clamped = Math.Clamp(value, 0, 1);
10481 SetQuantity(result, destroy_config, destroy_forced);
10482 }
10483
10484
10487 {
10489 }
10490
10492 {
10494 }
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10506 {
10507 int slot = -1;
10508 if (GetInventory())
10509 {
10510 InventoryLocation il = new InventoryLocation;
10511 GetInventory().GetCurrentInventoryLocation(il);
10513 }
10514
10516 }
10517
10519 {
10520 float quantity_max = 0;
10521
10523 {
10524 if (attSlotID != -1)
10525 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10526
10527 if (quantity_max <= 0)
10529 }
10530
10531 if (quantity_max <= 0)
10533
10534 return quantity_max;
10535 }
10536
10538 {
10540 }
10541
10543 {
10545 }
10546
10547
10549 {
10551 }
10552
10554 {
10556 }
10557
10559 {
10561 }
10562
10563
10565 {
10566
10567 float weightEx = GetWeightEx();
10568 float special = GetInventoryAndCargoWeight();
10569 return weightEx - special;
10570 }
10571
10572
10574 {
10576 }
10577
10579 {
10581 {
10582 #ifdef DEVELOPER
10583 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10584 {
10585 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10587 }
10588 #endif
10589
10590 return GetQuantity() * GetConfigWeightModified();
10591 }
10592 else if (HasEnergyManager())
10593 {
10594 #ifdef DEVELOPER
10595 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10596 {
10597 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10598 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10599 }
10600 #endif
10601 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10602 }
10603 else
10604 {
10605 #ifdef DEVELOPER
10606 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10607 {
10608 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10609 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10610 }
10611 #endif
10612 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10613 }
10614 }
10615
10618 {
10619 int item_count = 0;
10621
10622 if (GetInventory().GetCargo() != NULL)
10623 {
10624 item_count = GetInventory().GetCargo().GetItemCount();
10625 }
10626
10627 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10628 {
10629 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10630 if (item)
10631 item_count += item.GetNumberOfItems();
10632 }
10633 return item_count;
10634 }
10635
10638 {
10639 float weight = 0;
10640 float wetness = 1;
10641 if (include_wetness)
10644 {
10645 weight = wetness * m_ConfigWeight;
10646 }
10648 {
10649 weight = 1;
10650 }
10651 return weight;
10652 }
10653
10654
10655
10657 {
10658 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10659 {
10660 GameInventory inv = GetInventory();
10661 array<EntityAI> items = new array<EntityAI>;
10663 for (int i = 0; i < items.Count(); i++)
10664 {
10666 if (item)
10667 {
10669 }
10670 }
10671 }
10672 }
10673
10674
10675
10676
10678 {
10679 float energy = 0;
10680 if (HasEnergyManager())
10681 {
10682 energy = GetCompEM().GetEnergy();
10683 }
10684 return energy;
10685 }
10686
10687
10689 {
10690 super.OnEnergyConsumed();
10691
10693 }
10694
10696 {
10697 super.OnEnergyAdded();
10698
10700 }
10701
10702
10704 {
10705 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10706 {
10708 {
10709 float energy_0to1 = GetCompEM().GetEnergy0To1();
10711 }
10712 }
10713 }
10714
10715
10717 {
10718 return ConfigGetFloat("heatIsolation");
10719 }
10720
10722 {
10724 }
10725
10727 {
10728 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10729 if (
GetGame().ConfigIsExisting(paramPath))
10731
10732 return 0.0;
10733 }
10734
10736 {
10737 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10738 if (
GetGame().ConfigIsExisting(paramPath))
10740
10741 return 0.0;
10742 }
10743
10744 override void SetWet(
float value,
bool allow_client =
false)
10745 {
10746 if (!IsServerCheck(allow_client))
10747 return;
10748
10751
10753
10754 m_VarWet = Math.Clamp(value, min, max);
10755
10757 {
10760 }
10761 }
10762
10763 override void AddWet(
float value)
10764 {
10766 }
10767
10769 {
10771 }
10772
10774 {
10776 }
10777
10779 {
10781 }
10782
10784 {
10786 }
10787
10789 {
10791 }
10792
10793 override void OnWetChanged(
float newVal,
float oldVal)
10794 {
10797 if (newLevel != oldLevel)
10798 {
10800 }
10801 }
10802
10804 {
10805 SetWeightDirty();
10806 }
10807
10809 {
10810 return GetWetLevelInternal(
m_VarWet);
10811 }
10812
10813
10814
10816 {
10818 }
10819
10821 {
10823 }
10824
10826 {
10828 }
10829
10831 {
10833 }
10834
10835
10836
10838 {
10839 if (ConfigIsExisting("itemModelLength"))
10840 {
10841 return ConfigGetFloat("itemModelLength");
10842 }
10843 return 0;
10844 }
10845
10847 {
10848 if (ConfigIsExisting("itemAttachOffset"))
10849 {
10850 return ConfigGetFloat("itemAttachOffset");
10851 }
10852 return 0;
10853 }
10854
10855 override void SetCleanness(
int value,
bool allow_client =
false)
10856 {
10857 if (!IsServerCheck(allow_client))
10858 return;
10859
10861
10863
10866 }
10867
10869 {
10871 }
10872
10874 {
10875 return true;
10876 }
10877
10878
10879
10880
10882 {
10884 }
10885
10887 {
10889 }
10890
10891
10892
10893
10894 override void SetColor(
int r,
int g,
int b,
int a)
10895 {
10901 }
10903 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10904 {
10909 }
10910
10912 {
10914 }
10915
10918 {
10919 int r,g,b,a;
10921 r = r/255;
10922 g = g/255;
10923 b = b/255;
10924 a = a/255;
10925 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10926 }
10927
10928
10929
10930 override void SetLiquidType(
int value,
bool allow_client =
false)
10931 {
10932 if (!IsServerCheck(allow_client))
10933 return;
10934
10939 }
10940
10942 {
10943 return ConfigGetInt("varLiquidTypeInit");
10944 }
10945
10947 {
10949 }
10950
10952 {
10954 SetFrozen(false);
10955 }
10956
10959 {
10960 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10961 }
10962
10963
10966 {
10967 PlayerBase nplayer;
10968 if (PlayerBase.CastTo(nplayer, player))
10969 {
10971
10972 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10973 }
10974 }
10975
10976
10979 {
10980 PlayerBase nplayer;
10981 if (PlayerBase.CastTo(nplayer,player))
10982 {
10983
10984 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10985
10986 }
10987
10988
10989 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10990
10991
10992 if (HasEnergyManager())
10993 {
10994 GetCompEM().UpdatePlugState();
10995 }
10996 }
10997
10998
11000 {
11001 super.OnPlacementStarted(player);
11002
11004 }
11005
11006 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11007 {
11009 {
11010 m_AdminLog.OnPlacementComplete(player,
this);
11011 }
11012
11013 super.OnPlacementComplete(player, position, orientation);
11014 }
11015
11016
11017
11018
11019
11021 {
11023 {
11024 return true;
11025 }
11026 else
11027 {
11028 return false;
11029 }
11030 }
11031
11032
11034 {
11036 {
11038 }
11039 }
11040
11041
11043 {
11045 }
11046
11048 {
11050 }
11051
11052 override void InsertAgent(
int agent,
float count = 1)
11053 {
11054 if (count < 1)
11055 return;
11056
11058 }
11059
11062 {
11064 }
11065
11066
11068 {
11070 }
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11114 {
11116 return false;
11117 return true;
11118 }
11119
11121 {
11122
11124 }
11125
11126
11129 {
11130 super.CheckForRoofLimited(timeTresholdMS);
11131
11133 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11134 {
11135 m_PreviousRoofTestTime = time;
11136 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11137 }
11138 }
11139
11140
11142 {
11144 {
11145 return 0;
11146 }
11147
11148 if (GetInventory().GetAttachmentSlotsCount() != 0)
11149 {
11150 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11151 if (filter)
11152 return filter.GetProtectionLevel(type, false, system);
11153 else
11154 return 0;
11155 }
11156
11157 string subclassPath, entryName;
11158
11159 switch (type)
11160 {
11162 entryName = "biological";
11163 break;
11165 entryName = "chemical";
11166 break;
11167 default:
11168 entryName = "biological";
11169 break;
11170 }
11171
11172 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11173
11175 }
11176
11177
11178
11181 {
11182 if (!IsMagazine())
11184
11186 }
11187
11188
11189
11190
11191
11196 {
11197 return true;
11198 }
11199
11201 {
11203 }
11204
11205
11206
11207
11208
11210 {
11211 if (parent)
11212 {
11213 if (parent.IsInherited(DayZInfected))
11214 return true;
11215
11216 if (!parent.IsRuined())
11217 return true;
11218 }
11219
11220 return true;
11221 }
11222
11224 {
11225 if (!super.CanPutAsAttachment(parent))
11226 {
11227 return false;
11228 }
11229
11230 if (!IsRuined() && !parent.IsRuined())
11231 {
11232 return true;
11233 }
11234
11235 return false;
11236 }
11237
11239 {
11240
11241
11242
11243
11244 return super.CanReceiveItemIntoCargo(item);
11245 }
11246
11248 {
11249
11250
11251
11252
11253 GameInventory attachmentInv = attachment.GetInventory();
11255 {
11256 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11257 return false;
11258 }
11259
11260 InventoryLocation loc = new InventoryLocation();
11261 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11262 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11263 return false;
11264
11265 return super.CanReceiveAttachment(attachment, slotId);
11266 }
11267
11269 {
11270 if (!super.CanReleaseAttachment(attachment))
11271 return false;
11272
11273 return GetInventory().AreChildrenAccessible();
11274 }
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11297 {
11298 int id = muzzle_owner.GetMuzzleID();
11299 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11300
11301 if (WPOF_array)
11302 {
11303 for (int i = 0; i < WPOF_array.Count(); i++)
11304 {
11305 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11306
11307 if (WPOF)
11308 {
11309 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11310 }
11311 }
11312 }
11313 }
11314
11315
11317 {
11318 int id = muzzle_owner.GetMuzzleID();
11320
11321 if (WPOBE_array)
11322 {
11323 for (int i = 0; i < WPOBE_array.Count(); i++)
11324 {
11325 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11326
11327 if (WPOBE)
11328 {
11329 WPOBE.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.OnActivate(weapon, 0, 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.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11370 }
11371 }
11372 }
11373 }
11374
11375
11377 {
11378 int id = muzzle_owner.GetMuzzleID();
11379 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11380
11381 if (WPOOH_array)
11382 {
11383 for (int i = 0; i < WPOOH_array.Count(); i++)
11384 {
11385 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11386
11387 if (WPOOH)
11388 {
11389 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11390 }
11391 }
11392 }
11393 }
11394
11395
11396
11398 {
11400 {
11401 return true;
11402 }
11403
11404 return false;
11405 }
11406
11408 {
11410 {
11411 return true;
11412 }
11413
11414 return false;
11415 }
11416
11418 {
11420 {
11421 return true;
11422 }
11423
11424 return false;
11425 }
11426
11428 {
11429 return false;
11430 }
11431
11434 {
11435 return UATimeSpent.DEFAULT_DEPLOY;
11436 }
11437
11438
11439
11440
11442 {
11444 SetSynchDirty();
11445 }
11446
11448 {
11450 }
11451
11452
11454 {
11455 return false;
11456 }
11457
11460 {
11461 string att_type = "None";
11462
11463 if (ConfigIsExisting("soundAttType"))
11464 {
11465 att_type = ConfigGetString("soundAttType");
11466 }
11467
11469 }
11470
11472 {
11474 }
11475
11476
11477
11478
11479
11485
11487 {
11490
11492 }
11493
11494
11496 {
11498 return;
11499
11501
11504
11507
11508 SoundParameters params = new SoundParameters();
11512 }
11513
11514
11516 {
11518 return;
11519
11521 SetSynchDirty();
11522
11525 }
11526
11527
11529 {
11531 return;
11532
11534 SetSynchDirty();
11535
11538 }
11539
11541 {
11543 }
11544
11546 {
11548 }
11549
11552 {
11553 if (!
GetGame().IsDedicatedServer())
11554 {
11555 if (ConfigIsExisting("attachSoundSet"))
11556 {
11557 string cfg_path = "";
11558 string soundset = "";
11559 string type_name =
GetType();
11560
11563 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11564 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11565
11566 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11567 {
11568 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11569 {
11570 if (cfg_slot_array[i] == slot_type)
11571 {
11572 soundset = cfg_soundset_array[i];
11573 break;
11574 }
11575 }
11576 }
11577
11578 if (soundset != "")
11579 {
11580 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11582 }
11583 }
11584 }
11585 }
11586
11588 {
11589
11590 }
11591
11592 void OnApply(PlayerBase player);
11593
11595 {
11596 return 1.0;
11597 };
11598
11600 {
11602 }
11603
11605 {
11607 }
11608
11610
11612 {
11613 SetDynamicPhysicsLifeTime(0.01);
11615 }
11616
11618 {
11619 array<string> zone_names = new array<string>;
11620 GetDamageZones(zone_names);
11621 for (int i = 0; i < zone_names.Count(); i++)
11622 {
11623 SetHealthMax(zone_names.Get(i),"Health");
11624 }
11625 SetHealthMax("","Health");
11626 }
11627
11630 {
11631 float global_health = GetHealth01("","Health");
11632 array<string> zones = new array<string>;
11633 GetDamageZones(zones);
11634
11635 for (int i = 0; i < zones.Count(); i++)
11636 {
11637 SetHealth01(zones.Get(i),"Health",global_health);
11638 }
11639 }
11640
11643 {
11644 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11645 }
11646
11648 {
11649 if (!hasRootAsPlayer)
11650 {
11651 if (refParentIB)
11652 {
11653
11654 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11655 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11656
11657 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11658 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11659
11662 }
11663 else
11664 {
11665
11668 }
11669 }
11670 }
11671
11673 {
11675 {
11676 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11677 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11678 {
11679 float heatPermCoef = 1.0;
11681 while (ent)
11682 {
11683 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11684 ent = ent.GetHierarchyParent();
11685 }
11686
11687 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11688 }
11689 }
11690 }
11691
11693 {
11694
11695 EntityAI parent = GetHierarchyParent();
11696 if (!parent)
11697 {
11698 hasParent = false;
11699 hasRootAsPlayer = false;
11700 }
11701 else
11702 {
11703 hasParent = true;
11704 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11705 refParentIB =
ItemBase.Cast(parent);
11706 }
11707 }
11708
11709 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11710 {
11711
11712 }
11713
11715 {
11716
11717 return false;
11718 }
11719
11721 {
11722
11723
11724 return false;
11725 }
11726
11728 {
11729
11730 return false;
11731 }
11732
11735 {
11736 return !GetIsFrozen() &&
IsOpen();
11737 }
11738
11740 {
11741 bool hasParent = false, hasRootAsPlayer = false;
11743
11744 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11745 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11746
11747 if (wwtu || foodDecay)
11748 {
11752
11753 if (processWetness || processTemperature || processDecay)
11754 {
11756
11757 if (processWetness)
11758 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11759
11760 if (processTemperature)
11762
11763 if (processDecay)
11764 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11765 }
11766 }
11767 }
11768
11771 {
11773 }
11774
11776 {
11779
11780 return super.GetTemperatureFreezeThreshold();
11781 }
11782
11784 {
11787
11788 return super.GetTemperatureThawThreshold();
11789 }
11790
11792 {
11795
11796 return super.GetItemOverheatThreshold();
11797 }
11798
11800 {
11802 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11803
11804 return super.GetTemperatureFreezeTime();
11805 }
11806
11808 {
11810 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11811
11812 return super.GetTemperatureThawTime();
11813 }
11814
11819
11821 {
11822 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11823 }
11824
11826 {
11827 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11828 }
11829
11832 {
11834 }
11835
11837 {
11839 }
11840
11842 {
11844 }
11845
11848 {
11849 return null;
11850 }
11851
11854 {
11855 return false;
11856 }
11857
11859 {
11861 {
11864 if (!trg)
11865 {
11867 explosive = this;
11868 }
11869
11870 explosive.PairRemote(trg);
11872
11873 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11874 trg.SetPersistentPairID(persistentID);
11875 explosive.SetPersistentPairID(persistentID);
11876
11877 return true;
11878 }
11879 return false;
11880 }
11881
11884 {
11885 float ret = 1.0;
11888 ret *= GetHealth01();
11889
11890 return ret;
11891 }
11892
11893 #ifdef DEVELOPER
11894 override void SetDebugItem()
11895 {
11896 super.SetDebugItem();
11897 _itemBase = this;
11898 }
11899
11901 {
11902 string text = super.GetDebugText();
11903
11905 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11906
11907 return text;
11908 }
11909 #endif
11910
11912 {
11913 return true;
11914 }
11915
11917
11919
11921 {
11924 }
11925
11926
11934
11950}
11951
11953{
11955 if (entity)
11956 {
11957 bool is_item = entity.IsInherited(
ItemBase);
11958 if (is_item && full_quantity)
11959 {
11962 }
11963 }
11964 else
11965 {
11967 return NULL;
11968 }
11969 return entity;
11970}
11971
11973{
11974 if (item)
11975 {
11976 if (health > 0)
11977 item.SetHealth("", "", health);
11978
11979 if (item.CanHaveTemperature())
11980 {
11982 if (item.CanFreeze())
11983 item.SetFrozen(false);
11984 }
11985
11986 if (item.HasEnergyManager())
11987 {
11988 if (quantity >= 0)
11989 {
11990 item.GetCompEM().SetEnergy0To1(quantity);
11991 }
11992 else
11993 {
11995 }
11996 }
11997 else if (item.IsMagazine())
11998 {
11999 Magazine mag = Magazine.Cast(item);
12000 if (quantity >= 0)
12001 {
12002 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12003 }
12004 else
12005 {
12007 }
12008
12009 }
12010 else
12011 {
12012 if (quantity >= 0)
12013 {
12014 item.SetQuantityNormalized(quantity, false);
12015 }
12016 else
12017 {
12019 }
12020
12021 }
12022 }
12023}
12024
12025#ifdef DEVELOPER
12027#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.