internal static void Postfix(GameObject go) { LiquidItem liquidItem = go.GetComponent <LiquidItem>(); if (liquidItem && liquidItem.m_LiquidType == GearLiquidTypeEnum.Water) { Water.AdjustWaterSupplyToWater(); } }
private static void OnTransferFinished(bool success, bool playerCancel, float progress) { //MelonLoader.MelonLogger.Log("Transfer Finished"); var liquidItem = WaterButtons.currentLiquidItemShowing; float liquidBefore = liquidItem.m_LiquidLiters; float spaceAvailable = Water.GetRemainingCapacityEmpty() + Water.GetRemainingCapacity(liquidItem.m_LiquidQuality) - liquidItem.m_LiquidCapacityLiters + liquidItem.m_LiquidLiters; float maximumWaterTransfer = Mathf.Min(spaceAvailable, liquidItem.m_LiquidLiters); float actualWaterTransfer = progress * maximumWaterTransfer; liquidItem.m_LiquidLiters = liquidItem.m_LiquidCapacityLiters; Water.WATER.Add(actualWaterTransfer, liquidItem.m_LiquidQuality); liquidItem.m_LiquidLiters = liquidBefore - actualWaterTransfer; Water.AdjustWaterSupplyToWater(); }
private static void OnDumpFinished(bool success, bool playerCancel, float progress) { //MelonLoader.MelonLogger.Log("Dump Finished"); LiquidItem liquidItem = WaterButtons.currentLiquidItemShowing; float lostLiters = liquidItem.m_LiquidLiters * progress; if (liquidItem.m_LiquidQuality == LiquidQuality.Potable) // Potable water { WaterSupply potableWaterSupply = GameManager.GetInventoryComponent().GetPotableWaterSupply().m_WaterSupply; Water.ShowLostMessage(potableWaterSupply, "GAMEPLAY_WaterPotable", lostLiters); } else // NonPotable water { WaterSupply nonPotableWaterSupply = GameManager.GetInventoryComponent().GetNonPotableWaterSupply().m_WaterSupply; Water.ShowLostMessage(nonPotableWaterSupply, "GAMEPLAY_WaterUnsafe", lostLiters); } // Remove water and adjust the water supply. liquidItem.m_LiquidLiters = Mathf.Max(liquidItem.m_LiquidLiters - lostLiters, 0); Water.AdjustWaterSupplyToWater(); }
internal static void Postfix(PlayerManager __instance, float progress) { //WaterSupply waterSupply = AccessTools.Field(__instance.GetType(), "m_WaterSourceToDrinkFrom").GetValue(__instance) as WaterSupply; WaterSupply waterSupply = __instance.m_WaterSourceToDrinkFrom; if (waterSupply == null) { return; } GearItem gearItem = waterSupply.GetComponent <GearItem>(); if (gearItem.m_LiquidItem != null) { gearItem.m_LiquidItem.m_LiquidLiters = waterSupply.m_VolumeInLiters; Object.Destroy(waterSupply); gearItem.m_WaterSupply = null; } if (gearItem.m_CookingPotItem != null) { if (!WaterUtils.IsCooledDown(gearItem.m_CookingPotItem)) { //GameManager.GetPlayerManagerComponent().ApplyFreezingBuff(20 * progress, 0.5f, 1 * progress); GameManager.GetPlayerManagerComponent().ApplyFreezingBuff(20 * progress, 0.5f, 1 * progress, 24f); PlayerDamageEvent.SpawnAfflictionEvent("GAMEPLAY_WarmingUp", "GAMEPLAY_BuffHeader", "ico_injury_warmingUp", InterfaceManager.m_Panel_ActionsRadial.m_FirstAidBuffColor); } WaterUtils.SetWaterAmount(gearItem.m_CookingPotItem, waterSupply.m_VolumeInLiters); Object.Destroy(waterSupply); } if (waterSupply is WaterSourceSupply) { WaterSourceSupply waterSourceSupply = waterSupply as WaterSourceSupply; waterSourceSupply.UpdateWaterSource(); } Water.AdjustWaterSupplyToWater(); }
internal static void Postfix(PlayerManager __instance) { WaterSupply waterSupply = AccessTools.Field(__instance.GetType(), "m_WaterSourceToDrinkFrom").GetValue(__instance) as WaterSupply; if (waterSupply == null) { return; } LiquidItem liquidItem = waterSupply.GetComponent <LiquidItem>(); if (liquidItem == null) { return; } liquidItem.m_LiquidLiters = waterSupply.m_VolumeInLiters; UnityEngine.Object.Destroy(waterSupply); liquidItem.GetComponent <GearItem>().m_WaterSupply = null; Water.AdjustWaterSupplyToWater(); }
internal static void Postfix(PlayerManager __instance, float progress) { WaterSupply waterSupply = AccessTools.Field(__instance.GetType(), "m_WaterSourceToDrinkFrom").GetValue(__instance) as WaterSupply; if (waterSupply == null) { return; } GearItem gearItem = waterSupply.GetComponent <GearItem>(); if (gearItem.m_LiquidItem != null) { gearItem.m_LiquidItem.m_LiquidLiters = waterSupply.m_VolumeInLiters; Object.Destroy(waterSupply); gearItem.m_WaterSupply = null; } if (gearItem.m_CookingPotItem != null) { if (!WaterUtils.IsCooledDown(gearItem.m_CookingPotItem)) { GameManager.GetPlayerManagerComponent().ApplyFreezingBuff(20 * progress, 0.5f, 1 * progress, 1); InterfaceManager.m_Panel_HUD.ShowBuffNotification("GAMEPLAY_WarmingUp", "GAMEPLAY_BuffHeader", InterfaceManager.m_Panel_HUD.m_BuffSpriteFreezingBuff); } WaterUtils.SetWaterAmount(gearItem.m_CookingPotItem, waterSupply.m_VolumeInLiters); Object.Destroy(waterSupply); } if (waterSupply is WaterSourceSupply waterSourceSupply) { waterSourceSupply.UpdateWaterSource(); } Water.AdjustWaterSupplyToWater(); }
internal static void Postfix() { Water.AdjustWaterSupplyToWater(); }
internal static void Postfix() { Water.IgnoreChanges = false; Water.AdjustWaterSupplyToWater(); }