Skip to content

Commit

Permalink
bug: embers timers where increased on feedFire when embers where disa…
Browse files Browse the repository at this point in the history
…bled
  • Loading branch information
ttr committed Jun 3, 2024
1 parent dbc58bc commit ab49118
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: MelonInfo(typeof(FireAddons.FireAddons), "FireAddons", "3.1.1", "ttr")]
[assembly: MelonInfo(typeof(FireAddons.FireAddons), "FireAddons", "3.1.2", "ttr")]
[assembly: MelonGame("Hinterland", "TheLongDark")]
19 changes: 13 additions & 6 deletions src/FireAddons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,16 +439,16 @@ internal static void CalculateCharcoal(Fire __instance)
//MelonLogger.Msg(guid + " capping charcoal to 0 from " + tmp);
}
}
internal static void FeedFire(Panel_FeedFire __instance)
internal static void FeedFireEmbers(Panel_FeedFire __instance)
{

Fire _fire = __instance.m_FireplaceInteraction.Fire;
string guid = ObjectGuid.GetGuidFromGameObject(_fire.gameObject);
GearItem fuel = __instance.GetSelectedFuelSource();

// added fuel while embers
if (_fire.m_EmberTimer > 0f )
{
if (_fire.m_EmberTimer > 0f)
{
ResetEmbersOnRestart(_fire);
}
// try add fuel to embers unless it wasn't comming out from ember state; only for certian fuels
Expand All @@ -463,8 +463,15 @@ internal static void FeedFire(Panel_FeedFire __instance)

}
}
// If charcoal was added, hack charcoal values
if (fuel.name.ToLower().StartsWith("gear_charcoal"))
}
internal static void FeedFireCharoal(Panel_FeedFire __instance)
{

Fire _fire = __instance.m_FireplaceInteraction.Fire;
GearItem fuel = __instance.GetSelectedFuelSource();

// If charcoal was added, hack charcoal values
if (fuel.name.ToLower().StartsWith("gear_charcoal"))
{
_fire.m_NumGeneratedCharcoalPieces -= 1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ internal class Panel_FeedFire_OnFeedFire
{
private static void Postfix(Panel_FeedFire __instance)
{
FireAddons.FeedFire(__instance);
if (Settings.options.embersSystem) { FireAddons.FeedFireEmbers(__instance); };
if (Settings.options.burnCharcoal) { FireAddons.FeedFireCharoal(__instance); };
}
}

Expand Down

0 comments on commit ab49118

Please sign in to comment.