Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix food degradation for Eitr #769

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add configuration and classes for the Eitr Refinery
Uses the same mechanics as the other "smelters", except with different materials.
  • Loading branch information
shawnwallace committed Jan 23, 2023
commit 3f9d35cd9141bd88951098ca8105eafdb1302d1b
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -446,4 +446,5 @@ Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for details on compiling V+ for d
* An 'Hachidan' N. - https://github.com/ahnguyen09
* Abra - https://github.com/Abrackadabra
* Increddibelly - https://github.com/increddibelly
* Radvo - https://github.com/Radvo
* Radvo - https://github.com/Radvo
* Shawn - https://github.com/shawnwallace
1 change: 1 addition & 0 deletions ValheimPlus/Configurations/Configuration.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ public class Configuration
public KilnConfiguration Kiln { get; set; }
public WindmillConfiguration Windmill { get; set; }
public SpinningWheelConfiguration SpinningWheel { get; set; }
public EitrRefineryConfiguration EitrRefinery { get; set; }
public MapConfiguration Map { get; set; }
public PlayerConfiguration Player { get; set; }
public ServerConfiguration Server { get; set; }
13 changes: 13 additions & 0 deletions ValheimPlus/Configurations/Sections/EitrRefineryConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace ValheimPlus.Configurations.Sections
{
public class EitrRefineryConfiguration : ServerSyncConfig<EitrRefineryConfiguration>
{
public int maximumSap { get; internal set; } = 20;
public int maximumSoftTissue { get; internal set; } = 20;
public float productionSpeed { get; internal set; } = 40;
public bool autoDeposit { get; internal set; } = true;
public bool autoFuel { get; internal set; } = true;
public bool ignorePrivateAreaCheck { get; internal set; } = true;
public float autoRange { get; internal set; } = 10;
}
}
20 changes: 19 additions & 1 deletion ValheimPlus/GameClasses/Smelter.cs
Original file line number Diff line number Diff line change
@@ -51,6 +51,12 @@ private static void Prefix(ref Smelter __instance)
__instance.m_maxOre = Configuration.Current.SpinningWheel.maximumFlax;
__instance.m_secPerProduct = Configuration.Current.SpinningWheel.productionSpeed;
}
else if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName) && Configuration.Current.EitrRefinery.IsEnabled)
{
__instance.m_maxOre = Configuration.Current.EitrRefinery.maximumSap;
__instance.m_maxFuel = Configuration.Current.EitrRefinery.maximumSoftTissue;
__instance.m_secPerProduct = Configuration.Current.EitrRefinery.productionSpeed;
}
}

}
@@ -82,7 +88,11 @@ private static bool Prefix(string ore, int stack, ref Smelter __instance)
}
if (__instance.m_name.Equals(SmelterDefinitions.SpinningWheelName) && Configuration.Current.SpinningWheel.IsEnabled && Configuration.Current.SpinningWheel.autoDeposit)
{
return spawn(Helper.Clamp(Configuration.Current.SpinningWheel.autoRange, 1, 50), Configuration.Current.Windmill.ignorePrivateAreaCheck);
return spawn(Helper.Clamp(Configuration.Current.SpinningWheel.autoRange, 1, 50), Configuration.Current.SpinningWheel.ignorePrivateAreaCheck);
}
if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName) && Configuration.Current.EitrRefinery.IsEnabled && Configuration.Current.EitrRefinery.autoDeposit)
{
return spawn(Helper.Clamp(Configuration.Current.EitrRefinery.autoRange, 1, 50), Configuration.Current.EitrRefinery.ignorePrivateAreaCheck);
}
bool spawn(float autoDepositRange, bool ignorePrivateAreaCheck)
{
@@ -196,6 +206,13 @@ static void Prefix(Smelter __instance)
autoFuelRange = Configuration.Current.SpinningWheel.autoRange;
ignorePrivateAreaCheck = Configuration.Current.SpinningWheel.ignorePrivateAreaCheck;
}
else if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName))
{
if (!Configuration.Current.EitrRefinery.IsEnabled || !Configuration.Current.EitrRefinery.autoFuel)
return;
autoFuelRange = Configuration.Current.EitrRefinery.autoRange;
ignorePrivateAreaCheck = Configuration.Current.EitrRefinery.ignorePrivateAreaCheck;
}

autoFuelRange = Helper.Clamp(autoFuelRange, 1, 50);

@@ -345,6 +362,7 @@ public static class SmelterDefinitions
public static readonly string FurnaceName = "$piece_blastfurnace";
public static readonly string WindmillName = "$piece_windmill";
public static readonly string SpinningWheelName = "$piece_spinningwheel";
public static readonly string EitrRefineryName = "$piece_eitrrefinery";
}

public static class FurnaceDefinitions
29 changes: 29 additions & 0 deletions valheim_plus.cfg
Original file line number Diff line number Diff line change
@@ -1001,6 +1001,35 @@ ignorePrivateAreaCheck=true
autoRange=10


[EitrRefinery]

; Change false to true to enable this section. https://valheim.plus/documentation/list#EitrRefinery
enabled = false

; Maximum amount of sap in an Eitr Refinery.
maximumSap = 20

; Maximum amount of soft tissue in an Eitr Refinery.
maximumSoftTissue = 20

; The time it takes for the Eitr Refinery to produce a single eitr in seconds.
productionSpeed = 40

; Instead of dropping the items, they will be placed inside the nearest nearby chests.
autoDeposit = true

; The Eitr Refinery will pull sap and soft tissue from nearby chests to be automatically added to it when it's empty.
autoFuel = true

; This option prevents the Eitr Refinery to pull items from warded areas if it isn't placed inside of it.
; For convenience, we recommend this to be set to true.
ignorePrivateAreaCheck = true

; The range of the chest detection for the auto deposit and auto fuel features.
; Maximum is 50
autoRange = 5


[PlayerProjectile]

; Change false to true to enable this section. https://valheim.plus/documentation/list#PlayerProjectile