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

◆ PlayOverheatingParticles()

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

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

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