DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ LoadAgents()

bool SpawnItemOnLocation::LoadAgents ( ParamsReadContext ctx,
int version )
protected

См. определение в файле ItemBase.c строка 8714

8718{
8719 override bool CanPutAsAttachment(EntityAI parent)
8720 {
8721 return true;
8722 }
8723};
8724
8725//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8726
8727class ItemBase extends InventoryItem
8728{
8732
8734
8735 static int m_DebugActionsMask;
8737 // ============================================
8738 // Variable Manipulation System
8739 // ============================================
8740 // Quantity
8741
8742 float m_VarQuantity;
8743 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8745 int m_VarQuantityMin;
8746 int m_VarQuantityMax;
8747 int m_Count;
8748 float m_VarStackMax;
8749 float m_StoreLoadedQuantity = float.LOWEST;
8750 // Wet
8751 float m_VarWet;
8752 float m_VarWetPrev;//for client to know wetness changed during synchronization
8753 float m_VarWetInit;
8754 float m_VarWetMin;
8755 float m_VarWetMax;
8756 // Cleanness
8757 int m_Cleanness;
8758 int m_CleannessInit;
8759 int m_CleannessMin;
8760 int m_CleannessMax;
8761 // impact sounds
8763 bool m_CanPlayImpactSound = true;
8764 float m_ImpactSpeed;
8766 //
8767 float m_HeatIsolation;
8768 float m_ItemModelLength;
8769 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8771 int m_VarLiquidType;
8772 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8773 int m_QuickBarBonus;
8774 bool m_IsBeingPlaced;
8775 bool m_IsHologram;
8776 bool m_IsTakeable;
8777 bool m_ThrowItemOnDrop;
8780 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8781 bool can_this_be_combined; //Check if item can be combined
8782 bool m_CanThisBeSplit; //Check if item can be split
8783 bool m_IsStoreLoad = false;
8784 bool m_CanShowQuantity;
8785 bool m_HasQuantityBar;
8786 protected bool m_CanBeDigged;
8787 protected bool m_IsResultOfSplit
8788
8789 string m_SoundAttType;
8790 // items color variables
8795 //-------------------------------------------------------
8796
8797 // light source managing
8799
8803
8804 //==============================================
8805 // agent system
8806 private int m_AttachedAgents;
8807
8809 void TransferModifiers(PlayerBase reciever);
8810
8811
8812 // Weapons & suppressors particle effects
8817 static int m_LastRegisteredWeaponID = 0;
8818
8819 // Overheating effects
8821 float m_OverheatingShots;
8822 ref Timer m_CheckOverheating;
8823 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8824 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8825 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8826 ref array <ref OverheatingParticle> m_OverheatingParticles;
8827
8829 protected bool m_HideSelectionsBySlot;
8830
8831 // Admin Log
8832 PluginAdminLog m_AdminLog;
8833
8834 // misc
8835 ref Timer m_PhysDropTimer;
8836
8837 // Attachment Locking variables
8838 ref array<int> m_CompatibleLocks;
8839 protected int m_LockType;
8840 protected ref EffectSound m_LockingSound;
8841 protected string m_LockSoundSet;
8842
8843 // ItemSoundHandler
8844 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8845 protected int m_SoundSyncPlay; // id for sound to play
8846 protected int m_SoundSyncStop; // id for sound to stop
8848
8849 //temperature
8850 private float m_TemperaturePerQuantityWeight;
8851
8852 // -------------------------------------------------------------------------
8853 void ItemBase()
8854 {
8855 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8859
8860 if (!GetGame().IsDedicatedServer())
8861 {
8862 if (HasMuzzle())
8863 {
8865
8867 {
8869 }
8870 }
8871
8873 m_ActionsInitialize = false;
8874 }
8875
8876 m_OldLocation = null;
8877
8878 if (GetGame().IsServer())
8879 {
8880 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8881 }
8882
8883 if (ConfigIsExisting("headSelectionsToHide"))
8884 {
8886 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8887 }
8888
8889 m_HideSelectionsBySlot = false;
8890 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8891 {
8892 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8893 }
8894
8895 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8896
8897 m_IsResultOfSplit = false;
8898
8900 }
8901
8902 override void InitItemVariables()
8903 {
8904 super.InitItemVariables();
8905
8906 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8907 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8908 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8909 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8910 m_VarStackMax = ConfigGetFloat("varStackMax");
8911 m_Count = ConfigGetInt("count");
8912
8913 m_CanShowQuantity = ConfigGetBool("quantityShow");
8914 m_HasQuantityBar = ConfigGetBool("quantityBar");
8915
8916 m_CleannessInit = ConfigGetInt("varCleannessInit");
8918 m_CleannessMin = ConfigGetInt("varCleannessMin");
8919 m_CleannessMax = ConfigGetInt("varCleannessMax");
8920
8921 m_WantPlayImpactSound = false;
8922 m_ImpactSpeed = 0.0;
8923
8924 m_VarWetInit = ConfigGetFloat("varWetInit");
8926 m_VarWetMin = ConfigGetFloat("varWetMin");
8927 m_VarWetMax = ConfigGetFloat("varWetMax");
8928
8929 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8930 if (IsLiquidContainer() && GetQuantity() != 0)
8932 m_IsBeingPlaced = false;
8933 m_IsHologram = false;
8934 m_IsTakeable = true;
8935 m_CanBeMovedOverride = false;
8939 m_CanBeDigged = ConfigGetBool("canBeDigged");
8940
8941 m_CompatibleLocks = new array<int>();
8942 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8943 m_LockType = ConfigGetInt("lockType");
8944
8945 //Define if item can be split and set ability to be combined accordingly
8946 m_CanThisBeSplit = false;
8947 can_this_be_combined = false;
8948 if (ConfigIsExisting("canBeSplit"))
8949 {
8950 can_this_be_combined = ConfigGetBool("canBeSplit");
8952 }
8953
8954 m_ItemBehaviour = -1;
8955 if (ConfigIsExisting("itemBehaviour"))
8956 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8957
8958 //RegisterNetSyncVariableInt("m_VariablesMask");
8959 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8960 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8961 RegisterNetSyncVariableInt("m_VarLiquidType");
8962 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8963
8964 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8965 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8966 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8967
8968 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8969 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8970 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8971 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8972
8973 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8974 RegisterNetSyncVariableBool("m_IsTakeable");
8975 RegisterNetSyncVariableBool("m_IsHologram");
8976
8977 InitItemSounds();
8979 {
8980 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8981 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8982 }
8983
8984 m_LockSoundSet = ConfigGetString("lockSoundSet");
8985
8987 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8988 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8989
8990 }
8991
8992 override int GetQuickBarBonus()
8993 {
8994 return m_QuickBarBonus;
8995 }
8996
8997 void InitializeActions()
8998 {
9000 if (!m_InputActionMap)
9001 {
9003 m_InputActionMap = iam;
9004 SetActions();
9006 }
9007 }
9008
9009 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9010 {
9012 {
9013 m_ActionsInitialize = true;
9015 }
9016
9017 actions = m_InputActionMap.Get(action_input_type);
9018 }
9019
9020 void SetActions()
9021 {
9022 AddAction(ActionTakeItem);
9023 AddAction(ActionTakeItemToHands);
9024 AddAction(ActionWorldCraft);
9026 AddAction(ActionAttachWithSwitch);
9027 }
9028
9029 void SetActionAnimOverrides(); // Override action animation for specific item
9030
9031 void AddAction(typename actionName)
9032 {
9033 ActionBase action = ActionManagerBase.GetAction(actionName);
9034
9035 if (!action)
9036 {
9037 Debug.LogError("Action " + actionName + " dosn't exist!");
9038 return;
9039 }
9040
9041 typename ai = action.GetInputType();
9042 if (!ai)
9043 {
9044 m_ActionsInitialize = false;
9045 return;
9046 }
9047
9048 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9049 if (!action_array)
9050 {
9051 action_array = new array<ActionBase_Basic>;
9052 m_InputActionMap.Insert(ai, action_array);
9053 }
9054 if (LogManager.IsActionLogEnable())
9055 {
9056 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9057 }
9058
9059 if (action_array.Find(action) != -1)
9060 {
9061 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9062 }
9063 else
9064 {
9065 action_array.Insert(action);
9066 }
9067 }
9068
9069 void RemoveAction(typename actionName)
9070 {
9071 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9072 ActionBase action = player.GetActionManager().GetAction(actionName);
9073 typename ai = action.GetInputType();
9074 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9075
9076 if (action_array)
9077 {
9078 action_array.RemoveItem(action);
9079 }
9080 }
9081
9082 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9083 // Set -1 for params which should stay in default state
9084 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9085 {
9086 ActionOverrideData overrideData = new ActionOverrideData();
9087 overrideData.m_CommandUID = commandUID;
9088 overrideData.m_CommandUIDProne = commandUIDProne;
9089 overrideData.m_StanceMask = stanceMask;
9090
9091 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9092 if (!actionMap) // create new map of action > overidables map
9093 {
9094 actionMap = new TActionAnimOverrideMap();
9095 m_ItemActionOverrides.Insert(action, actionMap);
9096 }
9097
9098 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9099
9100 }
9101
9102 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9103
9104 ScriptedLightBase GetLight();
9105
9106 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9107 void LoadParticleConfigOnFire(int id)
9108 {
9109 if (!m_OnFireEffect)
9111
9114
9115 string config_to_search = "CfgVehicles";
9116 string muzzle_owner_config;
9117
9118 if (!m_OnFireEffect.Contains(id))
9119 {
9120 if (IsInherited(Weapon))
9121 config_to_search = "CfgWeapons";
9122
9123 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9124
9125 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9126
9127 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9128
9129 if (config_OnFire_subclass_count > 0)
9130 {
9131 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9132
9133 for (int i = 0; i < config_OnFire_subclass_count; i++)
9134 {
9135 string particle_class = "";
9136 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9137 string config_OnFire_entry = config_OnFire_class + particle_class;
9138 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9139 WPOF_array.Insert(WPOF);
9140 }
9141
9142
9143 m_OnFireEffect.Insert(id, WPOF_array);
9144 }
9145 }
9146
9147 if (!m_OnBulletCasingEjectEffect.Contains(id))
9148 {
9149 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9150 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9151
9152 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9153
9154 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9155
9156 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9157 {
9158 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9159
9160 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9161 {
9162 string particle_class2 = "";
9163 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9164 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9165 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9166 WPOBE_array.Insert(WPOBE);
9167 }
9168
9169
9170 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9171 }
9172 }
9173 }
9174
9175 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9177 {
9180
9181 if (!m_OnOverheatingEffect.Contains(id))
9182 {
9183 string config_to_search = "CfgVehicles";
9184
9185 if (IsInherited(Weapon))
9186 config_to_search = "CfgWeapons";
9187
9188 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9189 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9190
9191 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9192 {
9193
9194 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9195
9197 {
9198 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9199 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9200 Error(error);
9201 return;
9202 }
9203
9204 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9205 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9206
9207
9208
9209 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9210 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9211
9212 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9213 {
9214 string particle_class = "";
9215 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9216 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9217 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9218
9219 if (entry_type == CT_CLASS)
9220 {
9221 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9222 WPOOH_array.Insert(WPOF);
9223 }
9224 }
9225
9226
9227 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9228 }
9229 }
9230 }
9231
9232 float GetOverheatingValue()
9233 {
9234 return m_OverheatingShots;
9235 }
9236
9237 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9238 {
9239 if (m_MaxOverheatingValue > 0)
9240 {
9242
9243 if (!m_CheckOverheating)
9245
9247 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9248
9249 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9250 }
9251 }
9252
9253 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9254 {
9256 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9257
9259 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9260
9262 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9263
9265 {
9267 }
9268 }
9269
9271 {
9273 }
9274
9275 void OnOverheatingDecay()
9276 {
9277 if (m_MaxOverheatingValue > 0)
9278 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9279 else
9281
9282 if (m_OverheatingShots <= 0)
9283 {
9286 }
9287 else
9288 {
9289 if (!m_CheckOverheating)
9291
9293 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9294 }
9295
9296 CheckOverheating(this, "", this);
9297 }
9298
9299 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9300 {
9302 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9303 }
9304
9305 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9306 {
9308 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9310 }
9311
9312 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9313 {
9315 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9316 }
9317
9318 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9319 {
9321 m_OverheatingParticles = new array<ref OverheatingParticle>;
9322
9323 OverheatingParticle OP = new OverheatingParticle();
9324 OP.RegisterParticle(p);
9325 OP.SetOverheatingLimitMin(min_heat_coef);
9326 OP.SetOverheatingLimitMax(max_heat_coef);
9327 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
9328
9329 m_OverheatingParticles.Insert(OP);
9330 }
9331
9332 float GetOverheatingCoef()
9333 {
9334 if (m_MaxOverheatingValue > 0)
9336
9337 return -1;
9338 }
9339
9341 {
9343 {
9344 float overheat_coef = GetOverheatingCoef();
9345 int count = m_OverheatingParticles.Count();
9346
9347 for (int i = count; i > 0; --i)
9348 {
9349 int id = i - 1;
9350 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9351 Particle p = OP.GetParticle();
9352
9353 float overheat_min = OP.GetOverheatingLimitMin();
9354 float overheat_max = OP.GetOverheatingLimitMax();
9355
9356 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9357 {
9358 if (p)
9359 {
9360 p.Stop();
9361 OP.RegisterParticle(null);
9362 }
9363 }
9364 }
9365 }
9366 }
9367
9369 {
9371 {
9372 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9373 {
9374 int id = i - 1;
9375 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9376
9377 if (OP)
9378 {
9379 Particle p = OP.GetParticle();
9380
9381 if (p)
9382 {
9383 p.Stop();
9384 }
9385
9386 delete OP;
9387 }
9388 }
9389
9390 m_OverheatingParticles.Clear();
9392 }
9393 }
9394
9396 float GetInfectionChance(int system = 0, Param param = null)
9397 {
9398 return 0.0;
9399 }
9400
9401
9402 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9403 {
9404 return 250;//default value
9405 }
9406
9407 float GetFilterDamageRatio()
9408 {
9409 return 0;
9410 }
9411
9413 bool HasMuzzle()
9414 {
9415 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9416 return true;
9417
9418 return false;
9419 }
9420
9422 int GetMuzzleID()
9423 {
9424 if (!m_WeaponTypeToID)
9426
9427 if (m_WeaponTypeToID.Contains(GetType()))
9428 {
9429 return m_WeaponTypeToID.Get(GetType());
9430 }
9431 else
9432 {
9433 // Register new weapon ID
9435 }
9436
9438 }
9439
9446 {
9447 return -1;
9448 }
9449
9450
9451
9452 // -------------------------------------------------------------------------
9453 void ~ItemBase()
9454 {
9455 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9456 {
9457 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9458 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9459
9460 if (r_index >= 0)
9461 {
9462 InventoryLocation r_il = new InventoryLocation;
9463 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9464
9465 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9466 int r_type = r_il.GetType();
9467 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9468 {
9469 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9470 }
9471 else if (r_type == InventoryLocationType.ATTACHMENT)
9472 {
9473 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9474 }
9475
9476 }
9477
9478 player.GetHumanInventory().ClearUserReservedLocation(this);
9479 }
9480
9481 if (m_LockingSound)
9482 SEffectManager.DestroyEffect(m_LockingSound);
9483 }
9484
9485
9486
9487 // -------------------------------------------------------------------------
9488 static int GetDebugActionsMask()
9489 {
9490 return ItemBase.m_DebugActionsMask;
9491 }
9492
9493 static bool HasDebugActionsMask(int mask)
9494 {
9495 return ItemBase.m_DebugActionsMask & mask;
9496 }
9497
9498 static void SetDebugActionsMask(int mask)
9499 {
9500 ItemBase.m_DebugActionsMask = mask;
9501 }
9502
9503 static void AddDebugActionsMask(int mask)
9504 {
9505 ItemBase.m_DebugActionsMask |= mask;
9506 }
9507
9508 static void RemoveDebugActionsMask(int mask)
9509 {
9510 ItemBase.m_DebugActionsMask &= ~mask;
9511 }
9512
9513 static void ToggleDebugActionsMask(int mask)
9514 {
9515 if (HasDebugActionsMask(mask))
9516 {
9518 }
9519 else
9520 {
9521 AddDebugActionsMask(mask);
9522 }
9523 }
9524
9525 // -------------------------------------------------------------------------
9526 void SetCEBasedQuantity()
9527 {
9528 if (GetEconomyProfile())
9529 {
9530 float q_max = GetEconomyProfile().GetQuantityMax();
9531 if (q_max > 0)
9532 {
9533 float q_min = GetEconomyProfile().GetQuantityMin();
9534 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9535
9536 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9537 {
9538 ComponentEnergyManager comp = GetCompEM();
9539 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
9540 {
9541 comp.SetEnergy0To1(quantity_randomized);
9542 }
9543 }
9544 else if (HasQuantity())
9545 {
9546 SetQuantityNormalized(quantity_randomized, false);
9547 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9548 }
9549
9550 }
9551 }
9552 }
9553
9555 void LockToParent()
9556 {
9557 EntityAI parent = GetHierarchyParent();
9558
9559 if (parent)
9560 {
9561 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9562 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9563 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9564 }
9565 }
9566
9568 void UnlockFromParent()
9569 {
9570 EntityAI parent = GetHierarchyParent();
9571
9572 if (parent)
9573 {
9574 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9575 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9576 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9577 }
9578 }
9579
9580 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9581 {
9582 /*
9583 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9584 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9585 */
9586 ItemBase item2 = ItemBase.Cast(entity2);
9587
9588 if (GetGame().IsClient())
9589 {
9590 if (ScriptInputUserData.CanStoreInputUserData())
9591 {
9592 ScriptInputUserData ctx = new ScriptInputUserData;
9594 ctx.Write(-1);
9595 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9596 ctx.Write(i1);
9597 ctx.Write(item2);
9598 ctx.Write(use_stack_max);
9599 ctx.Write(-1);
9600 ctx.Send();
9601
9602 if (IsCombineAll(item2, use_stack_max))
9603 {
9604 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9605 }
9606 }
9607 }
9608 else if (!GetGame().IsMultiplayer())
9609 {
9610 CombineItems(item2, use_stack_max);
9611 }
9612 }
9613
9614 bool IsLiquidPresent()
9615 {
9616 return (GetLiquidType() != 0 && HasQuantity());
9617 }
9618
9619 bool IsLiquidContainer()
9620 {
9621 return m_LiquidContainerMask != 0;
9622 }
9623
9625 {
9626 return m_LiquidContainerMask;
9627 }
9628
9629 bool IsBloodContainer()
9630 {
9631 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9632 return false;
9633 }
9634
9635 bool IsNVG()
9636 {
9637 return false;
9638 }
9639
9642 bool IsExplosive()
9643 {
9644 return false;
9645 }
9646
9648 {
9649 return "";
9650 }
9651
9653
9654 bool IsLightSource()
9655 {
9656 return false;
9657 }
9658
9660 {
9661 return true;
9662 }
9663
9664 //--- ACTION CONDITIONS
9665 //direction
9666 bool IsFacingPlayer(PlayerBase player, string selection)
9667 {
9668 return true;
9669 }
9670
9671 bool IsPlayerInside(PlayerBase player, string selection)
9672 {
9673 return true;
9674 }
9675
9676 override bool CanObstruct()
9677 {
9678 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9679 return !player || !IsPlayerInside(player, "");
9680 }
9681
9682 override bool IsBeingPlaced()
9683 {
9684 return m_IsBeingPlaced;
9685 }
9686
9687 void SetIsBeingPlaced(bool is_being_placed)
9688 {
9689 m_IsBeingPlaced = is_being_placed;
9690 if (!is_being_placed)
9692 SetSynchDirty();
9693 }
9694
9695 //server-side
9696 void OnEndPlacement() {}
9697
9698 override bool IsHologram()
9699 {
9700 return m_IsHologram;
9701 }
9702
9703 bool CanBeDigged()
9704 {
9705 return m_CanBeDigged;
9706 }
9707
9709 {
9710 return 1;
9711 }
9712
9713 bool CanMakeGardenplot()
9714 {
9715 return false;
9716 }
9717
9718 void SetIsHologram(bool is_hologram)
9719 {
9720 m_IsHologram = is_hologram;
9721 SetSynchDirty();
9722 }
9723 /*
9724 protected float GetNutritionalEnergy()
9725 {
9726 Edible_Base edible = Edible_Base.Cast(this);
9727 return edible.GetFoodEnergy();
9728 }
9729
9730 protected float GetNutritionalWaterContent()
9731 {
9732 Edible_Base edible = Edible_Base.Cast(this);
9733 return edible.GetFoodWater();
9734 }
9735
9736 protected float GetNutritionalIndex()
9737 {
9738 Edible_Base edible = Edible_Base.Cast(this);
9739 return edible.GetFoodNutritionalIndex();
9740 }
9741
9742 protected float GetNutritionalFullnessIndex()
9743 {
9744 Edible_Base edible = Edible_Base.Cast(this);
9745 return edible.GetFoodTotalVolume();
9746 }
9747
9748 protected float GetNutritionalToxicity()
9749 {
9750 Edible_Base edible = Edible_Base.Cast(this);
9751 return edible.GetFoodToxicity();
9752
9753 }
9754 */
9755
9756
9757 // -------------------------------------------------------------------------
9758 override void OnMovedInsideCargo(EntityAI container)
9759 {
9760 super.OnMovedInsideCargo(container);
9761
9762 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9763 }
9764
9765 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9766 {
9767 super.EEItemLocationChanged(oldLoc,newLoc);
9768
9769 PlayerBase new_player = null;
9770 PlayerBase old_player = null;
9771
9772 if (newLoc.GetParent())
9773 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9774
9775 if (oldLoc.GetParent())
9776 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9777
9778 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9779 {
9780 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9781
9782 if (r_index >= 0)
9783 {
9784 InventoryLocation r_il = new InventoryLocation;
9785 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9786
9787 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9788 int r_type = r_il.GetType();
9789 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9790 {
9791 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9792 }
9793 else if (r_type == InventoryLocationType.ATTACHMENT)
9794 {
9795 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9796 }
9797
9798 }
9799 }
9800
9801 if (newLoc.GetType() == InventoryLocationType.HANDS)
9802 {
9803 if (new_player)
9804 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9805
9806 if (new_player == old_player)
9807 {
9808
9809 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9810 {
9811 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9812 {
9813 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9814 {
9815 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9816 }
9817 }
9818 else
9819 {
9820 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9821 }
9822 }
9823
9824 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9825 {
9826 int type = oldLoc.GetType();
9827 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9828 {
9829 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9830 }
9831 else if (type == InventoryLocationType.ATTACHMENT)
9832 {
9833 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9834 }
9835 }
9836 if (!m_OldLocation)
9837 {
9838 m_OldLocation = new InventoryLocation;
9839 }
9840 m_OldLocation.Copy(oldLoc);
9841 }
9842 else
9843 {
9844 if (m_OldLocation)
9845 {
9846 m_OldLocation.Reset();
9847 }
9848 }
9849
9851 }
9852 else
9853 {
9854 if (new_player)
9855 {
9856 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9857 if (res_index >= 0)
9858 {
9859 InventoryLocation il = new InventoryLocation;
9860 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9861 ItemBase it = ItemBase.Cast(il.GetItem());
9862 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9863 int rel_type = il.GetType();
9864 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9865 {
9866 il.GetParent().GetOnReleaseLock().Invoke(it);
9867 }
9868 else if (rel_type == InventoryLocationType.ATTACHMENT)
9869 {
9870 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9871 }
9872 //it.GetOnReleaseLock().Invoke(it);
9873 }
9874 }
9875 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9876 {
9877 //ThrowPhysically(old_player, vector.Zero);
9878 m_ThrowItemOnDrop = false;
9879 }
9880
9881 if (m_OldLocation)
9882 {
9883 m_OldLocation.Reset();
9884 }
9885 }
9886 }
9887
9888 override void EOnContact(IEntity other, Contact extra)
9889 {
9891 {
9892 int liquidType = -1;
9893 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9894 if (impactSpeed > 0.0)
9895 {
9896 m_ImpactSpeed = impactSpeed;
9897 #ifndef SERVER
9898 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9899 #else
9900 m_WantPlayImpactSound = true;
9901 SetSynchDirty();
9902 #endif
9903 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9904 }
9905 }
9906
9907 #ifdef SERVER
9908 if (GetCompEM() && GetCompEM().IsPlugged())
9909 {
9910 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9911 GetCompEM().UnplugThis();
9912 }
9913 #endif
9914 }
9915
9916 void RefreshPhysics();
9917
9918 override void OnCreatePhysics()
9919 {
9921 }
9922
9923 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9924 {
9925
9926 }
9927 // -------------------------------------------------------------------------
9928 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9929 {
9930 super.OnItemLocationChanged(old_owner, new_owner);
9931
9932 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9933 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9934
9935 if (!relatedPlayer && playerNew)
9936 relatedPlayer = playerNew;
9937
9938 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9939 {
9940 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9941 if (actionMgr)
9942 {
9943 ActionBase currentAction = actionMgr.GetRunningAction();
9944 if (currentAction)
9945 currentAction.OnItemLocationChanged(this);
9946 }
9947 }
9948
9949 Man ownerPlayerOld = null;
9950 Man ownerPlayerNew = null;
9951
9952 if (old_owner)
9953 {
9954 if (old_owner.IsMan())
9955 {
9956 ownerPlayerOld = Man.Cast(old_owner);
9957 }
9958 else
9959 {
9960 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9961 }
9962 }
9963 else
9964 {
9965 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9966 {
9967 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9968
9969 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9970 {
9971 GetCompEM().UnplugThis();
9972 }
9973 }
9974 }
9975
9976 if (new_owner)
9977 {
9978 if (new_owner.IsMan())
9979 {
9980 ownerPlayerNew = Man.Cast(new_owner);
9981 }
9982 else
9983 {
9984 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9985 }
9986 }
9987
9988 if (ownerPlayerOld != ownerPlayerNew)
9989 {
9990 if (ownerPlayerOld)
9991 {
9992 array<EntityAI> subItemsExit = new array<EntityAI>;
9993 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9994 for (int i = 0; i < subItemsExit.Count(); i++)
9995 {
9996 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9997 itemExit.OnInventoryExit(ownerPlayerOld);
9998 }
9999 }
10000
10001 if (ownerPlayerNew)
10002 {
10003 array<EntityAI> subItemsEnter = new array<EntityAI>;
10004 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10005 for (int j = 0; j < subItemsEnter.Count(); j++)
10006 {
10007 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10008 itemEnter.OnInventoryEnter(ownerPlayerNew);
10009 }
10010 }
10011 }
10012 else if (ownerPlayerNew != null)
10013 {
10014 PlayerBase nplayer;
10015 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10016 {
10017 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10018 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10019 for (int k = 0; k < subItemsUpdate.Count(); k++)
10020 {
10021 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10022 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10023 }
10024 }
10025 }
10026
10027 if (old_owner)
10028 old_owner.OnChildItemRemoved(this);
10029 if (new_owner)
10030 new_owner.OnChildItemReceived(this);
10031 }
10032
10033 // -------------------------------------------------------------------------------
10034 override void EEDelete(EntityAI parent)
10035 {
10036 super.EEDelete(parent);
10037 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10038 if (player)
10039 {
10040 OnInventoryExit(player);
10041
10042 if (player.IsAlive())
10043 {
10044 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10045 if (r_index >= 0)
10046 {
10047 InventoryLocation r_il = new InventoryLocation;
10048 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10049
10050 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10051 int r_type = r_il.GetType();
10052 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10053 {
10054 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10055 }
10056 else if (r_type == InventoryLocationType.ATTACHMENT)
10057 {
10058 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10059 }
10060
10061 }
10062
10063 player.RemoveQuickBarEntityShortcut(this);
10064 }
10065 }
10066 }
10067 // -------------------------------------------------------------------------------
10068 override void EEKilled(Object killer)
10069 {
10070 super.EEKilled(killer);
10071
10073 if (killer && killer.IsFireplace() && CanExplodeInFire())
10074 {
10075 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10076 {
10077 if (IsMagazine())
10078 {
10079 if (Magazine.Cast(this).GetAmmoCount() > 0)
10080 {
10081 ExplodeAmmo();
10082 }
10083 }
10084 else
10085 {
10086 Explode(DamageType.EXPLOSION);
10087 }
10088 }
10089 }
10090 }
10091
10092 override void OnWasAttached(EntityAI parent, int slot_id)
10093 {
10094 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10095
10096 super.OnWasAttached(parent, slot_id);
10097
10098 if (HasQuantity())
10099 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10100
10101 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10102 }
10103
10104 override void OnWasDetached(EntityAI parent, int slot_id)
10105 {
10106 super.OnWasDetached(parent, slot_id);
10107
10108 if (HasQuantity())
10109 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10110 }
10111
10112 override string ChangeIntoOnAttach(string slot)
10113 {
10114 int idx;
10115 TStringArray inventory_slots = new TStringArray;
10116 TStringArray attach_types = new TStringArray;
10117
10118 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10119 if (inventory_slots.Count() < 1) //is string
10120 {
10121 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10122 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10123 }
10124 else //is array
10125 {
10126 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10127 }
10128
10129 idx = inventory_slots.Find(slot);
10130 if (idx < 0)
10131 return "";
10132
10133 return attach_types.Get(idx);
10134 }
10135
10136 override string ChangeIntoOnDetach()
10137 {
10138 int idx = -1;
10139 string slot;
10140
10141 TStringArray inventory_slots = new TStringArray;
10142 TStringArray detach_types = new TStringArray;
10143
10144 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10145 if (inventory_slots.Count() < 1) //is string
10146 {
10147 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10148 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10149 }
10150 else //is array
10151 {
10152 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10153 if (detach_types.Count() < 1)
10154 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10155 }
10156
10157 for (int i = 0; i < inventory_slots.Count(); i++)
10158 {
10159 slot = inventory_slots.Get(i);
10160 }
10161
10162 if (slot != "")
10163 {
10164 if (detach_types.Count() == 1)
10165 idx = 0;
10166 else
10167 idx = inventory_slots.Find(slot);
10168 }
10169 if (idx < 0)
10170 return "";
10171
10172 return detach_types.Get(idx);
10173 }
10174
10175 void ExplodeAmmo()
10176 {
10177 //timer
10178 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10179
10180 //min/max time
10181 float min_time = 1;
10182 float max_time = 3;
10183 float delay = Math.RandomFloat(min_time, max_time);
10184
10185 explode_timer.Run(delay, this, "DoAmmoExplosion");
10186 }
10187
10188 void DoAmmoExplosion()
10189 {
10190 Magazine magazine = Magazine.Cast(this);
10191 int pop_sounds_count = 6;
10192 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10193
10194 //play sound
10195 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10196 string sound_name = pop_sounds[ sound_idx ];
10197 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10198
10199 //remove ammo count
10200 magazine.ServerAddAmmoCount(-1);
10201
10202 //if condition then repeat -> ExplodeAmmo
10203 float min_temp_to_explode = 100; //min temperature for item to explode
10204
10205 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10206 {
10207 ExplodeAmmo();
10208 }
10209 }
10210
10211 // -------------------------------------------------------------------------------
10212 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10213 {
10214 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10215
10216 const int CHANCE_DAMAGE_CARGO = 4;
10217 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10218 const int CHANCE_DAMAGE_NOTHING = 2;
10219
10220 if (IsClothing() || IsContainer() || IsItemTent())
10221 {
10222 float dmg = damageResult.GetDamage("","Health") * -0.5;
10223 int chances;
10224 int rnd;
10225
10226 if (GetInventory().GetCargo())
10227 {
10228 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10229 rnd = Math.RandomInt(0,chances);
10230
10231 if (rnd < CHANCE_DAMAGE_CARGO)
10232 {
10233 DamageItemInCargo(dmg);
10234 }
10235 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10236 {
10238 }
10239 }
10240 else
10241 {
10242 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10243 rnd = Math.RandomInt(0,chances);
10244
10245 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10246 {
10248 }
10249 }
10250 }
10251 }
10252
10253 bool DamageItemInCargo(float damage)
10254 {
10255 if (GetInventory().GetCargo())
10256 {
10257 int item_count = GetInventory().GetCargo().GetItemCount();
10258 if (item_count > 0)
10259 {
10260 int random_pick = Math.RandomInt(0, item_count);
10261 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10262 if (!item.IsExplosive())
10263 {
10264 item.AddHealth("","",damage);
10265 return true;
10266 }
10267 }
10268 }
10269 return false;
10270 }
10271
10272 bool DamageItemAttachments(float damage)
10273 {
10274 int attachment_count = GetInventory().AttachmentCount();
10275 if (attachment_count > 0)
10276 {
10277 int random_pick = Math.RandomInt(0, attachment_count);
10278 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10279 if (!attachment.IsExplosive())
10280 {
10281 attachment.AddHealth("","",damage);
10282 return true;
10283 }
10284 }
10285 return false;
10286 }
10287
10288 override bool IsSplitable()
10289 {
10290 return m_CanThisBeSplit;
10291 }
10292 //----------------
10293 override bool CanBeSplit()
10294 {
10295 if (IsSplitable() && (GetQuantity() > 1))
10296 return GetInventory().CanRemoveEntity();
10297
10298 return false;
10299 }
10300
10301 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10302 {
10303 if (!CanBeSplit())
10304 return;
10305
10306 if (GetGame().IsClient())
10307 {
10308 if (ScriptInputUserData.CanStoreInputUserData())
10309 {
10310 ScriptInputUserData ctx = new ScriptInputUserData;
10312 ctx.Write(1);
10313 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10314 ctx.Write(i1);
10315 ctx.Write(destination_entity);
10316 ctx.Write(true);
10317 ctx.Write(slot_id);
10318 ctx.Send();
10319 }
10320 }
10321 else if (!GetGame().IsMultiplayer())
10322 {
10323 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
10324 }
10325 }
10326
10327 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
10328 {
10329 if (!CanBeSplit())
10330 return;
10331
10332 float split_quantity_new;
10333 ref ItemBase new_item;
10334 float quantity = GetQuantity();
10335 float stack_max = GetTargetQuantityMax(slot_id);
10336 InventoryLocation loc = new InventoryLocation;
10337
10338 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10339 {
10340 if (stack_max <= GetQuantity())
10341 split_quantity_new = stack_max;
10342 else
10343 split_quantity_new = GetQuantity();
10344
10345 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10346 if (new_item)
10347 {
10348 new_item.SetResultOfSplit(true);
10349 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10350 AddQuantity(-split_quantity_new);
10351 new_item.SetQuantity(split_quantity_new);
10352 }
10353 }
10354 else if (destination_entity && slot_id == -1)
10355 {
10356 if (quantity > stack_max)
10357 split_quantity_new = stack_max;
10358 else
10359 split_quantity_new = quantity;
10360
10361 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10362 {
10363 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10364 new_item = ItemBase.Cast(o);
10365 }
10366
10367 if (new_item)
10368 {
10369 new_item.SetResultOfSplit(true);
10370 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10371 AddQuantity(-split_quantity_new);
10372 new_item.SetQuantity(split_quantity_new);
10373 }
10374 }
10375 else
10376 {
10377 if (stack_max != 0)
10378 {
10379 if (stack_max < GetQuantity())
10380 {
10381 split_quantity_new = GetQuantity() - stack_max;
10382 }
10383
10384 if (split_quantity_new == 0)
10385 {
10386 if (!GetGame().IsMultiplayer())
10387 player.PhysicalPredictiveDropItem(this);
10388 else
10389 player.ServerDropEntity(this);
10390 return;
10391 }
10392
10393 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10394
10395 if (new_item)
10396 {
10397 new_item.SetResultOfSplit(true);
10398 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10399 SetQuantity(split_quantity_new);
10400 new_item.SetQuantity(stack_max);
10401 new_item.PlaceOnSurface();
10402 }
10403 }
10404 }
10405 }
10406
10407 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10408 {
10409 if (!CanBeSplit())
10410 return;
10411
10412 float split_quantity_new;
10413 ref ItemBase new_item;
10414 float quantity = GetQuantity();
10415 float stack_max = GetTargetQuantityMax(slot_id);
10416 InventoryLocation loc = new InventoryLocation;
10417
10418 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10419 {
10420 if (stack_max <= GetQuantity())
10421 split_quantity_new = stack_max;
10422 else
10423 split_quantity_new = GetQuantity();
10424
10425 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10426 if (new_item)
10427 {
10428 new_item.SetResultOfSplit(true);
10429 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10430 AddQuantity(-split_quantity_new);
10431 new_item.SetQuantity(split_quantity_new);
10432 }
10433 }
10434 else if (destination_entity && slot_id == -1)
10435 {
10436 if (quantity > stack_max)
10437 split_quantity_new = stack_max;
10438 else
10439 split_quantity_new = quantity;
10440
10441 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10442 {
10443 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10444 new_item = ItemBase.Cast(o);
10445 }
10446
10447 if (new_item)
10448 {
10449 new_item.SetResultOfSplit(true);
10450 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10451 AddQuantity(-split_quantity_new);
10452 new_item.SetQuantity(split_quantity_new);
10453 }
10454 }
10455 else
10456 {
10457 if (stack_max != 0)
10458 {
10459 if (stack_max < GetQuantity())
10460 {
10461 split_quantity_new = GetQuantity() - stack_max;
10462 }
10463
10464 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10465
10466 if (new_item)
10467 {
10468 new_item.SetResultOfSplit(true);
10469 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10470 SetQuantity(split_quantity_new);
10471 new_item.SetQuantity(stack_max);
10472 new_item.PlaceOnSurface();
10473 }
10474 }
10475 }
10476 }
10477
10478 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10479 {
10480 if (!CanBeSplit())
10481 return;
10482
10483 if (GetGame().IsClient())
10484 {
10485 if (ScriptInputUserData.CanStoreInputUserData())
10486 {
10487 ScriptInputUserData ctx = new ScriptInputUserData;
10489 ctx.Write(4);
10490 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10491 ctx.Write(thiz);
10492 dst.WriteToContext(ctx);
10493 ctx.Send();
10494 }
10495 }
10496 else if (!GetGame().IsMultiplayer())
10497 {
10499 }
10500 }
10501
10502 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10503 {
10504 if (!CanBeSplit())
10505 return;
10506
10507 if (GetGame().IsClient())
10508 {
10509 if (ScriptInputUserData.CanStoreInputUserData())
10510 {
10511 ScriptInputUserData ctx = new ScriptInputUserData;
10513 ctx.Write(2);
10514 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10515 ctx.Write(dummy);
10516 ctx.Write(destination_entity);
10517 ctx.Write(true);
10518 ctx.Write(idx);
10519 ctx.Write(row);
10520 ctx.Write(col);
10521 ctx.Send();
10522 }
10523 }
10524 else if (!GetGame().IsMultiplayer())
10525 {
10526 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10527 }
10528 }
10529
10530 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10531 {
10533 }
10534
10535 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10536 {
10537 if (!CanBeSplit())
10538 return this;
10539
10540 float quantity = GetQuantity();
10541 float split_quantity_new;
10542 ItemBase new_item;
10543 if (dst.IsValid())
10544 {
10545 int slot_id = dst.GetSlot();
10546 float stack_max = GetTargetQuantityMax(slot_id);
10547
10548 if (quantity > stack_max)
10549 split_quantity_new = stack_max;
10550 else
10551 split_quantity_new = quantity;
10552
10553 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10554
10555 if (new_item)
10556 {
10557 new_item.SetResultOfSplit(true);
10558 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10559 AddQuantity(-split_quantity_new);
10560 new_item.SetQuantity(split_quantity_new);
10561 }
10562
10563 return new_item;
10564 }
10565
10566 return null;
10567 }
10568
10569 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10570 {
10571 if (!CanBeSplit())
10572 return;
10573
10574 float quantity = GetQuantity();
10575 float split_quantity_new;
10576 ref ItemBase new_item;
10577 if (destination_entity)
10578 {
10579 float stackable = GetTargetQuantityMax();
10580 if (quantity > stackable)
10581 split_quantity_new = stackable;
10582 else
10583 split_quantity_new = quantity;
10584
10585 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10586 if (new_item)
10587 {
10588 new_item.SetResultOfSplit(true);
10589 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10590 AddQuantity(-split_quantity_new);
10591 new_item.SetQuantity(split_quantity_new);
10592 }
10593 }
10594 }
10595
10596 void SplitIntoStackMaxHandsClient(PlayerBase player)
10597 {
10598 if (!CanBeSplit())
10599 return;
10600
10601 if (GetGame().IsClient())
10602 {
10603 if (ScriptInputUserData.CanStoreInputUserData())
10604 {
10605 ScriptInputUserData ctx = new ScriptInputUserData;
10607 ctx.Write(3);
10608 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10609 ctx.Write(i1);
10610 ItemBase destination_entity = this;
10611 ctx.Write(destination_entity);
10612 ctx.Write(true);
10613 ctx.Write(0);
10614 ctx.Send();
10615 }
10616 }
10617 else if (!GetGame().IsMultiplayer())
10618 {
10619 SplitIntoStackMaxHands(player);
10620 }
10621 }
10622
10623 void SplitIntoStackMaxHands(PlayerBase player)
10624 {
10625 if (!CanBeSplit())
10626 return;
10627
10628 float quantity = GetQuantity();
10629 float split_quantity_new;
10630 ref ItemBase new_item;
10631 if (player)
10632 {
10633 float stackable = GetTargetQuantityMax();
10634 if (quantity > stackable)
10635 split_quantity_new = stackable;
10636 else
10637 split_quantity_new = quantity;
10638
10639 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10640 new_item = ItemBase.Cast(in_hands);
10641 if (new_item)
10642 {
10643 new_item.SetResultOfSplit(true);
10644 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10645 AddQuantity(-split_quantity_new);
10646 new_item.SetQuantity(split_quantity_new);
10647 }
10648 }
10649 }
10650
10651 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10652 {
10653 if (!CanBeSplit())
10654 return;
10655
10656 float quantity = GetQuantity();
10657 float split_quantity_new = Math.Floor(quantity * 0.5);
10658
10659 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10660
10661 if (new_item)
10662 {
10663 if (new_item.GetQuantityMax() < split_quantity_new)
10664 {
10665 split_quantity_new = new_item.GetQuantityMax();
10666 }
10667
10668 new_item.SetResultOfSplit(true);
10669 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10670
10671 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10672 {
10673 AddQuantity(-1);
10674 new_item.SetQuantity(1);
10675 }
10676 else
10677 {
10678 AddQuantity(-split_quantity_new);
10679 new_item.SetQuantity(split_quantity_new);
10680 }
10681 }
10682 }
10683
10684 void SplitItem(PlayerBase player)
10685 {
10686 if (!CanBeSplit())
10687 return;
10688
10689 float quantity = GetQuantity();
10690 float split_quantity_new = Math.Floor(quantity / 2);
10691
10692 InventoryLocation invloc = new InventoryLocation;
10693 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10694
10695 ItemBase new_item;
10696 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10697
10698 if (new_item)
10699 {
10700 if (new_item.GetQuantityMax() < split_quantity_new)
10701 {
10702 split_quantity_new = new_item.GetQuantityMax();
10703 }
10704 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10705 {
10706 AddQuantity(-1);
10707 new_item.SetQuantity(1);
10708 }
10709 else
10710 {
10711 AddQuantity(-split_quantity_new);
10712 new_item.SetQuantity(split_quantity_new);
10713 }
10714 }
10715 }
10716
10718 void OnQuantityChanged(float delta)
10719 {
10720 SetWeightDirty();
10721 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10722
10723 if (parent)
10724 parent.OnAttachmentQuantityChangedEx(this, delta);
10725
10726 if (IsLiquidContainer())
10727 {
10728 if (GetQuantityNormalized() <= 0.0)
10729 {
10731 }
10732 else if (GetLiquidType() == LIQUID_NONE)
10733 {
10734 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10736 }
10737 }
10738
10739 }
10740
10743 {
10744 // insert code here
10745 }
10746
10748 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10749 {
10751 }
10752
10753 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10754 {
10755 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10756
10757 if (GetGame().IsServer())
10758 {
10759 if (newLevel == GameConstants.STATE_RUINED)
10760 {
10762 EntityAI parent = GetHierarchyParent();
10763 if (parent && parent.IsFireplace())
10764 {
10765 CargoBase cargo = GetInventory().GetCargo();
10766 if (cargo)
10767 {
10768 for (int i = 0; i < cargo.GetItemCount(); ++i)
10769 {
10770 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10771 }
10772 }
10773 }
10774 }
10775
10776 if (IsResultOfSplit())
10777 {
10778 // reset the splitting result flag, return to normal item behavior
10779 SetResultOfSplit(false);
10780 return;
10781 }
10782
10783 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10784 {
10785 SetCleanness(0);//unclean the item upon damage dealt
10786 }
10787 }
10788 }
10789
10790 // just the split? TODO: verify
10791 override void OnRightClick()
10792 {
10793 super.OnRightClick();
10794
10795 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10796 {
10797 if (GetGame().IsClient())
10798 {
10799 if (ScriptInputUserData.CanStoreInputUserData())
10800 {
10801 vector m4[4];
10802 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10803
10804 EntityAI root = GetHierarchyRoot();
10805
10806 InventoryLocation dst = new InventoryLocation;
10807 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10808 {
10809 if (root)
10810 {
10811 root.GetTransform(m4);
10812 dst.SetGround(this, m4);
10813 }
10814 else
10815 GetInventory().GetCurrentInventoryLocation(dst);
10816 }
10817 else
10818 {
10819 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10820 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10821 this shouldnt cause issues within this scope*/
10822 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10823 {
10824 if (root)
10825 {
10826 root.GetTransform(m4);
10827 dst.SetGround(this, m4);
10828 }
10829 else
10830 GetInventory().GetCurrentInventoryLocation(dst);
10831 }
10832 else
10833 {
10834 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10835 }
10836 }
10837
10838 ScriptInputUserData ctx = new ScriptInputUserData;
10840 ctx.Write(4);
10841 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10842 ctx.Write(thiz);
10843 dst.WriteToContext(ctx);
10844 ctx.Write(true); // dummy
10845 ctx.Send();
10846 }
10847 }
10848 else if (!GetGame().IsMultiplayer())
10849 {
10850 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10851 }
10852 }
10853 }
10854
10855 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10856 {
10857 //TODO: delete check zero quantity check after fix double posts hands fsm events
10858 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10859 return false;
10860
10861 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10862 return false;
10863
10864 //can_this_be_combined = ConfigGetBool("canBeSplit");
10866 return false;
10867
10868
10869 Magazine mag = Magazine.Cast(this);
10870 if (mag)
10871 {
10872 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10873 return false;
10874
10875 if (stack_max_limit)
10876 {
10877 Magazine other_mag = Magazine.Cast(other_item);
10878 if (other_item)
10879 {
10880 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10881 return false;
10882 }
10883
10884 }
10885 }
10886 else
10887 {
10888 //TODO: delete check zero quantity check after fix double posts hands fsm events
10889 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10890 return false;
10891
10892 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10893 return false;
10894 }
10895
10896 PlayerBase player = null;
10897 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10898 {
10899 if (player.GetInventory().HasAttachment(this))
10900 return false;
10901
10902 if (player.IsItemsToDelete())
10903 return false;
10904 }
10905
10906 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10907 return false;
10908
10909 int slotID;
10910 string slotName;
10911 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10912 return false;
10913
10914 return true;
10915 }
10916
10917 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10918 {
10919 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10920 }
10921
10922 bool IsResultOfSplit()
10923 {
10924 return m_IsResultOfSplit;
10925 }
10926
10927 void SetResultOfSplit(bool value)
10928 {
10929 m_IsResultOfSplit = value;
10930 }
10931
10932 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10933 {
10934 return ComputeQuantityUsedEx(other_item, use_stack_max);
10935 }
10936
10937 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10938 {
10939 float other_item_quantity = other_item.GetQuantity();
10940 float this_free_space;
10941
10942 float stack_max = GetQuantityMax();
10943
10944 this_free_space = stack_max - GetQuantity();
10945
10946 if (other_item_quantity > this_free_space)
10947 {
10948 return this_free_space;
10949 }
10950 else
10951 {
10952 return other_item_quantity;
10953 }
10954 }
10955
10956 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10957 {
10958 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10959 }
10960
10961 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10962 {
10963 if (!CanBeCombined(other_item, false))
10964 return;
10965
10966 if (!IsMagazine() && other_item)
10967 {
10968 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10969 if (quantity_used != 0)
10970 {
10971 float hp1 = GetHealth01("","");
10972 float hp2 = other_item.GetHealth01("","");
10973 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10974 hpResult = hpResult / (GetQuantity() + quantity_used);
10975
10976 hpResult *= GetMaxHealth();
10977 Math.Round(hpResult);
10978 SetHealth("", "Health", hpResult);
10979
10980 AddQuantity(quantity_used);
10981 other_item.AddQuantity(-quantity_used);
10982 }
10983 }
10984 OnCombine(other_item);
10985 }
10986
10987 void OnCombine(ItemBase other_item)
10988 {
10989 #ifdef SERVER
10990 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10991 GetHierarchyParent().IncreaseLifetimeUp();
10992 #endif
10993 };
10994
10995 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10996 {
10997 PlayerBase p = PlayerBase.Cast(player);
10998
10999 array<int> recipesIds = p.m_Recipes;
11000 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11001 if (moduleRecipesManager)
11002 {
11003 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11004 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11005 }
11006
11007 for (int i = 0;i < recipesIds.Count(); i++)
11008 {
11009 int key = recipesIds.Get(i);
11010 string recipeName = moduleRecipesManager.GetRecipeName(key);
11011 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11012 }
11013 }
11014
11015 // -------------------------------------------------------------------------
11016 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11017 {
11018 super.GetDebugActions(outputList);
11019
11020 //quantity
11021 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11022 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11023 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11024 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11025
11026 //health
11027 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11028 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11029 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11030 //temperature
11031 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11032 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11033 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11034
11035 //wet
11036 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11037 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11038
11039 //liquidtype
11040 if (IsLiquidContainer())
11041 {
11042 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11043 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11044 }
11045
11046 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11047 // watch
11048 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11049 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11050
11051 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11052 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11053 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11054 }
11055
11056 // -------------------------------------------------------------------------
11057 // -------------------------------------------------------------------------
11058 // -------------------------------------------------------------------------
11059 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11060 {
11061 super.OnAction(action_id, player, ctx);
11062 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11063 {
11064 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11065 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11066 PlayerBase p = PlayerBase.Cast(player);
11067 if (EActions.RECIPES_RANGE_START < 1000)
11068 {
11069 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11070 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11071 }
11072 }
11073 #ifndef SERVER
11074 else if (action_id == EActions.WATCH_PLAYER)
11075 {
11076 PluginDeveloper.SetDeveloperItemClientEx(player);
11077 }
11078 #endif
11079 if (GetGame().IsServer())
11080 {
11081 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11082 {
11083 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11084 OnDebugButtonPressServer(id + 1);
11085 }
11086
11087 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11088 {
11089 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11090 InsertAgent(agent_id,100);
11091 }
11092
11093 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11094 {
11095 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11096 RemoveAgent(agent_id2);
11097 }
11098
11099 else if (action_id == EActions.ADD_QUANTITY)
11100 {
11101 if (IsMagazine())
11102 {
11103 Magazine mag = Magazine.Cast(this);
11104 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11105 }
11106 else
11107 {
11108 AddQuantity(GetQuantityMax() * 0.2);
11109 }
11110
11111 if (m_EM)
11112 {
11113 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11114 }
11115 //PrintVariables();
11116 }
11117
11118 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11119 {
11120 if (IsMagazine())
11121 {
11122 Magazine mag2 = Magazine.Cast(this);
11123 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11124 }
11125 else
11126 {
11127 AddQuantity(- GetQuantityMax() * 0.2);
11128 }
11129 if (m_EM)
11130 {
11131 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11132 }
11133 //PrintVariables();
11134 }
11135
11136 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11137 {
11138 SetQuantity(0);
11139
11140 if (m_EM)
11141 {
11142 m_EM.SetEnergy(0);
11143 }
11144 }
11145
11146 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11147 {
11149
11150 if (m_EM)
11151 {
11152 m_EM.SetEnergy(m_EM.GetEnergyMax());
11153 }
11154 }
11155
11156 else if (action_id == EActions.ADD_HEALTH)
11157 {
11158 AddHealth("","",GetMaxHealth("","Health")/5);
11159 }
11160 else if (action_id == EActions.REMOVE_HEALTH)
11161 {
11162 AddHealth("","",-GetMaxHealth("","Health")/5);
11163 }
11164 else if (action_id == EActions.DESTROY_HEALTH)
11165 {
11166 SetHealth01("","",0);
11167 }
11168 else if (action_id == EActions.WATCH_ITEM)
11169 {
11171 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11172 #ifdef DEVELOPER
11173 SetDebugDeveloper_item(this);
11174 #endif
11175 }
11176
11177 else if (action_id == EActions.ADD_TEMPERATURE)
11178 {
11179 AddTemperature(20);
11180 //PrintVariables();
11181 }
11182
11183 else if (action_id == EActions.REMOVE_TEMPERATURE)
11184 {
11185 AddTemperature(-20);
11186 //PrintVariables();
11187 }
11188
11189 else if (action_id == EActions.FLIP_FROZEN)
11190 {
11191 SetFrozen(!GetIsFrozen());
11192 //PrintVariables();
11193 }
11194
11195 else if (action_id == EActions.ADD_WETNESS)
11196 {
11197 AddWet(GetWetMax()/5);
11198 //PrintVariables();
11199 }
11200
11201 else if (action_id == EActions.REMOVE_WETNESS)
11202 {
11203 AddWet(-GetWetMax()/5);
11204 //PrintVariables();
11205 }
11206
11207 else if (action_id == EActions.LIQUIDTYPE_UP)
11208 {
11209 int curr_type = GetLiquidType();
11210 SetLiquidType(curr_type * 2);
11211 //AddWet(1);
11212 //PrintVariables();
11213 }
11214
11215 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11216 {
11217 int curr_type2 = GetLiquidType();
11218 SetLiquidType(curr_type2 / 2);
11219 }
11220
11221 else if (action_id == EActions.MAKE_SPECIAL)
11222 {
11223 auto debugParams = DebugSpawnParams.WithPlayer(player);
11224 OnDebugSpawnEx(debugParams);
11225 }
11226
11227 else if (action_id == EActions.DELETE)
11228 {
11229 Delete();
11230 }
11231
11232 }
11233
11234
11235 return false;
11236 }
11237
11238 // -------------------------------------------------------------------------
11239
11240
11243 void OnActivatedByTripWire();
11244
11246 void OnActivatedByItem(notnull ItemBase item);
11247
11248 //----------------------------------------------------------------
11249 //returns true if item is able to explode when put in fire
11250 bool CanExplodeInFire()
11251 {
11252 return false;
11253 }
11254
11255 //----------------------------------------------------------------
11256 bool CanEat()
11257 {
11258 return true;
11259 }
11260
11261 //----------------------------------------------------------------
11262 override bool IsIgnoredByConstruction()
11263 {
11264 return true;
11265 }
11266
11267 //----------------------------------------------------------------
11268 //has FoodStages in config?
11269 bool HasFoodStage()
11270 {
11271 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11272 return GetGame().ConfigIsExisting(config_path);
11273 }
11274
11276 FoodStage GetFoodStage()
11277 {
11278 return null;
11279 }
11280
11281 bool CanBeCooked()
11282 {
11283 return false;
11284 }
11285
11286 bool CanBeCookedOnStick()
11287 {
11288 return false;
11289 }
11290
11292 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11294
11295 //----------------------------------------------------------------
11296 bool CanRepair(ItemBase item_repair_kit)
11297 {
11298 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11299 return module_repairing.CanRepair(this, item_repair_kit);
11300 }
11301
11302 //----------------------------------------------------------------
11303 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11304 {
11305 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11306 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11307 }
11308
11309 //----------------------------------------------------------------
11310 int GetItemSize()
11311 {
11312 /*
11313 vector v_size = this.ConfigGetVector("itemSize");
11314 int v_size_x = v_size[0];
11315 int v_size_y = v_size[1];
11316 int size = v_size_x * v_size_y;
11317 return size;
11318 */
11319
11320 return 1;
11321 }
11322
11323 //----------------------------------------------------------------
11324 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11325 bool CanBeMovedOverride()
11326 {
11327 return m_CanBeMovedOverride;
11328 }
11329
11330 //----------------------------------------------------------------
11331 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11332 void SetCanBeMovedOverride(bool setting)
11333 {
11334 m_CanBeMovedOverride = setting;
11335 }
11336
11337 //----------------------------------------------------------------
11345 void MessageToOwnerStatus(string text)
11346 {
11347 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11348
11349 if (player)
11350 {
11351 player.MessageStatus(text);
11352 }
11353 }
11354
11355 //----------------------------------------------------------------
11363 void MessageToOwnerAction(string text)
11364 {
11365 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11366
11367 if (player)
11368 {
11369 player.MessageAction(text);
11370 }
11371 }
11372
11373 //----------------------------------------------------------------
11381 void MessageToOwnerFriendly(string text)
11382 {
11383 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11384
11385 if (player)
11386 {
11387 player.MessageFriendly(text);
11388 }
11389 }
11390
11391 //----------------------------------------------------------------
11399 void MessageToOwnerImportant(string text)
11400 {
11401 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11402
11403 if (player)
11404 {
11405 player.MessageImportant(text);
11406 }
11407 }
11408
11409 override bool IsItemBase()
11410 {
11411 return true;
11412 }
11413
11414 // Checks if item is of questioned kind
11415 override bool KindOf(string tag)
11416 {
11417 bool found = false;
11418 string item_name = this.GetType();
11419 ref TStringArray item_tag_array = new TStringArray;
11420 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11421
11422 int array_size = item_tag_array.Count();
11423 for (int i = 0; i < array_size; i++)
11424 {
11425 if (item_tag_array.Get(i) == tag)
11426 {
11427 found = true;
11428 break;
11429 }
11430 }
11431 return found;
11432 }
11433
11434
11435 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11436 {
11437 //Debug.Log("OnRPC called");
11438 super.OnRPC(sender, rpc_type,ctx);
11439
11440 //Play soundset for attachment locking (ActionLockAttachment.c)
11441 switch (rpc_type)
11442 {
11443 #ifndef SERVER
11444 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11445 Param2<bool, string> p = new Param2<bool, string>(false, "");
11446
11447 if (!ctx.Read(p))
11448 return;
11449
11450 bool play = p.param1;
11451 string soundSet = p.param2;
11452
11453 if (play)
11454 {
11455 if (m_LockingSound)
11456 {
11458 {
11459 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11460 }
11461 }
11462 else
11463 {
11464 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11465 }
11466 }
11467 else
11468 {
11469 SEffectManager.DestroyEffect(m_LockingSound);
11470 }
11471
11472 break;
11473 #endif
11474
11475 }
11476
11477 if (GetWrittenNoteData())
11478 {
11479 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11480 }
11481 }
11482
11483 //-----------------------------
11484 // VARIABLE MANIPULATION SYSTEM
11485 //-----------------------------
11486 int NameToID(string name)
11487 {
11488 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11489 return plugin.GetID(name);
11490 }
11491
11492 string IDToName(int id)
11493 {
11494 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11495 return plugin.GetName(id);
11496 }
11497
11499 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11500 {
11501 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11502 //read the flags
11503 int varFlags;
11504 if (!ctx.Read(varFlags))
11505 return;
11506
11507 if (varFlags & ItemVariableFlags.FLOAT)
11508 {
11509 ReadVarsFromCTX(ctx);
11510 }
11511 }
11512
11513 override void SerializeNumericalVars(array<float> floats_out)
11514 {
11515 //some variables handled on EntityAI level already!
11516 super.SerializeNumericalVars(floats_out);
11517
11518 // the order of serialization must be the same as the order of de-serialization
11519 //--------------------------------------------
11520 if (IsVariableSet(VARIABLE_QUANTITY))
11521 {
11522 floats_out.Insert(m_VarQuantity);
11523 }
11524 //--------------------------------------------
11525 if (IsVariableSet(VARIABLE_WET))
11526 {
11527 floats_out.Insert(m_VarWet);
11528 }
11529 //--------------------------------------------
11530 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11531 {
11532 floats_out.Insert(m_VarLiquidType);
11533 }
11534 //--------------------------------------------
11535 if (IsVariableSet(VARIABLE_COLOR))
11536 {
11537 floats_out.Insert(m_ColorComponentR);
11538 floats_out.Insert(m_ColorComponentG);
11539 floats_out.Insert(m_ColorComponentB);
11540 floats_out.Insert(m_ColorComponentA);
11541 }
11542 //--------------------------------------------
11543 if (IsVariableSet(VARIABLE_CLEANNESS))
11544 {
11545 floats_out.Insert(m_Cleanness);
11546 }
11547 }
11548
11549 override void DeSerializeNumericalVars(array<float> floats)
11550 {
11551 //some variables handled on EntityAI level already!
11552 super.DeSerializeNumericalVars(floats);
11553
11554 // the order of serialization must be the same as the order of de-serialization
11555 int index = 0;
11556 int mask = Math.Round(floats.Get(index));
11557
11558 index++;
11559 //--------------------------------------------
11560 if (mask & VARIABLE_QUANTITY)
11561 {
11562 if (m_IsStoreLoad)
11563 {
11564 SetStoreLoadedQuantity(floats.Get(index));
11565 }
11566 else
11567 {
11568 float quantity = floats.Get(index);
11569 SetQuantity(quantity, true, false, false, false);
11570 }
11571 index++;
11572 }
11573 //--------------------------------------------
11574 if (mask & VARIABLE_WET)
11575 {
11576 float wet = floats.Get(index);
11577 SetWet(wet);
11578 index++;
11579 }
11580 //--------------------------------------------
11581 if (mask & VARIABLE_LIQUIDTYPE)
11582 {
11583 int liquidtype = Math.Round(floats.Get(index));
11584 SetLiquidType(liquidtype);
11585 index++;
11586 }
11587 //--------------------------------------------
11588 if (mask & VARIABLE_COLOR)
11589 {
11590 m_ColorComponentR = Math.Round(floats.Get(index));
11591 index++;
11592 m_ColorComponentG = Math.Round(floats.Get(index));
11593 index++;
11594 m_ColorComponentB = Math.Round(floats.Get(index));
11595 index++;
11596 m_ColorComponentA = Math.Round(floats.Get(index));
11597 index++;
11598 }
11599 //--------------------------------------------
11600 if (mask & VARIABLE_CLEANNESS)
11601 {
11602 int cleanness = Math.Round(floats.Get(index));
11603 SetCleanness(cleanness);
11604 index++;
11605 }
11606 }
11607
11608 override void WriteVarsToCTX(ParamsWriteContext ctx)
11609 {
11610 super.WriteVarsToCTX(ctx);
11611
11612 //--------------------------------------------
11613 if (IsVariableSet(VARIABLE_QUANTITY))
11614 {
11615 ctx.Write(GetQuantity());
11616 }
11617 //--------------------------------------------
11618 if (IsVariableSet(VARIABLE_WET))
11619 {
11620 ctx.Write(GetWet());
11621 }
11622 //--------------------------------------------
11623 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11624 {
11625 ctx.Write(GetLiquidType());
11626 }
11627 //--------------------------------------------
11628 if (IsVariableSet(VARIABLE_COLOR))
11629 {
11630 int r,g,b,a;
11631 GetColor(r,g,b,a);
11632 ctx.Write(r);
11633 ctx.Write(g);
11634 ctx.Write(b);
11635 ctx.Write(a);
11636 }
11637 //--------------------------------------------
11638 if (IsVariableSet(VARIABLE_CLEANNESS))
11639 {
11640 ctx.Write(GetCleanness());
11641 }
11642 }
11643
11644 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11645 {
11646 if (!super.ReadVarsFromCTX(ctx,version))
11647 return false;
11648
11649 int intValue;
11650 float value;
11651
11652 if (version < 140)
11653 {
11654 if (!ctx.Read(intValue))
11655 return false;
11656
11657 m_VariablesMask = intValue;
11658 }
11659
11660 if (m_VariablesMask & VARIABLE_QUANTITY)
11661 {
11662 if (!ctx.Read(value))
11663 return false;
11664
11665 if (IsStoreLoad())
11666 {
11668 }
11669 else
11670 {
11671 SetQuantity(value, true, false, false, false);
11672 }
11673 }
11674 //--------------------------------------------
11675 if (version < 140)
11676 {
11677 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11678 {
11679 if (!ctx.Read(value))
11680 return false;
11681 SetTemperatureDirect(value);
11682 }
11683 }
11684 //--------------------------------------------
11685 if (m_VariablesMask & VARIABLE_WET)
11686 {
11687 if (!ctx.Read(value))
11688 return false;
11689 SetWet(value);
11690 }
11691 //--------------------------------------------
11692 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11693 {
11694 if (!ctx.Read(intValue))
11695 return false;
11696 SetLiquidType(intValue);
11697 }
11698 //--------------------------------------------
11699 if (m_VariablesMask & VARIABLE_COLOR)
11700 {
11701 int r,g,b,a;
11702 if (!ctx.Read(r))
11703 return false;
11704 if (!ctx.Read(g))
11705 return false;
11706 if (!ctx.Read(b))
11707 return false;
11708 if (!ctx.Read(a))
11709 return false;
11710
11711 SetColor(r,g,b,a);
11712 }
11713 //--------------------------------------------
11714 if (m_VariablesMask & VARIABLE_CLEANNESS)
11715 {
11716 if (!ctx.Read(intValue))
11717 return false;
11718 SetCleanness(intValue);
11719 }
11720 //--------------------------------------------
11721 if (version >= 138 && version < 140)
11722 {
11723 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11724 {
11725 if (!ctx.Read(intValue))
11726 return false;
11727 SetFrozen(intValue);
11728 }
11729 }
11730
11731 return true;
11732 }
11733
11734 //----------------------------------------------------------------
11735 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11736 {
11737 m_IsStoreLoad = true;
11739 {
11740 m_FixDamageSystemInit = true;
11741 }
11742
11743 if (!super.OnStoreLoad(ctx, version))
11744 {
11745 m_IsStoreLoad = false;
11746 return false;
11747 }
11748
11749 if (version >= 114)
11750 {
11751 bool hasQuickBarIndexSaved;
11752
11753 if (!ctx.Read(hasQuickBarIndexSaved))
11754 {
11755 m_IsStoreLoad = false;
11756 return false;
11757 }
11758
11759 if (hasQuickBarIndexSaved)
11760 {
11761 int itmQBIndex;
11762
11763 //Load quickbar item bind
11764 if (!ctx.Read(itmQBIndex))
11765 {
11766 m_IsStoreLoad = false;
11767 return false;
11768 }
11769
11770 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11771 if (itmQBIndex != -1 && parentPlayer)
11772 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11773 }
11774 }
11775 else
11776 {
11777 // Backup of how it used to be
11778 PlayerBase player;
11779 int itemQBIndex;
11780 if (version == int.MAX)
11781 {
11782 if (!ctx.Read(itemQBIndex))
11783 {
11784 m_IsStoreLoad = false;
11785 return false;
11786 }
11787 }
11788 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11789 {
11790 //Load quickbar item bind
11791 if (!ctx.Read(itemQBIndex))
11792 {
11793 m_IsStoreLoad = false;
11794 return false;
11795 }
11796 if (itemQBIndex != -1 && player)
11797 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11798 }
11799 }
11800
11801 if (version < 140)
11802 {
11803 // variable management system
11804 if (!LoadVariables(ctx, version))
11805 {
11806 m_IsStoreLoad = false;
11807 return false;
11808 }
11809 }
11810
11811 //agent trasmission system
11812 if (!LoadAgents(ctx, version))
11813 {
11814 m_IsStoreLoad = false;
11815 return false;
11816 }
11817 if (version >= 132)
11818 {
11819 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11820 if (raib)
11821 {
11822 if (!raib.OnStoreLoad(ctx,version))
11823 {
11824 m_IsStoreLoad = false;
11825 return false;
11826 }
11827 }
11828 }
11829
11830 m_IsStoreLoad = false;
11831 return true;
11832 }
11833
11834 //----------------------------------------------------------------
11835
11836 override void OnStoreSave(ParamsWriteContext ctx)
11837 {
11838 super.OnStoreSave(ctx);
11839
11840 PlayerBase player;
11841 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11842 {
11843 ctx.Write(true); // Keep track of if we should actually read this in or not
11844 //Save quickbar item bind
11845 int itemQBIndex = -1;
11846 itemQBIndex = player.FindQuickBarEntityIndex(this);
11847 ctx.Write(itemQBIndex);
11848 }
11849 else
11850 {
11851 ctx.Write(false); // Keep track of if we should actually read this in or not
11852 }
11853
11854 SaveAgents(ctx);//agent trasmission system
11855
11856 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11857 if (raib)
11858 {
11859 raib.OnStoreSave(ctx);
11860 }
11861 }
11862 //----------------------------------------------------------------
11863
11864 override void AfterStoreLoad()
11865 {
11866 super.AfterStoreLoad();
11867
11869 {
11871 }
11872
11873 if (GetStoreLoadedQuantity() != float.LOWEST)
11874 {
11876 SetStoreLoadedQuantity(float.LOWEST);//IMPORTANT to do this !! we use 'm_StoreLoadedQuantity' inside SetQuantity to distinguish between initial quantity setting and the consequent(normal gameplay) calls
11877 }
11878 }
11879
11880 override void EEOnAfterLoad()
11881 {
11882 super.EEOnAfterLoad();
11883
11885 {
11886 m_FixDamageSystemInit = false;
11887 }
11888
11891 }
11892
11893 bool CanBeDisinfected()
11894 {
11895 return false;
11896 }
11897
11898
11899 //----------------------------------------------------------------
11900 override void OnVariablesSynchronized()
11901 {
11902 if (m_Initialized)
11903 {
11904 #ifdef PLATFORM_CONSOLE
11905 //bruteforce it is
11906 if (IsSplitable())
11907 {
11908 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11909 if (menu)
11910 {
11911 menu.Refresh();
11912 }
11913 }
11914 #endif
11915 }
11916
11918 {
11919 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11920 m_WantPlayImpactSound = false;
11921 }
11922
11924 {
11925 SetWeightDirty();
11927 }
11928 if (m_VarWet != m_VarWetPrev)
11929 {
11932 }
11933
11934 if (m_SoundSyncPlay != 0)
11935 {
11936 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11937 m_SoundSyncPlay = 0;
11938 }
11939 if (m_SoundSyncStop != 0)
11940 {
11941 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11942 m_SoundSyncStop = 0;
11943 }
11944
11945 super.OnVariablesSynchronized();
11946 }
11947
11948 //------------------------- Quantity
11949 //----------------------------------------------------------------
11951 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11952 {
11953 if (!IsServerCheck(allow_client))
11954 return false;
11955
11956 if (!HasQuantity())
11957 return false;
11958
11959 float min = GetQuantityMin();
11960 float max = GetQuantityMax();
11961
11962 if (value <= (min + 0.001))
11963 value = min;
11964
11965 if (value == min)
11966 {
11967 if (destroy_config)
11968 {
11969 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11970 if (dstr)
11971 {
11972 m_VarQuantity = Math.Clamp(value, min, max);
11973 this.Delete();
11974 return true;
11975 }
11976 }
11977 else if (destroy_forced)
11978 {
11979 m_VarQuantity = Math.Clamp(value, min, max);
11980 this.Delete();
11981 return true;
11982 }
11983 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11984 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11985 }
11986
11987 float delta = m_VarQuantity;
11988 m_VarQuantity = Math.Clamp(value, min, max);
11989
11990 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11991 {
11992 delta = m_VarQuantity - delta;
11993
11994 if (delta)
11995 OnQuantityChanged(delta);
11996 }
11997
11998 SetVariableMask(VARIABLE_QUANTITY);
11999
12000 return false;
12001 }
12002
12003 //----------------------------------------------------------------
12005 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12006 {
12007 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12008 }
12009 //----------------------------------------------------------------
12010 void SetQuantityMax()
12011 {
12012 float max = GetQuantityMax();
12013 SetQuantity(max);
12014 }
12015
12016 override void SetQuantityToMinimum()
12017 {
12018 float min = GetQuantityMin();
12019 SetQuantity(min);
12020 }
12021 //----------------------------------------------------------------
12023 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12024 {
12025 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12026 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12027 SetQuantity(result, destroy_config, destroy_forced);
12028 }
12029
12030 //----------------------------------------------------------------
12032 override float GetQuantityNormalized()
12033 {
12034 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12035 }
12036
12038 {
12039 return GetQuantityNormalized();
12040 }
12041
12042 /*void SetAmmoNormalized(float value)
12043 {
12044 float value_clamped = Math.Clamp(value, 0, 1);
12045 Magazine this_mag = Magazine.Cast(this);
12046 int max_rounds = this_mag.GetAmmoMax();
12047 int result = value * max_rounds;//can the rounded if higher precision is required
12048 this_mag.SetAmmoCount(result);
12049 }*/
12050 //----------------------------------------------------------------
12051 override int GetQuantityMax()
12052 {
12053 int slot = -1;
12054 if (GetInventory())
12055 {
12056 InventoryLocation il = new InventoryLocation;
12057 GetInventory().GetCurrentInventoryLocation(il);
12058 slot = il.GetSlot();
12059 }
12060
12061 return GetTargetQuantityMax(slot);
12062 }
12063
12064 override int GetTargetQuantityMax(int attSlotID = -1)
12065 {
12066 float quantity_max = 0;
12067
12068 if (IsSplitable()) //only stackable/splitable items can check for stack size
12069 {
12070 if (attSlotID != -1)
12071 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12072
12073 if (quantity_max <= 0)
12074 quantity_max = m_VarStackMax;
12075 }
12076
12077 if (quantity_max <= 0)
12078 quantity_max = m_VarQuantityMax;
12079
12080 return quantity_max;
12081 }
12082 //----------------------------------------------------------------
12083 override int GetQuantityMin()
12084 {
12085 return m_VarQuantityMin;
12086 }
12087 //----------------------------------------------------------------
12088 int GetQuantityInit()
12089 {
12090 return m_VarQuantityInit;
12091 }
12092
12093 //----------------------------------------------------------------
12094 override bool HasQuantity()
12095 {
12096 return !(GetQuantityMax() - GetQuantityMin() == 0);
12097 }
12098
12099 override float GetQuantity()
12100 {
12101 return m_VarQuantity;
12102 }
12103
12104 bool IsFullQuantity()
12105 {
12106 return GetQuantity() >= GetQuantityMax();
12107 }
12108
12109 //Calculates weight of single item without attachments and cargo
12110 override float GetSingleInventoryItemWeightEx()
12111 {
12112 //this needs to be first stored inside local variables, when returned directly during inside return call, the result is completely different due to enforce script bug
12113 float weightEx = GetWeightEx();//overall weight of the item
12114 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12115 return weightEx - special;
12116 }
12117
12118 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12120 {
12122 }
12123
12124 override protected float GetWeightSpecialized(bool forceRecalc = false)
12125 {
12126 if (IsSplitable()) //quantity determines size of the stack
12127 {
12128 #ifdef DEVELOPER
12129 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12130 {
12131 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12132 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12133 }
12134 #endif
12135
12136 return GetQuantity() * GetConfigWeightModified();
12137 }
12138 else if (HasEnergyManager())// items with energy manager
12139 {
12140 #ifdef DEVELOPER
12141 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12142 {
12143 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12144 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12145 }
12146 #endif
12147 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12148 }
12149 else//everything else
12150 {
12151 #ifdef DEVELOPER
12152 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12153 {
12154 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12155 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12156 }
12157 #endif
12158 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12159 }
12160 }
12161
12163 int GetNumberOfItems()
12164 {
12165 int item_count = 0;
12166 ItemBase item;
12167
12168 if (GetInventory().GetCargo() != NULL)
12169 {
12170 item_count = GetInventory().GetCargo().GetItemCount();
12171 }
12172
12173 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12174 {
12175 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12176 if (item)
12177 item_count += item.GetNumberOfItems();
12178 }
12179 return item_count;
12180 }
12181
12183 float GetUnitWeight(bool include_wetness = true)
12184 {
12185 float weight = 0;
12186 float wetness = 1;
12187 if (include_wetness)
12188 wetness += GetWet();
12189 if (IsSplitable()) //quantity determines size of the stack
12190 {
12191 weight = wetness * m_ConfigWeight;
12192 }
12193 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12194 {
12195 weight = 1;
12196 }
12197 return weight;
12198 }
12199
12200 //-----------------------------------------------------------------
12201
12202 override void ClearInventory()
12203 {
12204 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12205 {
12206 GameInventory inv = GetInventory();
12207 array<EntityAI> items = new array<EntityAI>;
12208 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12209 for (int i = 0; i < items.Count(); i++)
12210 {
12211 ItemBase item = ItemBase.Cast(items.Get(i));
12212 if (item)
12213 {
12214 GetGame().ObjectDelete(item);
12215 }
12216 }
12217 }
12218 }
12219
12220 //------------------------- Energy
12221
12222 //----------------------------------------------------------------
12223 float GetEnergy()
12224 {
12225 float energy = 0;
12226 if (HasEnergyManager())
12227 {
12228 energy = GetCompEM().GetEnergy();
12229 }
12230 return energy;
12231 }
12232
12233
12234 override void OnEnergyConsumed()
12235 {
12236 super.OnEnergyConsumed();
12237
12239 }
12240
12241 override void OnEnergyAdded()
12242 {
12243 super.OnEnergyAdded();
12244
12246 }
12247
12248 // Converts energy (from Energy Manager) to quantity, if enabled.
12250 {
12251 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12252 {
12253 if (HasQuantity())
12254 {
12255 float energy_0to1 = GetCompEM().GetEnergy0To1();
12256 SetQuantityNormalized(energy_0to1);
12257 }
12258 }
12259 }
12260
12261 //----------------------------------------------------------------
12262 float GetHeatIsolationInit()
12263 {
12264 return ConfigGetFloat("heatIsolation");
12265 }
12266
12267 float GetHeatIsolation()
12268 {
12269 return m_HeatIsolation;
12270 }
12271
12272 float GetDryingIncrement(string pIncrementName)
12273 {
12274 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12275 if (GetGame().ConfigIsExisting(paramPath))
12276 return GetGame().ConfigGetFloat(paramPath);
12277
12278 return 0.0;
12279 }
12280
12281 float GetSoakingIncrement(string pIncrementName)
12282 {
12283 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12284 if (GetGame().ConfigIsExisting(paramPath))
12285 return GetGame().ConfigGetFloat(paramPath);
12286
12287 return 0.0;
12288 }
12289 //----------------------------------------------------------------
12290 override void SetWet(float value, bool allow_client = false)
12291 {
12292 if (!IsServerCheck(allow_client))
12293 return;
12294
12295 float min = GetWetMin();
12296 float max = GetWetMax();
12297
12298 float previousValue = m_VarWet;
12299
12300 m_VarWet = Math.Clamp(value, min, max);
12301
12302 if (previousValue != m_VarWet)
12303 {
12304 SetVariableMask(VARIABLE_WET);
12305 OnWetChanged(m_VarWet, previousValue);
12306 }
12307 }
12308 //----------------------------------------------------------------
12309 override void AddWet(float value)
12310 {
12311 SetWet(GetWet() + value);
12312 }
12313 //----------------------------------------------------------------
12314 override void SetWetMax()
12315 {
12317 }
12318 //----------------------------------------------------------------
12319 override float GetWet()
12320 {
12321 return m_VarWet;
12322 }
12323 //----------------------------------------------------------------
12324 override float GetWetMax()
12325 {
12326 return m_VarWetMax;
12327 }
12328 //----------------------------------------------------------------
12329 override float GetWetMin()
12330 {
12331 return m_VarWetMin;
12332 }
12333 //----------------------------------------------------------------
12334 override float GetWetInit()
12335 {
12336 return m_VarWetInit;
12337 }
12338 //----------------------------------------------------------------
12339 override void OnWetChanged(float newVal, float oldVal)
12340 {
12341 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
12342 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
12343 if (newLevel != oldLevel)
12344 {
12345 OnWetLevelChanged(newLevel,oldLevel);
12346 }
12347 }
12348
12349 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12350 {
12351 SetWeightDirty();
12352 }
12353
12354 override EWetnessLevel GetWetLevel()
12355 {
12356 return GetWetLevelInternal(m_VarWet);
12357 }
12358
12359 //----------------------------------------------------------------
12360
12361 override void SetStoreLoad(bool value)
12362 {
12363 m_IsStoreLoad = value;
12364 }
12365
12366 override bool IsStoreLoad()
12367 {
12368 return m_IsStoreLoad;
12369 }
12370
12371 override void SetStoreLoadedQuantity(float value)
12372 {
12373 m_StoreLoadedQuantity = value;
12374 }
12375
12376 override float GetStoreLoadedQuantity()
12377 {
12378 return m_StoreLoadedQuantity;
12379 }
12380
12381 //----------------------------------------------------------------
12382
12383 float GetItemModelLength()
12384 {
12385 if (ConfigIsExisting("itemModelLength"))
12386 {
12387 return ConfigGetFloat("itemModelLength");
12388 }
12389 return 0;
12390 }
12391
12392 float GetItemAttachOffset()
12393 {
12394 if (ConfigIsExisting("itemAttachOffset"))
12395 {
12396 return ConfigGetFloat("itemAttachOffset");
12397 }
12398 return 0;
12399 }
12400
12401 override void SetCleanness(int value, bool allow_client = false)
12402 {
12403 if (!IsServerCheck(allow_client))
12404 return;
12405
12406 int previousValue = m_Cleanness;
12407
12408 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12409
12410 if (previousValue != m_Cleanness)
12411 SetVariableMask(VARIABLE_CLEANNESS);
12412 }
12413
12414 override int GetCleanness()
12415 {
12416 return m_Cleanness;
12417 }
12418
12420 {
12421 return true;
12422 }
12423
12424 //----------------------------------------------------------------
12425 // ATTACHMENT LOCKING
12426 // Getters relevant to generic ActionLockAttachment
12427 int GetLockType()
12428 {
12429 return m_LockType;
12430 }
12431
12432 string GetLockSoundSet()
12433 {
12434 return m_LockSoundSet;
12435 }
12436
12437 //----------------------------------------------------------------
12438 //------------------------- Color
12439 // sets items color variable given color components
12440 override void SetColor(int r, int g, int b, int a)
12441 {
12446 SetVariableMask(VARIABLE_COLOR);
12447 }
12449 override void GetColor(out int r,out int g,out int b,out int a)
12450 {
12455 }
12456
12457 bool IsColorSet()
12458 {
12459 return IsVariableSet(VARIABLE_COLOR);
12460 }
12461
12463 string GetColorString()
12464 {
12465 int r,g,b,a;
12466 GetColor(r,g,b,a);
12467 r = r/255;
12468 g = g/255;
12469 b = b/255;
12470 a = a/255;
12471 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12472 }
12473 //----------------------------------------------------------------
12474 //------------------------- LiquidType
12475
12476 override void SetLiquidType(int value, bool allow_client = false)
12477 {
12478 if (!IsServerCheck(allow_client))
12479 return;
12480
12481 int old = m_VarLiquidType;
12482 m_VarLiquidType = value;
12483 OnLiquidTypeChanged(old,value);
12484 SetVariableMask(VARIABLE_LIQUIDTYPE);
12485 }
12486
12487 int GetLiquidTypeInit()
12488 {
12489 return ConfigGetInt("varLiquidTypeInit");
12490 }
12491
12492 override int GetLiquidType()
12493 {
12494 return m_VarLiquidType;
12495 }
12496
12497 protected void OnLiquidTypeChanged(int oldType, int newType)
12498 {
12499 if (newType == LIQUID_NONE && GetIsFrozen())
12500 SetFrozen(false);
12501 }
12502
12504 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12505 {
12506 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12507 }
12508
12509 // -------------------------------------------------------------------------
12511 void OnInventoryEnter(Man player)
12512 {
12513 PlayerBase nplayer;
12514 if (PlayerBase.CastTo(nplayer, player))
12515 {
12516 m_CanPlayImpactSound = true;
12517 //nplayer.OnItemInventoryEnter(this);
12518 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12519 }
12520 }
12521
12522 // -------------------------------------------------------------------------
12524 void OnInventoryExit(Man player)
12525 {
12526 PlayerBase nplayer;
12527 if (PlayerBase.CastTo(nplayer,player))
12528 {
12529 //nplayer.OnItemInventoryExit(this);
12530 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12531
12532 }
12533
12534 //if (!GetGame().IsDedicatedServer())
12535 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12536
12537
12538 if (HasEnergyManager())
12539 {
12540 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12541 }
12542 }
12543
12544 // ADVANCED PLACEMENT EVENTS
12545 override void OnPlacementStarted(Man player)
12546 {
12547 super.OnPlacementStarted(player);
12548
12549 SetTakeable(false);
12550 }
12551
12552 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12553 {
12554 if (m_AdminLog)
12555 {
12556 m_AdminLog.OnPlacementComplete(player, this);
12557 }
12558
12559 super.OnPlacementComplete(player, position, orientation);
12560 }
12561
12562 //-----------------------------
12563 // AGENT SYSTEM
12564 //-----------------------------
12565 //--------------------------------------------------------------------------
12566 bool ContainsAgent(int agent_id)
12567 {
12568 if (agent_id & m_AttachedAgents)
12569 {
12570 return true;
12571 }
12572 else
12573 {
12574 return false;
12575 }
12576 }
12577
12578 //--------------------------------------------------------------------------
12579 override void RemoveAgent(int agent_id)
12580 {
12581 if (ContainsAgent(agent_id))
12582 {
12583 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12584 }
12585 }
12586
12587 //--------------------------------------------------------------------------
12588 override void RemoveAllAgents()
12589 {
12590 m_AttachedAgents = 0;
12591 }
12592 //--------------------------------------------------------------------------
12593 override void RemoveAllAgentsExcept(int agent_to_keep)
12594 {
12595 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12596 }
12597 // -------------------------------------------------------------------------
12598 override void InsertAgent(int agent, float count = 1)
12599 {
12600 if (count < 1)
12601 return;
12602 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12604 }
12605
12607 void TransferAgents(int agents)
12608 {
12610 }
12611
12612 // -------------------------------------------------------------------------
12613 override int GetAgents()
12614 {
12615 return m_AttachedAgents;
12616 }
12617 //----------------------------------------------------------------------
12618
12619 /*int GetContaminationType()
12620 {
12621 int contamination_type;
12622
12623 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12624 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12625 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12626 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12627
12628 Edible_Base edible = Edible_Base.Cast(this);
12629 int agents = GetAgents();
12630 if (edible)
12631 {
12632 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12633 if (profile)
12634 {
12635 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12636 }
12637 }
12638 if (agents & CONTAMINATED_MASK)
12639 {
12640 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12641 }
12642 if (agents & POISONED_MASK)
12643 {
12644 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12645 }
12646 if (agents & NERVE_GAS_MASK)
12647 {
12648 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12649 }
12650 if (agents & DIRTY_MASK)
12651 {
12652 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12653 }
12654
12655 return agents;
12656 }*/
12657
12658 // -------------------------------------------------------------------------
12659 bool LoadAgents(ParamsReadContext ctx, int version)
12660 {
12661 if (!ctx.Read(m_AttachedAgents))
12662 return false;
12663 return true;
12664 }
12665 // -------------------------------------------------------------------------
12667 {
12668
12670 }
12671 // -------------------------------------------------------------------------
12672
12674 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12675 {
12676 super.CheckForRoofLimited(timeTresholdMS);
12677
12678 float time = GetGame().GetTime();
12679 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12680 {
12681 m_PreviousRoofTestTime = time;
12682 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12683 }
12684 }
12685
12686 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12687 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12688 {
12689 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12690 {
12691 return 0;
12692 }
12693
12694 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12695 {
12696 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12697 if (filter)
12698 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12699 else
12700 return 0;//otherwise return 0 when no filter attached
12701 }
12702
12703 string subclassPath, entryName;
12704
12705 switch (type)
12706 {
12707 case DEF_BIOLOGICAL:
12708 entryName = "biological";
12709 break;
12710 case DEF_CHEMICAL:
12711 entryName = "chemical";
12712 break;
12713 default:
12714 entryName = "biological";
12715 break;
12716 }
12717
12718 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12719
12720 return GetGame().ConfigGetFloat(subclassPath + entryName);
12721 }
12722
12723
12724
12726 override void EEOnCECreate()
12727 {
12728 if (!IsMagazine())
12730
12732 }
12733
12734
12735 //-------------------------
12736 // OPEN/CLOSE USER ACTIONS
12737 //-------------------------
12739 void Open();
12740 void Close();
12741 bool IsOpen()
12742 {
12743 return true;
12744 }
12745
12746 override bool CanDisplayCargo()
12747 {
12748 return IsOpen();
12749 }
12750
12751
12752 // ------------------------------------------------------------
12753 // CONDITIONS
12754 // ------------------------------------------------------------
12755 override bool CanPutInCargo(EntityAI parent)
12756 {
12757 if (parent)
12758 {
12759 if (parent.IsInherited(DayZInfected))
12760 return true;
12761
12762 if (!parent.IsRuined())
12763 return true;
12764 }
12765
12766 return true;
12767 }
12768
12769 override bool CanPutAsAttachment(EntityAI parent)
12770 {
12771 if (!super.CanPutAsAttachment(parent))
12772 {
12773 return false;
12774 }
12775
12776 if (!IsRuined() && !parent.IsRuined())
12777 {
12778 return true;
12779 }
12780
12781 return false;
12782 }
12783
12784 override bool CanReceiveItemIntoCargo(EntityAI item)
12785 {
12786 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12787 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12788 // return false;
12789
12790 return super.CanReceiveItemIntoCargo(item);
12791 }
12792
12793 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12794 {
12795 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12796 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12797 // return false;
12798
12799 GameInventory attachmentInv = attachment.GetInventory();
12800 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12801 {
12802 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12803 return false;
12804 }
12805
12806 InventoryLocation loc = new InventoryLocation();
12807 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12808 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12809 return false;
12810
12811 return super.CanReceiveAttachment(attachment, slotId);
12812 }
12813
12814 override bool CanReleaseAttachment(EntityAI attachment)
12815 {
12816 if (!super.CanReleaseAttachment(attachment))
12817 return false;
12818
12819 return GetInventory().AreChildrenAccessible();
12820 }
12821
12822 /*override bool CanLoadAttachment(EntityAI attachment)
12823 {
12824 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12825 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12826 // return false;
12827
12828 GameInventory attachmentInv = attachment.GetInventory();
12829 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12830 {
12831 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12832 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12833
12834 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12835 return false;
12836 }
12837
12838 return super.CanLoadAttachment(attachment);
12839 }*/
12840
12841 // Plays muzzle flash particle effects
12842 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12843 {
12844 int id = muzzle_owner.GetMuzzleID();
12845 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12846
12847 if (WPOF_array)
12848 {
12849 for (int i = 0; i < WPOF_array.Count(); i++)
12850 {
12851 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12852
12853 if (WPOF)
12854 {
12855 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12856 }
12857 }
12858 }
12859 }
12860
12861 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12862 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12863 {
12864 int id = muzzle_owner.GetMuzzleID();
12865 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12866
12867 if (WPOBE_array)
12868 {
12869 for (int i = 0; i < WPOBE_array.Count(); i++)
12870 {
12871 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12872
12873 if (WPOBE)
12874 {
12875 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12876 }
12877 }
12878 }
12879 }
12880
12881 // Plays all weapon overheating particles
12882 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12883 {
12884 int id = muzzle_owner.GetMuzzleID();
12885 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12886
12887 if (WPOOH_array)
12888 {
12889 for (int i = 0; i < WPOOH_array.Count(); i++)
12890 {
12891 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12892
12893 if (WPOOH)
12894 {
12895 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12896 }
12897 }
12898 }
12899 }
12900
12901 // Updates all weapon overheating particles
12902 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12903 {
12904 int id = muzzle_owner.GetMuzzleID();
12905 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12906
12907 if (WPOOH_array)
12908 {
12909 for (int i = 0; i < WPOOH_array.Count(); i++)
12910 {
12911 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12912
12913 if (WPOOH)
12914 {
12915 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12916 }
12917 }
12918 }
12919 }
12920
12921 // Stops overheating particles
12922 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12923 {
12924 int id = muzzle_owner.GetMuzzleID();
12925 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12926
12927 if (WPOOH_array)
12928 {
12929 for (int i = 0; i < WPOOH_array.Count(); i++)
12930 {
12931 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12932
12933 if (WPOOH)
12934 {
12935 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12936 }
12937 }
12938 }
12939 }
12940
12941 //----------------------------------------------------------------
12942 //Item Behaviour - unified approach
12943 override bool IsHeavyBehaviour()
12944 {
12945 if (m_ItemBehaviour == 0)
12946 {
12947 return true;
12948 }
12949
12950 return false;
12951 }
12952
12953 override bool IsOneHandedBehaviour()
12954 {
12955 if (m_ItemBehaviour == 1)
12956 {
12957 return true;
12958 }
12959
12960 return false;
12961 }
12962
12963 override bool IsTwoHandedBehaviour()
12964 {
12965 if (m_ItemBehaviour == 2)
12966 {
12967 return true;
12968 }
12969
12970 return false;
12971 }
12972
12973 bool IsDeployable()
12974 {
12975 return false;
12976 }
12977
12979 float GetDeployTime()
12980 {
12981 return UATimeSpent.DEFAULT_DEPLOY;
12982 }
12983
12984
12985 //----------------------------------------------------------------
12986 // Item Targeting (User Actions)
12987 override void SetTakeable(bool pState)
12988 {
12989 m_IsTakeable = pState;
12990 SetSynchDirty();
12991 }
12992
12993 override bool IsTakeable()
12994 {
12995 return m_IsTakeable;
12996 }
12997
12998 // For cases where we want to show object widget which cant be taken to hands
13000 {
13001 return false;
13002 }
13003
13005 protected void PreLoadSoundAttachmentType()
13006 {
13007 string att_type = "None";
13008
13009 if (ConfigIsExisting("soundAttType"))
13010 {
13011 att_type = ConfigGetString("soundAttType");
13012 }
13013
13014 m_SoundAttType = att_type;
13015 }
13016
13017 override string GetAttachmentSoundType()
13018 {
13019 return m_SoundAttType;
13020 }
13021
13022 //----------------------------------------------------------------
13023 //SOUNDS - ItemSoundHandler
13024 //----------------------------------------------------------------
13025
13026 string GetPlaceSoundset(); // played when deploy starts
13027 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13028 string GetDeploySoundset(); // played when deploy sucessfully finishes
13029
13031 {
13032 if (!m_ItemSoundHandler)
13034
13035 return m_ItemSoundHandler;
13036 }
13037
13038 // override to initialize sounds
13039 protected void InitItemSounds()
13040 {
13041 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13042 return;
13043
13045
13046 if (GetPlaceSoundset() != string.Empty)
13047 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13048
13049 if (GetDeploySoundset() != string.Empty)
13050 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13051
13052 SoundParameters params = new SoundParameters();
13053 params.m_Loop = true;
13054 if (GetLoopDeploySoundset() != string.Empty)
13055 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13056 }
13057
13058 // Start sound using ItemSoundHandler
13059 void StartItemSoundServer(int id)
13060 {
13061 if (!GetGame().IsServer())
13062 return;
13063
13064 m_SoundSyncPlay = id;
13065 SetSynchDirty();
13066
13067 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13069 }
13070
13071 // Stop sound using ItemSoundHandler
13072 void StopItemSoundServer(int id)
13073 {
13074 if (!GetGame().IsServer())
13075 return;
13076
13077 m_SoundSyncStop = id;
13078 SetSynchDirty();
13079
13080 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13082 }
13083
13084 protected void ClearStartItemSoundServer()
13085 {
13086 m_SoundSyncPlay = 0;
13087 }
13088
13089 protected void ClearStopItemSoundServer()
13090 {
13091 m_SoundSyncStop = 0;
13092 }
13093
13095 void PlayAttachSound(string slot_type)
13096 {
13097 if (!GetGame().IsDedicatedServer())
13098 {
13099 if (ConfigIsExisting("attachSoundSet"))
13100 {
13101 string cfg_path = "";
13102 string soundset = "";
13103 string type_name = GetType();
13104
13105 TStringArray cfg_soundset_array = new TStringArray;
13106 TStringArray cfg_slot_array = new TStringArray;
13107 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13108 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13109
13110 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13111 {
13112 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13113 {
13114 if (cfg_slot_array[i] == slot_type)
13115 {
13116 soundset = cfg_soundset_array[i];
13117 break;
13118 }
13119 }
13120 }
13121
13122 if (soundset != "")
13123 {
13124 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13125 sound.SetAutodestroy(true);
13126 }
13127 }
13128 }
13129 }
13130
13131 void PlayDetachSound(string slot_type)
13132 {
13133 //TODO - evaluate if needed and devise universal config structure if so
13134 }
13135
13136 void OnApply(PlayerBase player);
13137
13139 {
13140 return 1.0;
13141 };
13142 //returns applicable selection
13143 array<string> GetHeadHidingSelection()
13144 {
13146 }
13147
13149 {
13151 }
13152
13153 WrittenNoteData GetWrittenNoteData() {};
13154
13156 {
13157 SetDynamicPhysicsLifeTime(0.01);
13158 m_ItemBeingDroppedPhys = false;
13159 }
13160
13162 {
13163 array<string> zone_names = new array<string>;
13164 GetDamageZones(zone_names);
13165 for (int i = 0; i < zone_names.Count(); i++)
13166 {
13167 SetHealthMax(zone_names.Get(i),"Health");
13168 }
13169 SetHealthMax("","Health");
13170 }
13171
13173 void SetZoneDamageCEInit()
13174 {
13175 float global_health = GetHealth01("","Health");
13176 array<string> zones = new array<string>;
13177 GetDamageZones(zones);
13178 //set damage of all zones to match global health level
13179 for (int i = 0; i < zones.Count(); i++)
13180 {
13181 SetHealth01(zones.Get(i),"Health",global_health);
13182 }
13183 }
13184
13186 bool IsCoverFaceForShave(string slot_name)
13187 {
13188 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13189 }
13190
13191 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13192 {
13193 if (!hasRootAsPlayer)
13194 {
13195 if (refParentIB)
13196 {
13197 // parent is wet
13198 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13199 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13200 // parent has liquid inside
13201 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13202 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13203 // drying
13204 else if (m_VarWet > m_VarWetMin)
13205 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13206 }
13207 else
13208 {
13209 // drying on ground or inside non-itembase (car, ...)
13210 if (m_VarWet > m_VarWetMin)
13211 AddWet(-1 * delta * GetDryingIncrement("ground"));
13212 }
13213 }
13214 }
13215
13216 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13217 {
13219 {
13220 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13221 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13222 {
13223 float heatPermCoef = 1.0;
13224 EntityAI ent = this;
13225 while (ent)
13226 {
13227 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13228 ent = ent.GetHierarchyParent();
13229 }
13230
13231 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13232 }
13233 }
13234 }
13235
13236 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13237 {
13238 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13239 EntityAI parent = GetHierarchyParent();
13240 if (!parent)
13241 {
13242 hasParent = false;
13243 hasRootAsPlayer = false;
13244 }
13245 else
13246 {
13247 hasParent = true;
13248 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13249 refParentIB = ItemBase.Cast(parent);
13250 }
13251 }
13252
13253 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13254 {
13255 // this is stub, implemented on Edible_Base
13256 }
13257
13258 bool CanDecay()
13259 {
13260 // return true used on selected food clases so they can decay
13261 return false;
13262 }
13263
13264 protected bool CanProcessDecay()
13265 {
13266 // this is stub, implemented on Edible_Base class
13267 // used to determine whether it is still necessary for the food to decay
13268 return false;
13269 }
13270
13271 protected bool CanHaveWetness()
13272 {
13273 // return true used on selected items that have a wetness effect
13274 return false;
13275 }
13276
13278 bool CanBeConsumed(ConsumeConditionData data = null)
13279 {
13280 return !GetIsFrozen() && IsOpen();
13281 }
13282
13283 override void ProcessVariables()
13284 {
13285 bool hasParent = false, hasRootAsPlayer = false;
13286 ItemBase refParentIB;
13287
13288 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13289 bool foodDecay = g_Game.IsFoodDecayEnabled();
13290
13291 if (wwtu || foodDecay)
13292 {
13293 bool processWetness = wwtu && CanHaveWetness();
13294 bool processTemperature = wwtu && CanHaveTemperature();
13295 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13296
13297 if (processWetness || processTemperature || processDecay)
13298 {
13299 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13300
13301 if (processWetness)
13302 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13303
13304 if (processTemperature)
13305 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13306
13307 if (processDecay)
13308 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13309 }
13310 }
13311 }
13312
13315 {
13316 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13317 }
13318
13319 override float GetTemperatureFreezeThreshold()
13320 {
13322 return Liquid.GetFreezeThreshold(GetLiquidType());
13323
13324 return super.GetTemperatureFreezeThreshold();
13325 }
13326
13327 override float GetTemperatureThawThreshold()
13328 {
13330 return Liquid.GetThawThreshold(GetLiquidType());
13331
13332 return super.GetTemperatureThawThreshold();
13333 }
13334
13335 override float GetItemOverheatThreshold()
13336 {
13338 return Liquid.GetBoilThreshold(GetLiquidType());
13339
13340 return super.GetItemOverheatThreshold();
13341 }
13342
13343 override float GetTemperatureFreezeTime()
13344 {
13345 if (HasQuantity())
13346 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
13347
13348 return super.GetTemperatureFreezeTime();
13349 }
13350
13351 override float GetTemperatureThawTime()
13352 {
13353 if (HasQuantity())
13354 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13355
13356 return super.GetTemperatureThawTime();
13357 }
13358
13360 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13362 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13363
13364 bool IsCargoException4x3(EntityAI item)
13365 {
13366 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13367 }
13368
13370 {
13371 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13372 }
13373
13375 void AddLightSourceItem(ItemBase lightsource)
13376 {
13377 m_LightSourceItem = lightsource;
13378 }
13379
13381 {
13382 m_LightSourceItem = null;
13383 }
13384
13386 {
13387 return m_LightSourceItem;
13388 }
13389
13391 array<int> GetValidFinishers()
13392 {
13393 return null;
13394 }
13395
13397 bool GetActionWidgetOverride(out typename name)
13398 {
13399 return false;
13400 }
13401
13402 bool PairWithDevice(notnull ItemBase otherDevice)
13403 {
13404 if (GetGame().IsServer())
13405 {
13406 ItemBase explosive = otherDevice;
13408 if (!trg)
13409 {
13410 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13411 explosive = this;
13412 }
13413
13414 explosive.PairRemote(trg);
13415 trg.SetControlledDevice(explosive);
13416
13417 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13418 trg.SetPersistentPairID(persistentID);
13419 explosive.SetPersistentPairID(persistentID);
13420
13421 return true;
13422 }
13423 return false;
13424 }
13425
13427 float GetBaitEffectivity()
13428 {
13429 float ret = 1.0;
13430 if (HasQuantity())
13431 ret *= GetQuantityNormalized();
13432 ret *= GetHealth01();
13433
13434 return ret;
13435 }
13436
13437 #ifdef DEVELOPER
13438 override void SetDebugItem()
13439 {
13440 super.SetDebugItem();
13441 _itemBase = this;
13442 }
13443
13444 override string GetDebugText()
13445 {
13446 string text = super.GetDebugText();
13447
13448 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13449 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13450
13451 return text;
13452 }
13453 #endif
13454
13455 bool CanBeUsedForSuicide()
13456 {
13457 return true;
13458 }
13459
13461 //DEPRECATED BELOW
13463 // Backwards compatibility
13464 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13465 {
13466 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13467 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13468 }
13469
13470 // replaced by ItemSoundHandler
13471 protected EffectSound m_SoundDeployFinish;
13472 protected EffectSound m_SoundPlace;
13473 protected EffectSound m_DeployLoopSoundEx;
13474 protected EffectSound m_SoundDeploy;
13475 bool m_IsPlaceSound;
13476 bool m_IsDeploySound;
13478
13479 string GetDeployFinishSoundset();
13480 void PlayDeploySound();
13481 void PlayDeployFinishSound();
13482 void PlayPlaceSound();
13483 void PlayDeployLoopSoundEx();
13484 void StopDeployLoopSoundEx();
13485 void SoundSynchRemoteReset();
13486 void SoundSynchRemote();
13487 bool UsesGlobalDeploy(){return false;}
13488 bool CanPlayDeployLoopSound(){return false;}
13490 bool IsPlaceSound(){return m_IsPlaceSound;}
13491 bool IsDeploySound(){return m_IsDeploySound;}
13492 void SetIsPlaceSound(bool is_place_sound);
13493 void SetIsDeploySound(bool is_deploy_sound);
13494}
13495
13496EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13497{
13498 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13499 if (entity)
13500 {
13501 bool is_item = entity.IsInherited(ItemBase);
13502 if (is_item && full_quantity)
13503 {
13504 ItemBase item = ItemBase.Cast(entity);
13505 item.SetQuantity(item.GetQuantityInit());
13506 }
13507 }
13508 else
13509 {
13510 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13511 return NULL;
13512 }
13513 return entity;
13514}
13515
13516void SetupSpawnedItem(ItemBase item, float health, float quantity)
13517{
13518 if (item)
13519 {
13520 if (health > 0)
13521 item.SetHealth("", "", health);
13522
13523 if (item.CanHaveTemperature())
13524 {
13525 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13526 if (item.CanFreeze())
13527 item.SetFrozen(false);
13528 }
13529
13530 if (item.HasEnergyManager())
13531 {
13532 if (quantity >= 0)
13533 {
13534 item.GetCompEM().SetEnergy0To1(quantity);
13535 }
13536 else
13537 {
13538 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13539 }
13540 }
13541 else if (item.IsMagazine())
13542 {
13543 Magazine mag = Magazine.Cast(item);
13544 if (quantity >= 0)
13545 {
13546 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13547 }
13548 else
13549 {
13550 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13551 }
13552
13553 }
13554 else
13555 {
13556 if (quantity >= 0)
13557 {
13558 item.SetQuantityNormalized(quantity, false);
13559 }
13560 else
13561 {
13562 item.SetQuantity(Math.AbsFloat(quantity));
13563 }
13564
13565 }
13566 }
13567}
13568
13569#ifdef DEVELOPER
13570ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13571#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
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...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()

Используется в InventoryItem::OnStoreLoad().