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

◆ StopOverheatingParticles()

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

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

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