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

◆ CanReceiveAttachment()

override bool SpawnItemOnLocation::CanReceiveAttachment ( EntityAI attachment,
int slotId )
protected

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

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