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

◆ CanReleaseAttachment()

override bool SpawnItemOnLocation::CanReleaseAttachment ( EntityAI attachment)
protected

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

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