80 protected bool m_IsResultOfSplit
150 if (!
GetGame().IsDedicatedServer())
166 m_OldLocation = null;
173 if (ConfigIsExisting(
"headSelectionsToHide"))
180 if (ConfigIsExisting(
"hideSelectionsByinventorySlot"))
189 m_IsResultOfSplit =
false;
199 m_Count = ConfigGetInt(
"count");
239 if (ConfigIsExisting(
"canBeSplit"))
245 if (ConfigIsExisting(
"itemBehaviour"))
252 RegisterNetSyncVariableInt(
"m_VarLiquidType");
253 RegisterNetSyncVariableInt(
"m_Cleanness",0,1);
255 RegisterNetSyncVariableBoolSignal(
"m_WantPlayImpactSound");
256 RegisterNetSyncVariableFloat(
"m_ImpactSpeed");
257 RegisterNetSyncVariableInt(
"m_ImpactSoundSurfaceHash");
259 RegisterNetSyncVariableInt(
"m_ColorComponentR", 0, 255);
260 RegisterNetSyncVariableInt(
"m_ColorComponentG", 0, 255);
261 RegisterNetSyncVariableInt(
"m_ColorComponentB", 0, 255);
262 RegisterNetSyncVariableInt(
"m_ColorComponentA", 0, 255);
264 RegisterNetSyncVariableBool(
"m_IsBeingPlaced");
265 RegisterNetSyncVariableBool(
"m_IsTakeable");
266 RegisterNetSyncVariableBool(
"m_IsHologram");
279 if (!m_InputActionMap)
321 typename ai = action.GetInputType();
336 Debug.
ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
339 if (action_array.Find(action) != -1)
341 Debug.
Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
345 action_array.Insert(action);
352 ActionBase action = player.GetActionManager().GetAction(actionName);
353 typename ai = action.GetInputType();
358 action_array.RemoveItem(action);
375 string config_to_search =
"CfgVehicles";
376 string muzzle_owner_config;
381 config_to_search =
"CfgWeapons";
383 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
385 string config_OnFire_class = muzzle_owner_config +
"Particles " +
"OnFire ";
389 if (config_OnFire_subclass_count > 0)
393 for (
int i = 0; i < config_OnFire_subclass_count; i++)
395 string particle_class =
"";
397 string config_OnFire_entry = config_OnFire_class + particle_class;
398 WeaponParticlesOnFire WPOF =
new WeaponParticlesOnFire(
this, config_OnFire_entry);
399 WPOF_array.Insert(WPOF);
409 config_to_search =
"CfgWeapons";
410 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
412 string config_OnBulletCasingEject_class = muzzle_owner_config +
"Particles " +
"OnBulletCasingEject ";
416 if (config_OnBulletCasingEject_count > 0 && IsInherited(
Weapon))
420 for (i = 0; i < config_OnBulletCasingEject_count; i++)
422 string particle_class2 =
"";
424 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
425 WeaponParticlesOnBulletCasingEject WPOBE =
new WeaponParticlesOnBulletCasingEject(
this, config_OnBulletCasingEject_entry);
426 WPOBE_array.Insert(WPOBE);
443 string config_to_search =
"CfgVehicles";
446 config_to_search =
"CfgWeapons";
448 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
449 string config_OnOverheating_class = muzzle_owner_config +
"Particles " +
"OnOverheating ";
451 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
459 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
472 for (
int i = 0; i < config_OnOverheating_subclass_count; i++)
474 string particle_class =
"";
476 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
479 if (entry_type == CT_CLASS)
481 WeaponParticlesOnOverheating WPOF =
new WeaponParticlesOnOverheating(
this, config_OnOverheating_entry);
482 WPOOH_array.Insert(WPOF);
509 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
519 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
522 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
562 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
568 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
575 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
607 for (
int i = count; i > 0; --i)
616 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
716 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
721 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
723 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
727 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
736 player.GetHumanInventory().ClearUserReservedLocation(
this);
750 return ItemBase.m_DebugActionsMask & mask;
760 ItemBase.m_DebugActionsMask |= mask;
765 ItemBase.m_DebugActionsMask &= ~mask;
783 if (GetEconomyProfile())
785 float q_min = GetEconomyProfile().GetQuantityMin();
786 float q_max = GetEconomyProfile().GetQuantityMax();
799 EntityAI parent = GetHierarchyParent();
804 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
805 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
812 EntityAI parent = GetHierarchyParent();
817 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
818 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
840 ctx.
Write(use_stack_max);
850 else if (!
GetGame().IsMultiplayer())
864 return (ConfigGetFloat(
"liquidContainerType") != 0);
926 if (!is_being_placed)
991 super.EECargoIn(item);
996 super.OnMovedInsideCargo(container);
998 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {
Bolt_Base});
1003 super.EEItemLocationChanged(oldLoc,newLoc);
1008 if (newLoc.GetParent())
1009 new_player =
PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1011 if (oldLoc.GetParent())
1012 old_player =
PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1016 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1021 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1023 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1027 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
1031 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
1040 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
1042 if (new_player == old_player)
1045 if (oldLoc.GetParent() && !(oldLoc.GetParent() != new_player && oldLoc.GetType() ==
InventoryLocationType.ATTACHMENT) && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1049 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc,
false,
false,
false,
true,
false,
false))
1051 new_player.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1056 new_player.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1060 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(
this) >= 0)
1062 int type = oldLoc.GetType();
1065 oldLoc.GetParent().GetOnSetLock().Invoke(
this);
1069 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(
this, oldLoc.GetSlot());
1076 m_OldLocation.
Copy(oldLoc);
1082 m_OldLocation.
Reset();
1092 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(
this, newLoc);
1096 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
1098 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
1102 il.
GetParent().GetOnReleaseLock().Invoke(it);
1120 m_OldLocation.Reset();
1129 int liquidType = -1;
1131 if (impactSpeed > 0.0)
1159 super.OnItemLocationChanged(old_owner, new_owner);
1161 Man ownerPlayerOld = null;
1162 Man ownerPlayerNew = null;
1166 if (old_owner.
IsMan())
1168 ownerPlayerOld = Man.Cast(old_owner);
1172 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1178 if (new_owner.
IsMan())
1180 ownerPlayerNew = Man.Cast(new_owner);
1184 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1188 if (ownerPlayerOld != ownerPlayerNew)
1194 for (
int i = 0; i < subItemsExit.Count(); i++)
1205 for (
int j = 0; j < subItemsEnter.Count(); j++)
1217 super.EEDelete(parent);
1223 if (player.IsAlive())
1225 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1229 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1231 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1235 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
1239 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
1244 player.RemoveQuickBarEntityShortcut(
this);
1251 super.EEKilled(killer);
1260 if (Magazine.Cast(
this).GetAmmoCount() > 0)
1275 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {
Bolt_Base});
1277 super.OnWasAttached(parent, slot_id);
1287 super.OnWasDetached(parent, slot_id);
1299 ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1300 if (inventory_slots.Count() < 1)
1302 inventory_slots.Insert(ConfigGetString(
"ChangeInventorySlot"));
1303 attach_types.Insert(ConfigGetString(
"ChangeIntoOnAttach"));
1307 ConfigGetTextArray(
"ChangeIntoOnAttach",attach_types);
1310 idx = inventory_slots.Find(slot);
1314 return attach_types.Get(idx);
1325 this.ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1326 if (inventory_slots.Count() < 1)
1328 inventory_slots.Insert(this.ConfigGetString(
"ChangeInventorySlot"));
1329 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1333 this.ConfigGetTextArray(
"ChangeIntoOnDetach",detach_types);
1334 if (detach_types.Count() < 1)
1335 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1338 for (
int i = 0; i < inventory_slots.Count(); i++)
1340 slot = inventory_slots.Get(i);
1345 if (detach_types.Count() == 1)
1348 idx = inventory_slots.Find(slot);
1353 return detach_types.Get(idx);
1366 explode_timer.Run(delay,
this,
"DoAmmoExplosion");
1371 Magazine magazine = Magazine.Cast(
this);
1372 int pop_sounds_count = 6;
1373 string pop_sounds[ 6 ] = {
"ammopops_1",
"ammopops_2",
"ammopops_3",
"ammopops_4",
"ammopops_5",
"ammopops_6" };
1377 string sound_name = pop_sounds[ sound_idx ];
1381 magazine.ServerAddAmmoCount(-1);
1384 float min_temp_to_explode = 100;
1386 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
1395 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
1397 const int CHANCE_DAMAGE_CARGO = 4;
1398 const int CHANCE_DAMAGE_ATTACHMENT = 1;
1399 const int CHANCE_DAMAGE_NOTHING = 2;
1403 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
1407 if (GetInventory().GetCargo())
1409 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1412 if (rnd < CHANCE_DAMAGE_CARGO)
1416 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
1423 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1426 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
1436 if (GetInventory().GetCargo())
1438 int item_count = GetInventory().GetCargo().GetItemCount();
1443 if (!item.IsExplosive())
1445 item.AddHealth(
"",
"",damage);
1455 int attachment_count = GetInventory().AttachmentCount();
1456 if (attachment_count > 0)
1459 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
1460 if (!attachment.IsExplosive())
1462 attachment.AddHealth(
"",
"",damage);
1489 ctx.
Write(destination_entity);
1495 else if (!
GetGame().IsMultiplayer())
1503 float split_quantity_new;
1512 split_quantity_new = stack_max;
1516 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1519 new_item.SetResultOfSplit(
true);
1520 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1522 new_item.SetQuantity(split_quantity_new);
1525 else if (destination_entity && slot_id == -1)
1527 if (quantity > stack_max)
1528 split_quantity_new = stack_max;
1530 split_quantity_new = quantity;
1540 new_item.SetResultOfSplit(
true);
1541 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1543 new_item.SetQuantity(split_quantity_new);
1555 if (split_quantity_new == 0)
1557 if (!
GetGame().IsMultiplayer())
1558 player.PhysicalPredictiveDropItem(
this);
1560 player.ServerDropEntity(
this);
1568 new_item.SetResultOfSplit(
true);
1569 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1571 new_item.SetQuantity(stack_max);
1572 new_item.PlaceOnSurface();
1589 dst.WriteToContext(ctx);
1593 else if (!
GetGame().IsMultiplayer())
1610 ctx.
Write(destination_entity);
1618 else if (!
GetGame().IsMultiplayer())
1632 float split_quantity_new;
1639 if (quantity > stack_max)
1640 split_quantity_new = stack_max;
1642 split_quantity_new = quantity;
1648 new_item.SetResultOfSplit(
true);
1649 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1651 new_item.SetQuantity(split_quantity_new);
1663 float split_quantity_new;
1665 if (destination_entity)
1668 if (quantity > stackable)
1669 split_quantity_new = stackable;
1671 split_quantity_new = quantity;
1673 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
1676 new_item.SetResultOfSplit(
true);
1677 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1679 new_item.SetQuantity(split_quantity_new);
1695 ItemBase destination_entity =
this;
1696 ctx.
Write(destination_entity);
1702 else if (!
GetGame().IsMultiplayer())
1711 float split_quantity_new;
1716 if (quantity > stackable)
1717 split_quantity_new = stackable;
1719 split_quantity_new = quantity;
1721 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
1722 new_item =
ItemBase.Cast(in_hands);
1725 new_item.SetResultOfSplit(
true);
1726 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1728 new_item.SetQuantity(split_quantity_new);
1739 float split_quantity_new =
Math.
Floor(quantity * 0.5);
1745 if (new_item.GetQuantityMax() < split_quantity_new)
1747 split_quantity_new = new_item.GetQuantityMax();
1750 new_item.SetResultOfSplit(
true);
1751 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1756 new_item.SetQuantity(1);
1761 new_item.SetQuantity(split_quantity_new);
1774 float split_quantity_new =
Math.
Floor(quantity / 2);
1780 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(
this,
true);
1784 if (new_item.GetQuantityMax() < split_quantity_new)
1786 split_quantity_new = new_item.GetQuantityMax();
1791 new_item.SetQuantity(1);
1796 new_item.SetQuantity(split_quantity_new);
1809 parent.OnAttachmentQuantityChangedEx(
this, delta);
1827 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1834 EntityAI parent = GetHierarchyParent();
1835 if (parent && parent.IsFireplace())
1837 CargoBase cargo = GetInventory().GetCargo();
1855 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
1865 super.OnRightClick();
1876 EntityAI root = GetHierarchyRoot();
1883 root.GetTransform(m4);
1887 GetInventory().GetCurrentInventoryLocation(dst);
1892 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(null, dst))
1896 root.GetTransform(m4);
1900 GetInventory().GetCurrentInventoryLocation(dst);
1918 else if (!
GetGame().IsMultiplayer())
1929 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
1940 Magazine mag = Magazine.Cast(
this);
1943 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
1946 if (stack_max_limit)
1948 Magazine other_mag = Magazine.Cast(other_item);
1951 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
1968 if (CastTo(player, GetHierarchyRootPlayer()))
1970 if (player.GetInventory().HasAttachment(
this))
1973 if (player.IsItemsToDelete())
1977 if (reservation_check && (GetInventory().HasInventoryReservation(
this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
1982 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
1995 return m_IsResultOfSplit;
2000 m_IsResultOfSplit = value;
2010 float other_item_quantity = other_item.GetQuantity();
2011 float this_free_space;
2017 if (other_item_quantity > this_free_space)
2019 return this_free_space;
2023 return other_item_quantity;
2032 if (!IsMagazine() && other_item)
2035 if (quantity_used != 0)
2037 float hp1 = GetHealth01(
"",
"");
2038 float hp2 = other_item.GetHealth01(
"",
"");
2039 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
2040 hpResult = hpResult / (
GetQuantity() + quantity_used);
2042 hpResult *= GetMaxHealth();
2044 SetHealth(
"",
"Health", hpResult);
2047 other_item.AddQuantity(-quantity_used);
2056 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
2057 GetHierarchyParent().IncreaseLifetimeUp();
2066 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2067 if (moduleRecipesManager)
2070 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
2073 for (
int i = 0;i < recipesIds.Count(); i++)
2075 int key = recipesIds.Get(i);
2076 string recipeName = moduleRecipesManager.GetRecipeName(key);
2124 string button1, button2, button3, button4;
2153 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
2155 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2156 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
2158 if (
EActions.RECIPES_RANGE_START < 1000)
2160 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2161 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2164 else if (action_id ==
EActions.GET_TOTAL_WEIGHT)
2166 WeightDebug.ClearWeightDebug();
2168 Debug.
Log(
"======================== "+
GetType() +
" =================================");
2172 Debug.
Log(
"----------------------------------------------------------------------------------------------");
2174 else if (action_id ==
EActions.GET_TOTAL_WEIGHT_RECALC)
2176 WeightDebug.ClearWeightDebug();
2177 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
2179 Debug.
Log(
"======================== "+
GetType() +
" RECALC ===========================");
2183 WeightDebug.PrintAll(
this);
2184 Debug.
Log(
"----------------------------------------------------------------------------------------------");
2185 WeightDebug.SetVerbosityFlags(0);
2187 else if (action_id ==
EActions.GET_PLAYER_WEIGHT)
2189 WeightDebug.ClearWeightDebug();
2191 Debug.
Log(
"======================== PLAYER: "+player+
" ===========================");
2193 Debug.
Log(
"New overall weight Player:"+player.GetWeightEx().ToString());
2195 Debug.
Log(
"----------------------------------------------------------------------------------------------");
2197 else if (action_id ==
EActions.GET_PLAYER_WEIGHT_RECALC)
2199 WeightDebug.ClearWeightDebug();
2200 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
2202 Debug.
Log(
"======================== PLAYER RECALC: "+player+
" ===========================");
2204 Debug.
Log(
"New overall weight Player:"+player.GetWeightEx(
true).ToString());
2205 WeightDebug.PrintAll(player);
2206 Debug.
Log(
"----------------------------------------------------------------------------------------------");
2207 WeightDebug.SetVerbosityFlags(0);
2210 else if (action_id ==
EActions.WATCH_PLAYER)
2212 PluginDeveloper.SetDeveloperItemClientEx(player);
2217 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2219 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2223 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2225 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2229 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2231 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2235 else if (action_id ==
EActions.ADD_QUANTITY)
2239 Magazine mag = Magazine.Cast(
this);
2240 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2249 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2254 else if (action_id ==
EActions.REMOVE_QUANTITY)
2258 Magazine mag2 = Magazine.Cast(
this);
2259 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2267 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2272 else if (action_id ==
EActions.SET_QUANTITY_0)
2282 else if (action_id ==
EActions.SET_MAX_QUANTITY)
2288 m_EM.SetEnergy(m_EM.GetEnergyMax());
2292 else if (action_id ==
EActions.ADD_HEALTH)
2294 AddHealth(
"",
"",GetMaxHealth(
"",
"Health")/5);
2296 else if (action_id ==
EActions.REMOVE_HEALTH)
2298 AddHealth(
"",
"",-GetMaxHealth(
"",
"Health")/5);
2300 else if (action_id ==
EActions.DESTROY_HEALTH)
2302 SetHealth01(
"",
"",0);
2304 else if (action_id ==
EActions.WATCH_ITEM)
2309 SetDebugDeveloper_item(
this);
2313 else if (action_id ==
EActions.ADD_TEMPERATURE)
2319 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
2325 else if (action_id ==
EActions.ADD_WETNESS)
2331 else if (action_id ==
EActions.REMOVE_WETNESS)
2337 else if (action_id ==
EActions.LIQUIDTYPE_UP)
2345 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
2351 else if (action_id ==
EActions.MAKE_SPECIAL)
2356 else if (action_id ==
EActions.DELETE)
2400 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
2417 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2418 return module_repairing.CanRepair(
this, item_repair_kit);
2424 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2425 return module_repairing.Repair(player,
this, item_repair_kit, specialty_weight);
2470 player.MessageStatus(text);
2488 player.MessageAction(text);
2506 player.MessageFriendly(text);
2524 player.MessageImportant(text);
2537 string item_name = this.
GetType();
2541 int array_size = item_tag_array.Count();
2542 for (
int i = 0; i < array_size; i++)
2544 if (item_tag_array.Get(i) == tag)
2557 super.OnRPC(sender, rpc_type,ctx);
2563 case ERPCs.RPC_SOUND_LOCK_ATTACH:
2569 bool play = p.param1;
2570 string soundSet = p.param2;
2620 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2621 return plugin.GetID(
name);
2626 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2627 return plugin.GetName(
id);
2636 if (!ctx.
Read(varFlags))
2701 int mask =
Math.
Round(floats.Get(index));
2713 float quantity = floats.Get(index);
2721 float temperature = floats.Get(index);
2728 float wet = floats.Get(index);
2735 int liquidtype =
Math.
Round(floats.Get(index));
2753 int cleanness =
Math.
Round(floats.Get(index));
2805 if (version <= 108 && version!= -1)
2813 for (
int i = 0; i < numOfItems; i++)
2825 else if (version <= 116 && version!= -1)
2827 if (!ctx.
Read(numOfItems))
2832 for (
int j = 0; j < numOfItems; j++)
2834 if (!ctx.
Read(value))
2845 if (!ctx.
Read(mask))
2850 if (!ctx.
Read(value))
2865 if (!ctx.
Read(value))
2872 if (!ctx.
Read(value))
2879 if (!ctx.
Read(intValue))
2886 if (!ctx.
Read(intValue))
2890 if (!ctx.
Read(value))
2894 if (!ctx.
Read(value))
2898 if (!ctx.
Read(value))
2906 if (!ctx.
Read(intValue))
2925 ctx.
Write(varFlags);
2940 if (version <= 108 && version != -1)
2961 if (!ctx.
Read(varFlags))
2989 if (!super.OnStoreLoad(ctx, version))
2997 bool hasQuickBarIndexSaved;
2999 if (!ctx.
Read(hasQuickBarIndexSaved))
3005 if (hasQuickBarIndexSaved)
3010 if (!ctx.
Read(itmQBIndex))
3017 if (itmQBIndex != -1 && parentPlayer)
3018 parentPlayer.SetLoadedQuickBarItemBind(
this, itmQBIndex);
3026 if (version ==
int.
MAX)
3028 if (!ctx.
Read(itemQBIndex))
3034 else if (
Class.
CastTo(player, GetHierarchyRootPlayer()))
3037 if (!ctx.
Read(itemQBIndex))
3042 if (itemQBIndex != -1 && player)
3043 player.SetLoadedQuickBarItemBind(
this,itemQBIndex);
3081 super.OnStoreSave(ctx);
3083 if (
PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
3087 int itemQBIndex = -1;
3088 itemQBIndex = player.FindQuickBarEntityIndex(
this);
3089 ctx.
Write(itemQBIndex);
3109 super.AfterStoreLoad();
3125 super.EEOnAfterLoad();
3147 #ifdef PLATFORM_CONSOLE
3177 super.OnVariablesSynchronized();
3183 bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
3193 Debug.
LogError(
"No LiquidType specified, try setting 'varLiquidTypeInit' to a particular liquid type");
3200 bool on_min_value = value <= (min + 0.001);
3206 bool dstr = ConfigGetBool(
"varQuantityDestroyOnMin");
3214 else if (destroy_forced)
3244 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
3264 float value_clamped =
Math.
Clamp(value, 0, 1);
3266 SetQuantity(result, destroy_config, destroy_forced);
3291 GetInventory().GetCurrentInventoryLocation(il);
3309 float quantity_max = 0;
3311 if (attSlotID != -1)
3314 if (quantity_max <= 0)
3317 if (quantity_max <= 0)
3320 return quantity_max;
3359 float weightEx = GetWeightEx();
3360 float special = GetInventoryAndCargoWeight();
3361 return weightEx - special;
3375 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3384 else if (HasEnergyManager())
3387 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3390 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
3393 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
3398 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3401 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
3404 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
3414 if (GetInventory().GetCargo() != NULL)
3416 item_count = GetInventory().GetCargo().GetItemCount();
3419 for (
int i = 0; i < GetInventory().AttachmentCount(); i++)
3421 Class.
CastTo(item,GetInventory().GetAttachmentFromIndex(i));
3423 item_count += item.GetNumberOfItems();
3433 if (include_wetness)
3437 weight = wetness * m_ConfigWeight;
3439 else if (ConfigGetFloat(
"liquidContainerType") > 0)
3473 if (this.HasEnergyManager())
3475 energy = this.GetCompEM().GetEnergy();
3483 super.OnEnergyConsumed();
3490 super.OnEnergyAdded();
3498 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
3502 float energy_0to1 = GetCompEM().GetEnergy0To1();
3556 return ConfigGetFloat(
"heatIsolation");
3566 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
3567 if (
GetGame().ConfigIsExisting(paramPath))
3575 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
3576 if (
GetGame().ConfigIsExisting(paramPath))
3582 override void SetWet(
float value,
bool allow_client =
false)
3635 if (newLevel != oldLevel)
3648 return GetWetLevelInternal(
m_VarWet);
3657 if (allow_client)
return true;
3660 Error(
"Attempting to change variable client side, variables are supposed to be changed on server only !!");
3671 if (ConfigIsExisting(
"itemModelLength"))
3673 return ConfigGetFloat(
"itemModelLength");
3744 return MiscGameplayFunctions.GetColorString(r, g, b, a);
3758 return ConfigGetInt(
"varLiquidTypeInit");
3775 nplayer.SetEnableQuickBarEntityShortcut(
this,
true);
3787 nplayer.SetEnableQuickBarEntityShortcut(
this,
false);
3792 player.GetHumanInventory().ClearUserReservedLocationForContainer(
this);
3795 if (HasEnergyManager())
3797 GetCompEM().UpdatePlugState();
3804 super.OnPlacementStarted(player);
3813 m_AdminLog.OnPlacementComplete(player,
this);
3816 super.OnPlacementComplete(player, position, orientation);
3940 if (GetInventory().GetAttachmentSlotsCount() != 0)
3942 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
3944 return filter.GetProtectionLevel(type,
false, system);
3949 string subclassPath, entryName;
3954 entryName =
"biological";
3957 entryName =
"chemical";
3960 entryName =
"biological";
3964 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
4009 if (!parent.IsRuined())
4018 if (!super.CanPutAsAttachment(parent))
4023 if (!IsRuined() && !parent.IsRuined())
4037 return super.CanReceiveItemIntoCargo(item);
4049 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(
PlayerBase))
4053 return super.CanReceiveAttachment(attachment, slotId);
4078 int id = muzzle_owner.GetMuzzleID();
4083 for (
int i = 0; i < WPOF_array.Count(); i++)
4085 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
4089 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
4098 int id = muzzle_owner.GetMuzzleID();
4103 for (
int i = 0; i < WPOBE_array.Count(); i++)
4105 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
4109 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4118 int id = muzzle_owner.GetMuzzleID();
4123 for (
int i = 0; i < WPOOH_array.Count(); i++)
4125 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4129 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4138 int id = muzzle_owner.GetMuzzleID();
4143 for (
int i = 0; i < WPOOH_array.Count(); i++)
4145 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4149 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4158 int id = muzzle_owner.GetMuzzleID();
4163 for (
int i = 0; i < WPOOH_array.Count(); i++)
4165 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4169 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4235 string att_type =
"None";
4237 if (ConfigIsExisting(
"soundAttType"))
4239 att_type = ConfigGetString(
"soundAttType");
4333 if (!
GetGame().IsDedicatedServer())
4335 if (ConfigIsExisting(
"attachSoundSet"))
4337 string cfg_path =
"";
4338 string soundset =
"";
4343 ConfigGetTextArray(
"attachSoundSet",cfg_soundset_array);
4344 ConfigGetTextArray(
"attachSoundSlot",cfg_slot_array);
4346 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
4348 for (
int i = 0; i < cfg_soundset_array.Count(); i++)
4350 if (cfg_slot_array[i] == slot_type)
4352 soundset = cfg_soundset_array[i];
4393 SetDynamicPhysicsLifeTime(0.01);
4400 GetDamageZones(zone_names);
4401 for (
int i = 0; i < zone_names.Count(); i++)
4403 SetHealthMax(zone_names.Get(i),
"Health");
4405 SetHealthMax(
"",
"Health");
4411 float global_health = GetHealth01(
"",
"Health");
4413 GetDamageZones(zones);
4415 for (
int i = 0; i < zones.Count(); i++)
4417 SetHealth01(zones.Get(i),
"Health",global_health);
4423 if (slot_name ==
"Mask")
4428 if (ConfigGetBool(
"noMask"))
4438 if (!hasRootAsPlayer)
4446 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
4489 EntityAI parent = GetHierarchyParent();
4493 hasRootAsPlayer =
false;
4498 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
4499 refParentIB =
ItemBase.Cast(parent);
4537 bool hasParent =
false, hasRootAsPlayer =
false;
4540 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
4541 bool foodDecay =
g_Game.IsFoodDecayEnabled();
4543 if (wwtu || foodDecay)
4549 if (processWetness || processTemperature || processDecay)
4554 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
4556 if (processTemperature)
4560 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
4567 return (item.IsKindOf(
"Cauldron") || item.IsKindOf(
"Pot") || item.IsKindOf(
"FryingPan") || item.IsKindOf(
"SmallProtectorCase") || (item.IsKindOf(
"PortableGasStove") && item.FindAttachmentBySlotName(
"CookingEquipment")));
4572 MiscGameplayFunctions.TransferItemProperties(oldItem,
this);
4615 explosive.PairRemote(trg);
4619 trg.SetPersistentPairID(persistentID);
4620 explosive.SetPersistentPairID(persistentID);
4628 override void SetDebugItem()
4630 super.SetDebugItem();
4642 if (is_item && full_quantity)
4645 item.SetQuantity(item.GetQuantityInit());
4650 Print(
"Cannot spawn entity: " + object_name);
4662 if (item.HasQuantity())
4663 quantity = item.GetQuantityInit();
4667 item.SetHealth(
"",
"", health);
4671 item.SetQuantity(quantity);
eBleedingSourceType GetType()
protected bool IsDamageDestroyed(ActionTarget target)
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3< int, int, string > TSelectableActionInfo
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
TInputActionMap m_InputActionMap
void AddAction(typename actionName)
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
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsFireplace()
override void OnDebugButtonPressServer(int button_index)
override void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4)
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
bool IsServerCheck(bool allow_client)
void SetVariableMask(int variable)
void SetResultOfSplit(bool value)
bool DamageItemInCargo(float damage)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
ref TIntArray m_SingleUseActions
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ref array< ref OverheatingParticle > m_OverheatingParticles
protected bool CanHaveWetness()
float GetHeatIsolationInit()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
bool m_IsSoundSynchRemote
ref array< int > m_CompatibleLocks
override void AddTemperature(float value)
override float GetTemperatureMax()
float GetSingleInventoryItemWeightEx()
void LoadParticleConfigOnOverheating(int id)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
ref TIntArray m_InteractActions
override void InsertAgent(int agent, float count=1)
protected EffectSound m_SoundPlace
override bool CanBeSplit()
bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override float GetWetMax()
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
bool m_CanBeMovedOverride
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
int m_ShotsToStartOverheating
protected void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
void WriteVarsToCTX(ParamsWriteContext ctx)
float m_VarTemperatureInit
void ConvertEnergyToQuantity()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
override void RemoveAgent(int agent_id)
bool m_CanPlayImpactSound
override void RemoveAllAgents()
override float GetQuantity()
override void OnWetChanged(float newVal, float oldVal)
override bool IsBeingPlaced()
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void SetCleanness(int value, bool allow_client=false)
void SaveVariables(ParamsWriteContext ctx)
override void SetTemperature(float value, bool allow_client=false)
override void SetTakeable(bool pState)
protected bool m_HideSelectionsBySlot
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ref TIntArray m_ContinuousActions
override float GetTemperature()
void UpdateAllOverheatingParticles()
void SaveAgents(ParamsWriteContext ctx)
void SerializeNumericalVars(array< float > floats_out)
float GetOverheatingCoef()
int m_ImpactSoundSurfaceHash
override void SetWet(float value, bool allow_client=false)
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
static ref map< string, int > m_WeaponTypeToID
void KillAllOverheatingParticles()
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
float m_OverheatingDecayInterval
bool LoadAgents(ParamsReadContext ctx, int version)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
bool can_this_be_combined
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...
void CombineItems(ItemBase other_item, bool use_stack_max=true)
bool m_WantPlayImpactSound
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
override float GetWetMin()
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void SplitIntoStackMaxHands(PlayerBase player)
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool LoadVariables(ParamsReadContext ctx, int version=-1)
protected EffectSound m_SoundDeploy
static bool HasDebugActionsMask(int mask)
protected string m_LockSoundSet
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
ref Timer m_CheckOverheating
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
void PerformDamageSystemReinit()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
protected ref TStringArray m_HeadHidingSelections
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
float GetItemModelLength()
void DeSerializeNumericalVars(array< float > floats)
bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override int GetTargetQuantityMax(int attSlotID=-1)
bool m_IsOverheatingEffectActive
bool DamageItemAttachments(float damage)
static void AddDebugActionsMask(int mask)
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...
static int m_LastRegisteredWeaponID
float m_VarTemperatureMin
static void RemoveDebugActionsMask(int mask)
void SetLiquidType(int value, bool allow_client=false)
protected bool m_CanBeDigged
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
bool IsVariableSet(int variable)
'true' if this variable has ever been changed from default
override float GetTemperatureMin()
bool m_ItemBeingDroppedPhys
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
bool m_FixDamageSystemInit
bool IsSoundSynchRemote()
void LoadParticleConfigOnFire(int id)
ItemBase m_LightSourceItem
float GetDryingIncrement(string pIncrementName)
void SplitItem(PlayerBase player)
private int m_AttachedAgents
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
protected bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
protected EffectSound m_SoundDeployFinish
float m_VarTemperatureMax
bool IsOverheatingEffectActive()
override int GetQuantityMax()
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
override void Explode(int damageType, string ammoType="")
protected bool m_Initialized
class JsonUndergroundAreaTriggerData GetPosition
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native DayZPlayer GetPlayer()
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
AnalyticsManagerClient GetAnalyticsClient()
proto native bool ConfigIsExisting(string path)
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native UIManager GetUIManager()
proto native int ConfigGetType(string path)
Returns type of config value.
static ref TFloatArray ARRAY_FLOAT
static ref Param1< float > PARAM1_FLOAT
static ref Param1< int > PARAM1_INT
represents base for cargo storage for entities
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
Super root of all classes in Enforce script.
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Wrapper class for managing sound through SEffectManager.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
HumanInventory GetHumanInventory()
inventory
script counterpart to engine's class Inventory
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
const int c_InventoryReservationTimeoutShortMS
proto native CargoBase GetCargo()
cargo
proto native EntityAI GetEntityInHands()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
bool IsServerCheck(bool allow_client)
override bool IsHologram()
void SetVariableMask(int variable)
void SetResultOfSplit(bool value)
void OnCombine(ItemBase other_item)
override void EECargoIn(EntityAI item)
bool DamageItemInCargo(float damage)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
ref TIntArray m_SingleUseActions
override void OnCreatePhysics()
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
ScriptedLightBase GetLight()
ref array< ref OverheatingParticle > m_OverheatingParticles
protected bool CanHaveTemperature()
protected bool CanHaveWetness()
float GetHeatIsolationInit()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
bool m_IsSoundSynchRemote
override void AddTemperature(float value)
override float GetTemperatureMax()
float GetSingleInventoryItemWeightEx()
void LoadParticleConfigOnOverheating(int id)
void StopItemDynamicPhysics()
bool m_RecipesInitialized
float GetDeployTime()
how long it takes to deploy this item in seconds
TInputActionMap m_InputActionMap
override void OnCEUpdate()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_InteractActions
override void InsertAgent(int agent, float count=1)
void TransferVariablesFloat(array< float > float_vars)
protected EffectSound m_SoundPlace
override void EOnContact(IEntity other, Contact extra)
override bool CanBeSplit()
bool OnAction(int action_id, Man player, ParamsReadContext ctx)
bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
void OnSyncVariables(ParamsReadContext ctx)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
override float GetWetMax()
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
bool m_CanBeMovedOverride
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool CanDisplayCargo()
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
array< string > GetHeadHidingSelection()
override void OnStoreSave(ParamsWriteContext ctx)
float GetBandagingEffectivity()
void GetColor(out int r, out int g, out int b, out int a)
gets item's color variable as components
protected void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override bool CanReceiveItemIntoCargo(EntityAI item)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void WriteVarsToCTX(ParamsWriteContext ctx)
override protected float GetWeightSpecialized(bool forceRecalc=false)
override string ChangeIntoOnAttach(string slot)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
void SoundSynchRemoteReset()
float m_VarTemperatureInit
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void ConvertEnergyToQuantity()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void RemoveAgent(int agent_id)
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override void EEKilled(Object killer)
static void ToggleDebugActionsMask(int mask)
PluginAdminLog m_AdminLog
void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
void OnActivatedByTripWire()
void AddAction(typename actionName)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
override void RemoveAllAgents()
override float GetQuantity()
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnWetChanged(float newVal, float oldVal)
override string GetAttachmentSoundType()
override string ChangeIntoOnDetach()
string GetLoopDeploySoundset()
override void OnEnergyAdded()
override float GetWetInit()
void Open()
Implementations only.
override bool CanPutInCargo(EntityAI parent)
int NameToID(string name)
override bool IsBeingPlaced()
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void SetCleanness(int value, bool allow_client=false)
void SaveVariables(ParamsWriteContext ctx)
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
float GetInfectionChance(int system=0, Param param=null)
Infection chance while/after using this item, originally used for wound infection after bandaging,...
override void SetTemperature(float value, bool allow_client=false)
bool IsFacingPlayer(PlayerBase player, string selection)
override void SetWetMax()
override void SetTakeable(bool pState)
protected bool CanProcessDecay()
void SetIsHologram(bool is_hologram)
protected bool m_HideSelectionsBySlot
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
override void OnRightClick()
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
ref TIntArray m_ContinuousActions
override float GetTemperature()
void UpdateAllOverheatingParticles()
bool AllowFoodConsumption()
void SaveAgents(ParamsWriteContext ctx)
void SerializeNumericalVars(array< float > floats_out)
protected void ProcessDecay(float delta, bool hasRootAsPlayer)
float GetOverheatingCoef()
int m_ImpactSoundSurfaceHash
float GetSoakingIncrement(string pIncrementName)
override void SetWet(float value, bool allow_client=false)
static ref map< string, int > m_WeaponTypeToID
void KillAllOverheatingParticles()
string GetPlaceSoundset()
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
override bool IsOneHandedBehaviour()
bool IsCoverFaceForShave(string slot_name)
ItemBase GetLightSourceItem()
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool LoadAgents(ParamsReadContext ctx, int version)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void PlayDetachSound(string slot_type)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void EEDelete(EntityAI parent)
array< int > GetValidFinishers()
returns an array of possible finishers
override void SetQuantityToMinimum()
void RemoveItemVariable(int variable)
Removes variable from variable mask, making it appear as though the variable has never been changed f...
void SetIsPlaceSound(bool is_place_sound)
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
override bool CanObstruct()
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...
void CombineItems(ItemBase other_item, bool use_stack_max=true)
bool m_WantPlayImpactSound
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
override void AfterStoreLoad()
override float GetWetMin()
override int GetQuickBarBonus()
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void SplitIntoStackMaxHands(PlayerBase player)
void SetIsDeploySound(bool is_deploy_sound)
override void OnWasDetached(EntityAI parent, int slot_id)
bool CanBeMovedOverride()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
protected ref EffectSound m_LockingSound
override void EEOnAfterLoad()
bool LoadVariables(ParamsReadContext ctx, int version=-1)
override bool IsIgnoredByConstruction()
protected EffectSound m_SoundDeploy
static bool HasDebugActionsMask(int mask)
void RemoveLightSourceItem()
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
ref Timer m_CheckOverheating
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
override float GetTemperatureInit()
string GetDeploySoundset()
void OnApply(PlayerBase player)
static int GetDebugActionsMask()
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
void OnOverheatingDecay()
void PerformDamageSystemReinit()
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
void OnInventoryEnter(Man player)
Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
static void SetDebugActionsMask(int mask)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void SetCEBasedQuantity()
bool ContainsAgent(int agent_id)
void SetIsBeingPlaced(bool is_being_placed)
override void RemoveAllAgentsExcept(int agents_to_keep_mask)
override void AddWet(float value)
override void OnMovedInsideCargo(EntityAI container)
bool HidesSelectionBySlot()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
float GetFilterDamageRatio()
override bool CanPutAsAttachment(EntityAI parent)
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
protected ref TStringArray m_HeadHidingSelections
WrittenNoteData GetWrittenNoteData()
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsTakeable()
int GetDamageSystemVersionChange()
Re-sets DamageSystem changes.
override bool IsHeavyBehaviour()
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override void OnWasAttached(EntityAI parent, int slot_id)
string GetExplosiveTriggerSlotName()
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
override void OnPlacementStarted(Man player)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
float GetItemModelLength()
void DeSerializeNumericalVars(array< float > floats)
bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override int GetTargetQuantityMax(int attSlotID=-1)
override void OnVariablesSynchronized()
override bool KindOf(string tag)
void PlayDeployFinishSound()
bool m_IsOverheatingEffectActive
bool DamageItemAttachments(float damage)
bool CanBeCookedOnStick()
void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
bool CanPlayDeployLoopSound()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
static void AddDebugActionsMask(int mask)
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...
void SetCanBeMovedOverride(bool setting)
float m_VarTemperatureMin
static void RemoveDebugActionsMask(int mask)
void SetLiquidType(int value, bool allow_client=false)
protected bool m_CanBeDigged
bool CanBeRepairedByCrafting()
float GetOverheatingValue()
void TransferAgents(int agents)
transfer agents from another item
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
bool CanRepair(ItemBase item_repair_kit)
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
static int m_DebugActionsMask
bool IsVariableSet(int variable)
'true' if this variable has ever been changed from default
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
array< float > GetVariablesFloat()
override float GetTemperatureMin()
bool m_ItemBeingDroppedPhys
void TransferModifiers(PlayerBase reciever)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
void SetColor(int r, int g, int b, int a)
void RemoveAction(typename actionName)
bool IsSoundSynchRemote()
void LoadParticleConfigOnFire(int id)
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
ItemBase m_LightSourceItem
float GetDryingIncrement(string pIncrementName)
override void SetTemperatureMax()
void SplitItem(PlayerBase player)
float GetSingleInventoryItemWeight()
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
private int m_AttachedAgents
override EWetnessLevel GetWetLevel()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
protected bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
protected EffectSound m_SoundDeployFinish
string GetDeployFinishSoundset()
void OnInventoryExit(Man player)
Event called on item when it is removed from the player(Man) inventory, passes the old owner as a par...
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
bool IsPlayerInside(PlayerBase player, string selection)
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
float m_VarTemperatureMax
bool IsOverheatingEffectActive()
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override bool IsItemBase()
void CopyScriptPropertiesFrom(EntityAI oldItem)
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
override bool IsTwoHandedBehaviour()
bool PairWithDevice(notnull ItemBase otherDevice)
override int GetQuantityMax()
override void OnEnergyConsumed()
proto native int GetType()
returns type of InventoryLocation
proto native bool IsValid()
verify current set inventory location
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
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 void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native EntityAI GetItem()
returns item of current inventory location
proto native void Reset()
proto native bool GetFlip()
returns flip status of cargo
proto native int GetSlot()
returns slot id if current type is Attachment
bool WriteToContext(ParamsWriteContext ctx)
provides access to slot configuration
static proto native bool IsSlotIdValid(int slotId)
verifies existence of the slot id
static proto native int GetStackMaxForSlotId(int slot_Id)
static proto native owned string GetSlotName(int id)
converts slot_id to string
override void OnDebugSpawn()
override string GetDeploySoundset()
override void OnInventoryExit(Man player)
override void RefreshPhysics()
override bool CanExplodeInFire()
override bool IsPlayerInside(PlayerBase player, string selection)
override bool CanProcessDecay()
override int GetDamageSystemVersionChange()
override string GetPlaceSoundset()
override void OnCombine(ItemBase other_item)
override WrittenNoteData GetWrittenNoteData()
override bool IsItemTent()
override void SetCEBasedQuantity()
override bool CanPutAsAttachment(EntityAI parent)
override void OnEndPlacement()
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsClothing()
override string GetDeployFinishSoundset()
override void OnInventoryEnter(Man player)
override void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool CanHaveTemperature()
override void InitItemVariables()
override void SetActions()
static bool IsActionLogEnable()
void SetOverheatingLimitMax(float max)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
float GetOverheatingLimitMax()
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
void RegisterParticle(Particle p)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Legacy way of using particles in the game.
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
The class that will be instanced (moddable)
void SetControlledDevice(EntityAI pDevice)
static int GeneratePersistentID()
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
const float DEFAULT_DEPLOY
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
script counterpart to engine's class Weapon
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
const float WETNESS_RATE_WETTING_INSIDE
const float ITEM_TEMPERATURE_TO_EXPLODE_MIN
misc
const float TEMPERATURE_RATE_COOLING_INSIDE
const float WETNESS_RATE_WETTING_LIQUID
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
const float STATE_SOAKING_WET
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Floor(float f)
Returns floor of value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION