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

◆ UpdateOverheatingParticles()

static void SpawnItemOnLocation::UpdateOverheatingParticles ( ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search )
staticprotected

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

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