22 static int m_DebugActionsMask;
74 protected bool m_IsResultOfSplit
93 private int m_AttachedAgents;
104 static int m_LastRegisteredWeaponID = 0;
107 bool m_IsOverheatingEffectActive;
108 float m_OverheatingShots;
109 ref
Timer m_CheckOverheating;
110 int m_ShotsToStartOverheating = 0;
111 int m_MaxOverheatingValue = 0;
112 float m_OverheatingDecayInterval = 1;
113 ref array <ref OverheatingParticle> m_OverheatingParticles;
137 private float m_TemperaturePerQuantityWeight;
147 if (!
GetGame().IsDedicatedServer())
151 LoadParticleConfigOnFire(GetMuzzleID());
153 if (m_ShotsToStartOverheating == 0)
155 LoadParticleConfigOnOverheating(GetMuzzleID());
163 m_OldLocation = null;
170 if (ConfigIsExisting(
"headSelectionsToHide"))
177 if (ConfigIsExisting(
"hideSelectionsByinventorySlot"))
184 m_IsResultOfSplit =
false;
186 SetActionAnimOverrides();
189 override void InitItemVariables()
191 super.InitItemVariables();
198 m_Count = ConfigGetInt(
"count");
235 if (ConfigIsExisting(
"canBeSplit"))
242 if (ConfigIsExisting(
"itemBehaviour"))
248 RegisterNetSyncVariableInt(
"m_VarLiquidType");
249 RegisterNetSyncVariableInt(
"m_Cleanness",0,1);
251 RegisterNetSyncVariableBoolSignal(
"m_WantPlayImpactSound");
252 RegisterNetSyncVariableFloat(
"m_ImpactSpeed");
253 RegisterNetSyncVariableInt(
"m_ImpactSoundSurfaceHash");
255 RegisterNetSyncVariableInt(
"m_ColorComponentR", 0, 255);
256 RegisterNetSyncVariableInt(
"m_ColorComponentG", 0, 255);
257 RegisterNetSyncVariableInt(
"m_ColorComponentB", 0, 255);
258 RegisterNetSyncVariableInt(
"m_ColorComponentA", 0, 255);
260 RegisterNetSyncVariableBool(
"m_IsBeingPlaced");
261 RegisterNetSyncVariableBool(
"m_IsTakeable");
262 RegisterNetSyncVariableBool(
"m_IsHologram");
265 if (m_ItemSoundHandler)
273 m_TemperaturePerQuantityWeight = 1.0;;
274 if (ConfigIsExisting(
"temperaturePerQuantityWeight"))
275 m_TemperaturePerQuantityWeight = ConfigGetFloat(
"temperaturePerQuantityWeight");
279 override int GetQuickBarBonus()
287 if (!m_InputActionMap)
292 m_ItemTypeActionsMap.Insert(this.
Type(), m_InputActionMap);
316 void SetActionAnimOverrides();
320 ActionBase action = ActionManagerBase.GetAction(actionName);
324 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
343 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
346 if (action_array.Find(action) != -1)
348 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
352 action_array.Insert(action);
359 ActionBase action = player.GetActionManager().GetAction(actionName);
365 action_array.RemoveItem(action);
371 void OverrideActionAnimation(
typename action,
int commandUID,
int stanceMask = -1,
int commandUIDProne = -1)
374 overrideData.m_CommandUID = commandUID;
375 overrideData.m_CommandUIDProne = commandUIDProne;
376 overrideData.m_StanceMask = stanceMask;
382 m_ItemActionOverrides.Insert(action, actionMap);
385 actionMap.Insert(this.
Type(), overrideData);
389 void OnItemInHandsPlayerSwimStart(
PlayerBase player);
394 void LoadParticleConfigOnFire(
int id)
399 if (!m_OnBulletCasingEjectEffect)
402 string config_to_search =
"CfgVehicles";
403 string muzzle_owner_config;
405 if (!m_OnFireEffect.Contains(
id))
408 config_to_search =
"CfgWeapons";
410 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
412 string config_OnFire_class = muzzle_owner_config +
"Particles " +
"OnFire ";
414 int config_OnFire_subclass_count =
GetGame().ConfigGetChildrenCount(config_OnFire_class);
416 if (config_OnFire_subclass_count > 0)
420 for (
int i = 0; i < config_OnFire_subclass_count; i++)
422 string particle_class =
"";
423 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
424 string config_OnFire_entry = config_OnFire_class + particle_class;
425 WeaponParticlesOnFire WPOF =
new WeaponParticlesOnFire(
this, config_OnFire_entry);
426 WPOF_array.Insert(WPOF);
430 m_OnFireEffect.Insert(
id, WPOF_array);
434 if (!m_OnBulletCasingEjectEffect.Contains(
id))
436 config_to_search =
"CfgWeapons";
437 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
439 string config_OnBulletCasingEject_class = muzzle_owner_config +
"Particles " +
"OnBulletCasingEject ";
441 int config_OnBulletCasingEject_count =
GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
443 if (config_OnBulletCasingEject_count > 0 && IsInherited(
Weapon))
447 for (i = 0; i < config_OnBulletCasingEject_count; i++)
449 string particle_class2 =
"";
450 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
451 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
452 WeaponParticlesOnBulletCasingEject WPOBE =
new WeaponParticlesOnBulletCasingEject(
this, config_OnBulletCasingEject_entry);
453 WPOBE_array.Insert(WPOBE);
457 m_OnBulletCasingEjectEffect.Insert(
id, WPOBE_array);
463 void LoadParticleConfigOnOverheating(
int id)
465 if (!m_OnOverheatingEffect)
468 if (!m_OnOverheatingEffect.Contains(
id))
470 string config_to_search =
"CfgVehicles";
473 config_to_search =
"CfgWeapons";
475 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
476 string config_OnOverheating_class = muzzle_owner_config +
"Particles " +
"OnOverheating ";
478 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
481 m_ShotsToStartOverheating =
GetGame().ConfigGetFloat(config_OnOverheating_class +
"shotsToStartOverheating");
483 if (m_ShotsToStartOverheating == 0)
485 m_ShotsToStartOverheating = -1;
486 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
491 m_OverheatingDecayInterval =
GetGame().ConfigGetFloat(config_OnOverheating_class +
"overheatingDecayInterval");
492 m_MaxOverheatingValue =
GetGame().ConfigGetFloat(config_OnOverheating_class +
"maxOverheatingValue");
496 int config_OnOverheating_subclass_count =
GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
499 for (
int i = 0; i < config_OnOverheating_subclass_count; i++)
501 string particle_class =
"";
502 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
503 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
504 int entry_type =
GetGame().ConfigGetType(config_OnOverheating_entry);
506 if (entry_type == CT_CLASS)
508 WeaponParticlesOnOverheating WPOF =
new WeaponParticlesOnOverheating(
this, config_OnOverheating_entry);
509 WPOOH_array.Insert(WPOF);
514 m_OnOverheatingEffect.Insert(
id, WPOOH_array);
519 float GetOverheatingValue()
521 return m_OverheatingShots;
524 void IncreaseOverheating(
ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
526 if (m_MaxOverheatingValue > 0)
528 m_OverheatingShots++;
530 if (!m_CheckOverheating)
533 m_CheckOverheating.Stop();
534 m_CheckOverheating.Run(m_OverheatingDecayInterval,
this,
"OnOverheatingDecay");
536 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
540 void CheckOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
542 if (m_OverheatingShots >= m_ShotsToStartOverheating && IsOverheatingEffectActive())
543 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
545 if (m_OverheatingShots >= m_ShotsToStartOverheating && !IsOverheatingEffectActive())
546 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
548 if (m_OverheatingShots < m_ShotsToStartOverheating && IsOverheatingEffectActive())
549 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
551 if (m_OverheatingShots > m_MaxOverheatingValue)
553 m_OverheatingShots = m_MaxOverheatingValue;
557 bool IsOverheatingEffectActive()
559 return m_IsOverheatingEffectActive;
562 void OnOverheatingDecay()
564 if (m_MaxOverheatingValue > 0)
565 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue;
567 m_OverheatingShots--;
569 if (m_OverheatingShots <= 0)
571 m_CheckOverheating.Stop();
572 m_OverheatingShots = 0;
576 if (!m_CheckOverheating)
579 m_CheckOverheating.Stop();
580 m_CheckOverheating.Run(m_OverheatingDecayInterval,
this,
"OnOverheatingDecay");
583 CheckOverheating(
this,
"",
this);
586 void StartOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
588 m_IsOverheatingEffectActive =
true;
589 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
592 void UpdateOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
594 KillAllOverheatingParticles();
595 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
596 UpdateAllOverheatingParticles();
599 void StopOverheating(
ItemBase weapon = null,
string ammoType =
"",
ItemBase muzzle_owner = null,
ItemBase suppressor = null,
string config_to_search =
"")
601 m_IsOverheatingEffectActive =
false;
602 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
607 if (!m_OverheatingParticles)
611 OP.RegisterParticle(p);
612 OP.SetOverheatingLimitMin(min_heat_coef);
613 OP.SetOverheatingLimitMax(max_heat_coef);
614 OP.SetParticleParams(
particle_id, parent, local_pos, local_ori);
616 m_OverheatingParticles.Insert(OP);
619 float GetOverheatingCoef()
621 if (m_MaxOverheatingValue > 0)
622 return (m_OverheatingShots - m_ShotsToStartOverheating) / m_MaxOverheatingValue;
627 void UpdateAllOverheatingParticles()
629 if (m_OverheatingParticles)
631 float overheat_coef = GetOverheatingCoef();
632 int count = m_OverheatingParticles.Count();
634 for (
int i = count; i > 0; --i)
640 float overheat_min = OP.GetOverheatingLimitMin();
641 float overheat_max = OP.GetOverheatingLimitMax();
643 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
648 OP.RegisterParticle(null);
655 void KillAllOverheatingParticles()
657 if (m_OverheatingParticles)
659 for (
int i = m_OverheatingParticles.Count(); i > 0; i--)
677 m_OverheatingParticles.Clear();
678 delete m_OverheatingParticles;
683 float GetInfectionChance(
int system = 0,
Param param = null)
689 float GetDisinfectQuantity(
int system = 0,
Param param1 = null)
694 float GetFilterDamageRatio()
711 if (!m_WeaponTypeToID)
714 if (m_WeaponTypeToID.Contains(
GetType()))
716 return m_WeaponTypeToID.Get(
GetType());
721 m_WeaponTypeToID.Insert(
GetType(), ++m_LastRegisteredWeaponID);
724 return m_LastRegisteredWeaponID;
745 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
750 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
752 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
753 int r_type = r_il.GetType();
756 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
760 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
765 player.GetHumanInventory().ClearUserReservedLocation(
this);
775 static int GetDebugActionsMask()
780 static bool HasDebugActionsMask(
int mask)
782 return ItemBase.m_DebugActionsMask & mask;
785 static void SetDebugActionsMask(
int mask)
790 static void AddDebugActionsMask(
int mask)
792 ItemBase.m_DebugActionsMask |= mask;
795 static void RemoveDebugActionsMask(
int mask)
797 ItemBase.m_DebugActionsMask &= ~mask;
800 static void ToggleDebugActionsMask(
int mask)
802 if (HasDebugActionsMask(mask))
804 RemoveDebugActionsMask(mask);
808 AddDebugActionsMask(mask);
813 void SetCEBasedQuantity()
815 if (GetEconomyProfile())
817 float q_max = GetEconomyProfile().GetQuantityMax();
820 float q_min = GetEconomyProfile().GetQuantityMin();
821 float quantity_randomized =
Math.RandomFloatInclusive(q_min, q_max);
844 EntityAI parent = GetHierarchyParent();
849 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
850 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(),
true);
855 void UnlockFromParent()
857 EntityAI parent = GetHierarchyParent();
862 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
863 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(),
false);
867 override void CombineItemsClient(
EntityAI entity2,
bool use_stack_max =
true)
885 ctx.Write(use_stack_max);
895 else if (!
GetGame().IsMultiplayer())
901 bool IsLiquidPresent()
906 bool IsLiquidContainer()
911 int GetLiquidContainerMask()
916 bool IsBloodContainer()
934 string GetExplosiveTriggerSlotName()
969 override bool IsBeingPlaced()
974 void SetIsBeingPlaced(
bool is_being_placed)
977 if (!is_being_placed)
985 override bool IsHologram()
995 int GetOnDigWormsAmount()
1000 bool CanMakeGardenplot()
1005 void SetIsHologram(
bool is_hologram)
1045 override void OnMovedInsideCargo(
EntityAI container)
1047 super.OnMovedInsideCargo(container);
1049 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {
Bolt_Base});
1054 super.EEItemLocationChanged(oldLoc,newLoc);
1059 if (newLoc.GetParent())
1060 new_player =
PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1062 if (oldLoc.GetParent())
1063 old_player =
PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1067 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1072 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1074 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1075 int r_type = r_il.GetType();
1078 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
1082 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
1091 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
1093 if (new_player == old_player)
1096 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1100 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc,
false,
false,
false,
true,
false,
false))
1102 new_player.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1107 new_player.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1111 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(
this) >= 0)
1113 int type = oldLoc.GetType();
1116 oldLoc.GetParent().GetOnSetLock().Invoke(
this);
1120 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(
this, oldLoc.GetSlot());
1127 m_OldLocation.Copy(oldLoc);
1133 m_OldLocation.Reset();
1143 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(
this, newLoc);
1147 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
1149 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
1150 int rel_type = il.GetType();
1153 il.GetParent().GetOnReleaseLock().Invoke(it);
1157 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1170 m_OldLocation.Reset();
1179 int liquidType = -1;
1181 if (impactSpeed > 0.0)
1195 if (GetCompEM() && GetCompEM().IsPlugged())
1198 GetCompEM().UnplugThis();
1217 super.OnItemLocationChanged(old_owner, new_owner);
1222 if (!relatedPlayer && playerNew)
1223 relatedPlayer = playerNew;
1225 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
1227 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
1230 ActionBase currentAction = actionMgr.GetRunningAction();
1236 Man ownerPlayerOld = null;
1237 Man ownerPlayerNew = null;
1241 if (old_owner.IsMan())
1243 ownerPlayerOld = Man.Cast(old_owner);
1247 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1256 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
1258 GetCompEM().UnplugThis();
1265 if (new_owner.IsMan())
1267 ownerPlayerNew = Man.Cast(new_owner);
1271 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1275 if (ownerPlayerOld != ownerPlayerNew)
1281 for (
int i = 0; i < subItemsExit.Count(); i++)
1292 for (
int j = 0; j < subItemsEnter.Count(); j++)
1299 else if (ownerPlayerNew != null)
1302 if (
PlayerBase.CastTo(nplayer, ownerPlayerNew))
1306 for (
int k = 0; k < subItemsUpdate.Count(); k++)
1309 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
1315 old_owner.OnChildItemRemoved(
this);
1317 new_owner.OnChildItemReceived(
this);
1323 super.EEDelete(parent);
1329 if (player.IsAlive())
1331 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1335 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1337 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1338 int r_type = r_il.GetType();
1341 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
1345 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
1350 player.RemoveQuickBarEntityShortcut(
this);
1355 override void EEKilled(
Object killer)
1357 super.EEKilled(killer);
1360 if (killer && killer.IsFireplace() && CanExplodeInFire())
1366 if (Magazine.Cast(
this).GetAmmoCount() > 0)
1379 override void OnWasAttached(
EntityAI parent,
int slot_id)
1381 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {
Bolt_Base});
1383 super.OnWasAttached(parent, slot_id);
1391 override void OnWasDetached(
EntityAI parent,
int slot_id)
1393 super.OnWasDetached(parent, slot_id);
1399 override string ChangeIntoOnAttach(
string slot)
1405 ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1406 if (inventory_slots.Count() < 1)
1408 inventory_slots.Insert(ConfigGetString(
"ChangeInventorySlot"));
1409 attach_types.Insert(ConfigGetString(
"ChangeIntoOnAttach"));
1413 ConfigGetTextArray(
"ChangeIntoOnAttach",attach_types);
1416 idx = inventory_slots.Find(slot);
1420 return attach_types.Get(idx);
1423 override string ChangeIntoOnDetach()
1431 this.ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1432 if (inventory_slots.Count() < 1)
1434 inventory_slots.Insert(this.ConfigGetString(
"ChangeInventorySlot"));
1435 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1439 this.ConfigGetTextArray(
"ChangeIntoOnDetach",detach_types);
1440 if (detach_types.Count() < 1)
1441 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1444 for (
int i = 0; i < inventory_slots.Count(); i++)
1446 slot = inventory_slots.Get(i);
1451 if (detach_types.Count() == 1)
1454 idx = inventory_slots.Find(slot);
1459 return detach_types.Get(idx);
1470 float delay =
Math.RandomFloat(min_time, max_time);
1472 explode_timer.Run(delay,
this,
"DoAmmoExplosion");
1475 void DoAmmoExplosion()
1477 Magazine magazine = Magazine.Cast(
this);
1478 int pop_sounds_count = 6;
1479 string pop_sounds[ 6 ] = {
"ammopops_1",
"ammopops_2",
"ammopops_3",
"ammopops_4",
"ammopops_5",
"ammopops_6" };
1482 int sound_idx =
Math.RandomInt(0, pop_sounds_count - 1);
1483 string sound_name = pop_sounds[ sound_idx ];
1484 GetGame().CreateSoundOnObject(
this, sound_name, 20,
false);
1487 magazine.ServerAddAmmoCount(-1);
1490 float min_temp_to_explode = 100;
1492 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
1501 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
1503 const int CHANCE_DAMAGE_CARGO = 4;
1504 const int CHANCE_DAMAGE_ATTACHMENT = 1;
1505 const int CHANCE_DAMAGE_NOTHING = 2;
1507 if (IsClothing() || IsContainer() ||
IsItemTent())
1509 float dmg = damageResult.GetDamage(
"",
"Health") * -0.5;
1513 if (GetInventory().GetCargo())
1515 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1516 rnd =
Math.RandomInt(0,chances);
1518 if (rnd < CHANCE_DAMAGE_CARGO)
1520 DamageItemInCargo(dmg);
1522 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
1524 DamageItemAttachments(dmg);
1529 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1530 rnd =
Math.RandomInt(0,chances);
1532 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
1534 DamageItemAttachments(dmg);
1540 bool DamageItemInCargo(
float damage)
1542 if (GetInventory().GetCargo())
1544 int item_count = GetInventory().GetCargo().GetItemCount();
1547 int random_pick =
Math.RandomInt(0, item_count);
1549 if (!item.IsExplosive())
1551 item.AddHealth(
"",
"",damage);
1559 bool DamageItemAttachments(
float damage)
1561 int attachment_count = GetInventory().AttachmentCount();
1562 if (attachment_count > 0)
1564 int random_pick =
Math.RandomInt(0, attachment_count);
1565 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
1566 if (!attachment.IsExplosive())
1568 attachment.AddHealth(
"",
"",damage);
1575 override bool IsSplitable()
1580 override bool CanBeSplit()
1583 return GetInventory().CanRemoveEntity();
1619 ctx.Write(destination_entity);
1625 else if (!
GetGame().IsMultiplayer())
1633 float split_quantity_new;
1639 if (destination_entity && slot_id != -1 &&
InventorySlots.IsSlotIdValid(slot_id))
1642 split_quantity_new = stack_max;
1648 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1651 new_item.SetResultOfSplit(
true);
1652 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1654 new_item.SetQuantity(split_quantity_new,
false,
true);
1658 else if (destination_entity && slot_id == -1)
1660 if (quantity > stack_max)
1661 split_quantity_new = stack_max;
1663 split_quantity_new = quantity;
1675 new_item.SetResultOfSplit(
true);
1676 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1678 new_item.SetQuantity(split_quantity_new,
false,
true);
1691 if (split_quantity_new == 0)
1693 if (!
GetGame().IsMultiplayer())
1694 player.PhysicalPredictiveDropItem(
this);
1696 player.ServerDropEntity(
this);
1706 new_item.SetResultOfSplit(
true);
1707 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1708 SetQuantity(split_quantity_new,
false,
true);
1709 new_item.SetQuantity(stack_max,
false,
true);
1710 new_item.PlaceOnSurface();
1719 float split_quantity_new;
1725 if (destination_entity && slot_id != -1 &&
InventorySlots.IsSlotIdValid(slot_id))
1728 split_quantity_new = stack_max;
1734 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1737 new_item.SetResultOfSplit(
true);
1738 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1740 new_item.SetQuantity(split_quantity_new,
false,
true);
1744 else if (destination_entity && slot_id == -1)
1746 if (quantity > stack_max)
1747 split_quantity_new = stack_max;
1749 split_quantity_new = quantity;
1761 new_item.SetResultOfSplit(
true);
1762 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1764 new_item.SetQuantity(split_quantity_new,
false,
true);
1783 new_item.SetResultOfSplit(
true);
1784 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1785 SetQuantity(split_quantity_new,
false,
true);
1786 new_item.SetQuantity(stack_max,
false,
true);
1787 new_item.PlaceOnSurface();
1805 dst.WriteToContext(ctx);
1809 else if (!
GetGame().IsMultiplayer())
1826 ctx.Write(destination_entity);
1834 else if (!
GetGame().IsMultiplayer())
1848 float split_quantity_new;
1852 int slot_id = dst.GetSlot();
1855 if (quantity > stack_max)
1856 split_quantity_new = stack_max;
1858 split_quantity_new = quantity;
1866 new_item.SetResultOfSplit(
true);
1867 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1869 new_item.SetQuantity(split_quantity_new,
false,
true);
1882 float split_quantity_new;
1884 if (destination_entity)
1887 if (quantity > stackable)
1888 split_quantity_new = stackable;
1890 split_quantity_new = quantity;
1894 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
1897 new_item.SetResultOfSplit(
true);
1898 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1900 new_item.SetQuantity(split_quantity_new,
false,
true);
1917 ItemBase destination_entity =
this;
1918 ctx.Write(destination_entity);
1924 else if (!
GetGame().IsMultiplayer())
1933 float split_quantity_new;
1938 if (quantity > stackable)
1939 split_quantity_new = stackable;
1941 split_quantity_new = quantity;
1945 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
1946 new_item =
ItemBase.Cast(in_hands);
1949 new_item.SetResultOfSplit(
true);
1950 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1952 new_item.SetQuantity(split_quantity_new,
false,
true);
1961 float split_quantity_new =
Math.Floor(quantity * 0.5);
1970 if (new_item.GetQuantityMax() < split_quantity_new)
1972 split_quantity_new = new_item.GetQuantityMax();
1975 new_item.SetResultOfSplit(
true);
1976 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1981 new_item.SetQuantity(1,
false,
true);
1986 new_item.SetQuantity(split_quantity_new,
false,
true);
1994 float split_quantity_new =
Math.Floor(quantity / 2);
2003 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(
this,
true);
2007 if (new_item.GetQuantityMax() < split_quantity_new)
2009 split_quantity_new = new_item.GetQuantityMax();
2011 if (found && invloc.IsValid() && invloc.GetType() ==
InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
2014 new_item.SetQuantity(1,
false,
true);
2016 else if (split_quantity_new > 1)
2019 new_item.SetQuantity(split_quantity_new,
false,
true);
2031 parent.OnAttachmentQuantityChangedEx(
this, delta);
2033 if (IsLiquidContainer())
2041 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
2062 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2069 EntityAI parent = GetHierarchyParent();
2070 if (parent && parent.IsFireplace())
2072 CargoBase cargo = GetInventory().GetCargo();
2075 for (
int i = 0; i < cargo.GetItemCount(); ++i)
2090 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
2100 super.OnRightClick();
2108 EntityAI root = GetHierarchyRoot();
2109 Man playerOwner = GetHierarchyRootPlayer();
2113 if (!playerOwner && root && root ==
this)
2120 GetInventory().GetCurrentInventoryLocation(dst);
2121 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(
this,
FindInventoryLocationType.CARGO, dst))
2130 dst.SetCargo(dst.GetParent(),
this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2133 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
2150 dst.WriteToContext(ctx);
2155 else if (!
GetGame().IsMultiplayer())
2167 root.GetTransform(m4);
2168 dst.SetGround(
this, m4);
2172 GetInventory().GetCurrentInventoryLocation(dst);
2179 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
2190 Magazine mag = Magazine.Cast(
this);
2193 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
2196 if (stack_max_limit)
2198 Magazine other_mag = Magazine.Cast(other_item);
2201 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
2218 if (CastTo(player, GetHierarchyRootPlayer()))
2220 if (player.GetInventory().HasAttachment(
this))
2223 if (player.IsItemsToDelete())
2227 if (reservation_check && (GetInventory().HasInventoryReservation(
this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
2232 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
2245 return m_IsResultOfSplit;
2250 m_IsResultOfSplit = value;
2260 float other_item_quantity = other_item.GetQuantity();
2261 float this_free_space;
2267 if (other_item_quantity > this_free_space)
2269 return this_free_space;
2273 return other_item_quantity;
2284 if (!CanBeCombined(other_item,
false))
2287 if (!IsMagazine() && other_item)
2290 if (quantity_used != 0)
2292 float hp1 = GetHealth01(
"",
"");
2293 float hp2 = other_item.GetHealth01(
"",
"");
2294 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
2295 hpResult = hpResult / (
GetQuantity() + quantity_used);
2297 hpResult *= GetMaxHealth();
2298 Math.Round(hpResult);
2299 SetHealth(
"",
"Health", hpResult);
2302 other_item.AddQuantity(-quantity_used);
2305 OnCombine(other_item);
2311 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
2312 GetHierarchyParent().IncreaseLifetimeUp();
2321 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2322 if (moduleRecipesManager)
2324 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
2325 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
2328 for (
int i = 0;i < recipesIds.Count(); i++)
2330 int key = recipesIds.Get(i);
2331 string recipeName = moduleRecipesManager.GetRecipeName(key);
2339 super.GetDebugActions(outputList);
2365 if (IsLiquidContainer())
2383 GetInventory().GetCurrentInventoryLocation(loc);
2386 if (Gizmo_IsSupported())
2399 super.OnAction(action_id, player, ctx);
2406 GetGame().GizmoSelectObject(
this);
2409 GetGame().GizmoSelectPhysics(GetPhysics());
2424 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
2426 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2427 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
2429 if (
EActions.RECIPES_RANGE_START < 1000)
2431 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2432 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2436 else if (action_id ==
EActions.WATCH_PLAYER)
2438 PluginDeveloper.SetDeveloperItemClientEx(player);
2443 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2445 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2446 OnDebugButtonPressServer(
id + 1);
2449 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2451 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2455 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2457 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2461 else if (action_id ==
EActions.ADD_QUANTITY)
2465 Magazine mag = Magazine.Cast(
this);
2466 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2475 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2480 else if (action_id ==
EActions.REMOVE_QUANTITY)
2484 Magazine mag2 = Magazine.Cast(
this);
2485 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2493 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2498 else if (action_id ==
EActions.SET_QUANTITY_0)
2508 else if (action_id ==
EActions.SET_MAX_QUANTITY)
2514 m_EM.SetEnergy(m_EM.GetEnergyMax());
2518 else if (action_id ==
EActions.ADD_HEALTH)
2520 AddHealth(
"",
"",GetMaxHealth(
"",
"Health")/5);
2522 else if (action_id ==
EActions.REMOVE_HEALTH)
2524 AddHealth(
"",
"",-GetMaxHealth(
"",
"Health")/5);
2526 else if (action_id ==
EActions.DESTROY_HEALTH)
2528 SetHealth01(
"",
"",0);
2530 else if (action_id ==
EActions.WATCH_ITEM)
2535 SetDebugDeveloper_item(
this);
2539 else if (action_id ==
EActions.ADD_TEMPERATURE)
2545 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
2547 AddTemperature(-20);
2551 else if (action_id ==
EActions.FLIP_FROZEN)
2553 SetFrozen(!GetIsFrozen());
2557 else if (action_id ==
EActions.ADD_WETNESS)
2563 else if (action_id ==
EActions.REMOVE_WETNESS)
2569 else if (action_id ==
EActions.LIQUIDTYPE_UP)
2577 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
2583 else if (action_id ==
EActions.MAKE_SPECIAL)
2585 auto debugParams = DebugSpawnParams.WithPlayer(player);
2586 OnDebugSpawnEx(debugParams);
2628 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
2629 return GetGame().ConfigIsExisting(config_path);
2655 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2656 return module_repairing.CanRepair(
this, item_repair_kit);
2662 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2663 return module_repairing.Repair(player,
this, item_repair_kit, specialty_weight);
2708 player.MessageStatus(text);
2726 player.MessageAction(text);
2744 player.MessageFriendly(text);
2762 player.MessageImportant(text);
2775 string item_name = this.
GetType();
2777 GetGame().ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
2779 int array_size = item_tag_array.Count();
2780 for (
int i = 0; i < array_size; i++)
2782 if (item_tag_array.Get(i) == tag)
2795 super.OnRPC(sender, rpc_type,ctx);
2801 case ERPCs.RPC_SOUND_LOCK_ATTACH:
2807 bool play = p.param1;
2808 string soundSet = p.param2;
2845 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2846 return plugin.GetID(
name);
2851 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2852 return plugin.GetName(
id);
2861 if (!ctx.Read(varFlags))
2873 super.SerializeNumericalVars(floats_out);
2909 super.DeSerializeNumericalVars(floats);
2913 int mask =
Math.Round(floats.Get(index));
2925 float quantity = floats.Get(index);
2926 SetQuantity(quantity,
true,
false,
false,
false);
2933 float wet = floats.Get(index);
2940 int liquidtype =
Math.Round(floats.Get(index));
2959 int cleanness =
Math.Round(floats.Get(index));
2967 super.WriteVarsToCTX(ctx);
3003 if (!super.ReadVarsFromCTX(ctx,version))
3011 if (!ctx.Read(intValue))
3014 m_VariablesMask = intValue;
3019 if (!ctx.Read(value))
3028 SetQuantity(value,
true,
false,
false,
false);
3036 if (!ctx.Read(value))
3038 SetTemperatureDirect(value);
3044 if (!ctx.Read(value))
3051 if (!ctx.Read(intValue))
3073 if (!ctx.Read(intValue))
3078 if (version >= 138 && version < 140)
3082 if (!ctx.Read(intValue))
3084 SetFrozen(intValue);
3100 if (!super.OnStoreLoad(ctx, version))
3108 bool hasQuickBarIndexSaved;
3110 if (!ctx.Read(hasQuickBarIndexSaved))
3116 if (hasQuickBarIndexSaved)
3121 if (!ctx.Read(itmQBIndex))
3128 if (itmQBIndex != -1 && parentPlayer)
3129 parentPlayer.SetLoadedQuickBarItemBind(
this, itmQBIndex);
3137 if (version ==
int.
MAX)
3139 if (!ctx.Read(itemQBIndex))
3145 else if (
Class.CastTo(player, GetHierarchyRootPlayer()))
3148 if (!ctx.Read(itemQBIndex))
3153 if (itemQBIndex != -1 && player)
3154 player.SetLoadedQuickBarItemBind(
this,itemQBIndex);
3161 if (!LoadVariables(ctx, version))
3195 super.OnStoreSave(ctx);
3198 if (
PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
3202 int itemQBIndex = -1;
3203 itemQBIndex = player.FindQuickBarEntityIndex(
this);
3204 ctx.Write(itemQBIndex);
3223 super.AfterStoreLoad();
3239 super.EEOnAfterLoad();
3261 #ifdef PLATFORM_CONSOLE
3302 super.OnVariablesSynchronized();
3308 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
3310 if (!IsServerCheck(allow_client))
3319 if (value <= (min + 0.001))
3326 bool dstr = ConfigGetBool(
"varQuantityDestroyOnMin");
3334 else if (destroy_forced)
3362 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
3364 return SetQuantity(
GetQuantity() + value, destroy_config, destroy_forced);
3382 float value_clamped =
Math.Clamp(value, 0, 1);
3384 SetQuantity(result, destroy_config, destroy_forced);
3414 GetInventory().GetCurrentInventoryLocation(il);
3415 slot = il.GetSlot();
3423 float quantity_max = 0;
3427 if (attSlotID != -1)
3430 if (quantity_max <= 0)
3434 if (quantity_max <= 0)
3437 return quantity_max;
3470 float weightEx = GetWeightEx();
3471 float special = GetInventoryAndCargoWeight();
3472 return weightEx - special;
3486 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3489 data1.SetCalcDetails(
"TIB1: " + GetConfigWeightModifiedDebugText() +
" * " +
GetQuantity()+
"(quantity)");
3495 else if (HasEnergyManager())
3498 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3501 data2.SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
3504 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
3509 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3512 data3.SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
3515 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
3525 if (GetInventory().GetCargo() != NULL)
3527 item_count = GetInventory().GetCargo().GetItemCount();
3530 for (
int i = 0; i < GetInventory().AttachmentCount(); i++)
3532 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
3534 item_count += item.GetNumberOfItems();
3544 if (include_wetness)
3548 weight = wetness * m_ConfigWeight;
3550 else if (IsLiquidContainer())
3561 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
3566 for (
int i = 0; i < items.Count(); i++)
3583 if (HasEnergyManager())
3585 energy = GetCompEM().GetEnergy();
3593 super.OnEnergyConsumed();
3600 super.OnEnergyAdded();
3608 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
3612 float energy_0to1 = GetCompEM().GetEnergy0To1();
3621 return ConfigGetFloat(
"heatIsolation");
3631 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
3632 if (
GetGame().ConfigIsExisting(paramPath))
3633 return GetGame().ConfigGetFloat(paramPath);
3640 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
3641 if (
GetGame().ConfigIsExisting(paramPath))
3642 return GetGame().ConfigGetFloat(paramPath);
3647 override void SetWet(
float value,
bool allow_client =
false)
3649 if (!IsServerCheck(allow_client))
3700 if (newLevel != oldLevel)
3713 return GetWetLevelInternal(
m_VarWet);
3742 if (ConfigIsExisting(
"itemModelLength"))
3744 return ConfigGetFloat(
"itemModelLength");
3751 if (ConfigIsExisting(
"itemAttachOffset"))
3753 return ConfigGetFloat(
"itemAttachOffset");
3760 if (!IsServerCheck(allow_client))
3806 override void GetColor(out
int r,out
int g,out
int b,out
int a)
3828 return MiscGameplayFunctions.GetColorString(r, g, b, a);
3835 if (!IsServerCheck(allow_client))
3846 return ConfigGetInt(
"varLiquidTypeInit");
3863 player.SetEnableQuickBarEntityShortcut(
this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
3875 nplayer.SetEnableQuickBarEntityShortcut(
this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
3887 nplayer.SetEnableQuickBarEntityShortcut(
this,
false);
3892 player.GetHumanInventory().ClearUserReservedLocationForContainer(
this);
3895 if (HasEnergyManager())
3897 GetCompEM().UpdatePlugState();
3904 super.OnPlacementStarted(player);
3913 m_AdminLog.OnPlacementComplete(player,
this);
3916 super.OnPlacementComplete(player, position, orientation);
3925 if (agent_id & m_AttachedAgents)
3940 m_AttachedAgents = ~agent_id & m_AttachedAgents;
3947 m_AttachedAgents = 0;
3952 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
3960 m_AttachedAgents = (agent | m_AttachedAgents);
3966 m_AttachedAgents = (m_AttachedAgents | agents);
3972 return m_AttachedAgents;
4018 if (!ctx.Read(m_AttachedAgents))
4026 ctx.Write(m_AttachedAgents);
4033 super.CheckForRoofLimited(timeTresholdMS);
4036 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
4038 m_PreviousRoofTestTime = time;
4039 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(
this));
4051 if (GetInventory().GetAttachmentSlotsCount() != 0)
4053 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
4055 return filter.GetProtectionLevel(type,
false, system);
4060 string subclassPath, entryName;
4065 entryName =
"biological";
4068 entryName =
"chemical";
4071 entryName =
"biological";
4075 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
4077 return GetGame().ConfigGetFloat(subclassPath + entryName);
4086 SetCEBasedQuantity();
4119 if (!parent.IsRuined())
4128 if (!super.CanPutAsAttachment(parent))
4133 if (!IsRuined() && !parent.IsRuined())
4147 return super.CanReceiveItemIntoCargo(item);
4157 if (attachmentInv && attachmentInv.
GetCargo() && attachmentInv.
GetCargo().GetItemCount() > 0)
4159 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(
PlayerBase))
4164 attachment.GetInventory().GetCurrentInventoryLocation(loc);
4165 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
4168 return super.CanReceiveAttachment(attachment, slotId);
4173 if (!super.CanReleaseAttachment(attachment))
4176 return GetInventory().AreChildrenAccessible();
4201 int id = muzzle_owner.GetMuzzleID();
4206 for (
int i = 0; i < WPOF_array.Count(); i++)
4208 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
4212 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
4221 int id = muzzle_owner.GetMuzzleID();
4226 for (
int i = 0; i < WPOBE_array.Count(); i++)
4228 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
4232 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4241 int id = muzzle_owner.GetMuzzleID();
4246 for (
int i = 0; i < WPOOH_array.Count(); i++)
4248 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4252 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4261 int id = muzzle_owner.GetMuzzleID();
4266 for (
int i = 0; i < WPOOH_array.Count(); i++)
4268 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4272 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4281 int id = muzzle_owner.GetMuzzleID();
4286 for (
int i = 0; i < WPOOH_array.Count(); i++)
4288 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4292 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4364 string att_type =
"None";
4366 if (ConfigIsExisting(
"soundAttType"))
4368 att_type = ConfigGetString(
"soundAttType");
4391 if (!m_ItemSoundHandler)
4394 return m_ItemSoundHandler;
4412 params.m_Loop =
true;
4456 if (!
GetGame().IsDedicatedServer())
4458 if (ConfigIsExisting(
"attachSoundSet"))
4460 string cfg_path =
"";
4461 string soundset =
"";
4466 ConfigGetTextArray(
"attachSoundSet",cfg_soundset_array);
4467 ConfigGetTextArray(
"attachSoundSlot",cfg_slot_array);
4469 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
4471 for (
int i = 0; i < cfg_soundset_array.Count(); i++)
4473 if (cfg_slot_array[i] == slot_type)
4475 soundset = cfg_soundset_array[i];
4516 SetDynamicPhysicsLifeTime(0.01);
4523 GetDamageZones(zone_names);
4524 for (
int i = 0; i < zone_names.Count(); i++)
4526 SetHealthMax(zone_names.Get(i),
"Health");
4528 SetHealthMax(
"",
"Health");
4534 float global_health = GetHealth01(
"",
"Health");
4536 GetDamageZones(zones);
4538 for (
int i = 0; i < zones.Count(); i++)
4540 SetHealth01(zones.Get(i),
"Health",global_health);
4547 return IsExclusionFlagPresent(
PlayerBase.GetFaceCoverageShaveValues());
4552 if (!hasRootAsPlayer)
4560 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
4579 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
4580 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
4582 float heatPermCoef = 1.0;
4586 heatPermCoef *= ent.GetHeatPermeabilityCoef();
4587 ent = ent.GetHierarchyParent();
4598 EntityAI parent = GetHierarchyParent();
4602 hasRootAsPlayer =
false;
4607 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
4608 refParentIB =
ItemBase.Cast(parent);
4639 return !GetIsFrozen() &&
IsOpen();
4644 bool hasParent =
false, hasRootAsPlayer =
false;
4647 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
4648 bool foodDecay =
g_Game.IsFoodDecayEnabled();
4650 if (wwtu || foodDecay)
4656 if (processWetness || processTemperature || processDecay)
4661 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
4663 if (processTemperature)
4667 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
4675 return m_TemperaturePerQuantityWeight *
GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
4683 return super.GetTemperatureFreezeThreshold();
4691 return super.GetTemperatureThawThreshold();
4699 return super.GetItemOverheatThreshold();
4707 return super.GetTemperatureFreezeTime();
4715 return super.GetTemperatureThawTime();
4725 return (item.IsKindOf(
"Cauldron") || item.IsKindOf(
"Pot") || item.IsKindOf(
"FryingPan") || item.IsKindOf(
"SmallProtectorCase") || (item.IsKindOf(
"PortableGasStove") && item.FindAttachmentBySlotName(
"CookingEquipment")));
4730 MiscGameplayFunctions.TransferItemProperties(oldItem,
this);
4773 explosive.PairRemote(trg);
4777 trg.SetPersistentPairID(persistentID);
4778 explosive.SetPersistentPairID(persistentID);
4791 ret *= GetHealth01();
4797 override void SetDebugItem()
4799 super.SetDebugItem();
4805 string text = super.GetDebugText();
4808 text +=
string.Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
4861 if (is_item && full_quantity)
4864 item.SetQuantity(item.GetQuantityInit());
4880 item.SetHealth(
"",
"", health);
4882 if (item.CanHaveTemperature())
4885 if (item.CanFreeze())
4886 item.SetFrozen(
false);
4889 if (item.HasEnergyManager())
4893 item.GetCompEM().SetEnergy0To1(quantity);
4897 item.GetCompEM().SetEnergy(
Math.AbsFloat(quantity));
4900 else if (item.IsMagazine())
4902 Magazine mag = Magazine.Cast(item);
4905 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
4909 mag.ServerSetAmmoCount(
Math.AbsFloat(quantity));
4917 item.SetQuantityNormalized(quantity,
false);
4921 item.SetQuantity(
Math.AbsFloat(quantity));
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
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
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
void OnItemLocationChanged(ItemBase item)
proto int GetTime()
returns mission time in milliseconds
AnalyticsManagerClient GetAnalyticsClient()
represents base for cargo storage for entities
Super root of all classes in Enforce script.
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 ...
Wrapper class for managing sound through SEffectManager.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
script counterpart to engine's class Inventory
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
const int c_InventoryReservationTimeoutShortMS
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
override string GetAttachmentSoundType()
bool IsActionTargetVisible()
override float GetQuantity()
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
override void OnEnergyConsumed()
string GetLoopDeploySoundset()
override void ClearInventory()
void SoundSynchRemoteReset()
void PlayDeployLoopSoundEx()
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
EffectSound m_SoundDeployFinish
ItemBase GetLightSourceItem()
override bool IsOneHandedBehaviour()
override void SetColor(int r, int g, int b, int a)
override int GetCleanness()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override float GetTemperatureThawThreshold()
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool HasQuantity()
override float GetTemperatureThawTime()
void StopItemDynamicPhysics()
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
override bool IsStoreLoad()
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override float GetWetMin()
override bool CanDisplayCargo()
override void SetWetMax()
bool CanPlayDeployLoopSound()
array< string > GetHeadHidingSelection()
float GetHeatIsolationInit()
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
override void ProcessVariables()
bool HidesSelectionBySlot()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
bool m_IsSoundSynchRemote
void RemoveAudioVisualsOnClient()
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
void SetIsPlaceSound(bool is_place_sound)
void ClearStopItemSoundServer()
override void RemoveAllAgents()
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 void OnStoreSave(ParamsWriteContext ctx)
string GetLoopFoldSoundset()
override bool CanPutInCargo(EntityAI parent)
override void SetQuantityToMinimum()
WrittenNoteData GetWrittenNoteData()
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
ref TIntArray m_SingleUseActions
override void SetTakeable(bool pState)
array< int > GetValidFinishers()
returns an array of possible finishers
bool CanBeCookedOnStick()
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
override void SetWet(float value, bool allow_client=false)
float GetSoakingIncrement(string pIncrementName)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void SplitIntoStackMaxHandsClient(PlayerBase player)
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void OnInventoryExit(Man player)
Event called on item when it is removed from the player(Man) inventory, passes the old owner as a par...
override float GetTemperatureFreezeTime()
void TransferAgents(int agents)
transfer agents from another item
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
override bool CanPutAsAttachment(EntityAI parent)
ref EffectSound m_LockingSound
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
ItemSoundHandler GetItemSoundHandler()
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void SaveAgents(ParamsWriteContext ctx)
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
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...
void SplitIntoStackMaxHands(PlayerBase player)
override void OnEnergyAdded()
void StopDeployLoopSoundEx()
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
override bool KindOf(string tag)
override void InsertAgent(int agent, float count=1)
override EWetnessLevel GetWetLevel()
override int GetQuantityMax()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
void ConvertEnergyToQuantity()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override float GetWetInit()
override void SetStoreLoadedQuantity(float value)
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void SetIsDeploySound(bool is_deploy_sound)
override void RemoveAllAgentsExcept(int agent_to_keep)
override void OnPlacementStarted(Man player)
override int GetLiquidType()
void PerformDamageSystemReinit()
override 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...
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
override int GetTargetQuantityMax(int attSlotID=-1)
void StartItemSoundServer(int id)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
bool IsCargoException4x3(EntityAI item)
override void EEOnAfterLoad()
override void SetLiquidType(int value, bool allow_client=false)
override void OnVariablesSynchronized()
void OnInventoryEnter(Man player)
Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
override float GetSingleInventoryItemWeightEx()
override bool IsIgnoredByConstruction()
void OnActivatedByTripWire()
bool ContainsAgent(int agent_id)
bool CanBeMovedOverride()
void Open()
Implementations only.
bool m_HideSelectionsBySlot
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
override float GetItemOverheatThreshold()
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
float GetWeightSpecialized(bool forceRecalc=false)
float GetDeployTime()
how long it takes to deploy this item in seconds
override float GetStoreLoadedQuantity()
float GetBandagingEffectivity()
bool CanBeUsedForSuicide()
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
override bool IsTakeable()
override void SetCleanness(int value, bool allow_client=false)
override void SetStoreLoad(bool value)
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
override void DeSerializeNumericalVars(array< float > floats)
EffectSound m_SoundDeploy
bool ShouldSplitQuantity(float quantity)
override float GetTemperatureFreezeThreshold()
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override void AfterStoreLoad()
float GetSingleInventoryItemWeight()
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
override int GetQuantityMin()
void StopItemSoundServer(int id)
string GetPlaceSoundset()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void PlayDeployFinishSound()
float GetDryingIncrement(string pIncrementName)
override void RemoveAgent(int agent_id)
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override void SerializeNumericalVars(array< float > floats_out)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void SetCanBeMovedOverride(bool setting)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool CanReceiveItemIntoCargo(EntityAI item)
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
bool IsSoundSynchRemote()
void CopyScriptPropertiesFrom(EntityAI oldItem)
PluginAdminLog m_AdminLog
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
float GetItemModelLength()
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
void ClearStartItemSoundServer()
void OnCombine(ItemBase other_item)
void SetResultOfSplit(bool value)
void SplitItem(PlayerBase player)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnWetChanged(float newVal, float oldVal)
void OnLiquidTypeChanged(int oldType, int newType)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
int NameToID(string name)
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
ref array< int > m_CompatibleLocks
ref TIntArray m_ContinuousActions
float GetItemAttachOffset()
bool CanRepair(ItemBase item_repair_kit)
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
bool PairWithDevice(notnull ItemBase otherDevice)
override void GetColor(out int r, out int g, out int b, out int a)
gets item's color variable as components
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
EffectSound m_DeployLoopSoundEx
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
bool AllowFoodConsumption()
string GetDeploySoundset()
void PlayDetachSound(string slot_type)
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
override void OnRightClick()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool CanReleaseAttachment(EntityAI attachment)
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
ItemBase m_LightSourceItem
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool LoadAgents(ParamsReadContext ctx, int version)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
ref TIntArray m_InteractActions
override bool IsHeavyBehaviour()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
float GetQuantityNormalizedScripted()
ref Timer m_PhysDropTimer
void RemoveLightSourceItem()
string GetDeployFinishSoundset()
override float GetWetMax()
ref TStringArray m_HeadHidingSelections
void OnApply(PlayerBase player)
override void AddWet(float value)
provides access to slot configuration
override void OnInventoryEnter(Man player)
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override void OnCreatePhysics()
override string GetDeploySoundset()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void RefreshPhysics()
override bool CanObstruct()
override string GetLoopDeploySoundset()
override void OnInventoryExit(Man player)
override void InitItemSounds()
override bool IsFacingPlayer(PlayerBase player, string selection)
override void OnEndPlacement()
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)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
static int GeneratePersistentID()
Manager class for managing Effect (EffectParticle, EffectSound)
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.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Serialization general interface. Serializer API works with:
script counterpart to engine's class Weapon
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
class GP5GasMask extends MaskBase ItemBase
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.
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
void SplitItem(PlayerBase player)
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...
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
ref TStringArray m_HeadHidingSelections
bool LoadAgents(ParamsReadContext ctx, int version)
bool m_IsSoundSynchRemote
ref array< int > m_CompatibleLocks
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
ref TIntArray m_InteractActions
override float GetWetMax()
bool m_CanBeMovedOverride
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()
override void OnWetChanged(float newVal, float oldVal)
float GetDryingIncrement(string pIncrementName)
bool m_CanPlayImpactSound
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...
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
float GetHeatIsolationInit()
override bool HasQuantity()
ref TIntArray m_ContinuousActions
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
int m_ImpactSoundSurfaceHash
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
override void SetTakeable(bool pState)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
bool can_this_be_combined
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
bool m_WantPlayImpactSound
float m_StoreLoadedQuantity
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...
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
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetItemAttachOffset()
void ProcessDecay(float delta, bool hasRootAsPlayer)
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
bool ContainsAgent(int agent_id)
override void AddWet(float value)
void SplitIntoStackMaxHands(PlayerBase player)
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 OnLiquidTypeChanged(int oldType, int newType)
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
void PerformDamageSystemReinit()
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
override int GetQuantityMax()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
ItemBase m_LightSourceItem
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
override void Explode(int damageType, string ammoType="")