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

◆ CanPutInCargo()

override bool SpawnItemOnLocation::CanPutInCargo ( EntityAI parent)
protected

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

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