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

◆ PlayFireParticles()

static void SpawnItemOnLocation::PlayFireParticles ( ItemBase weapon,
int muzzle_index,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search )
staticprotected

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

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