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

◆ PlayBulletCasingEjectParticles()

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

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

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