mirror of
https://github.com/Xevion/RimWorld-Hydroponics-Expanded.git
synced 2025-12-17 22:12:57 -06:00
Prevent growth overflow, add .Between(min, max) extension methods to simplify time/temp checks
This commit is contained in:
21
Source/HydroponicsExpanded/Utility/BetweenExtension.cs
Normal file
21
Source/HydroponicsExpanded/Utility/BetweenExtension.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace HydroponicsExpanded.Utility {
|
||||
public static class BetweenExtension {
|
||||
public static bool Between(this float value, float min, float max, bool inclusive = false) {
|
||||
if (inclusive)
|
||||
return value >= min && value <= max;
|
||||
return value > min && value < max;
|
||||
}
|
||||
|
||||
public static bool Between(this double value, double min, double max, bool inclusive = false) {
|
||||
if (inclusive)
|
||||
return value >= min && value <= max;
|
||||
return value > min && value < max;
|
||||
}
|
||||
|
||||
public static bool Between(this int value, int min, int max, bool inclusive = false) {
|
||||
if (inclusive)
|
||||
return value >= min && value <= max;
|
||||
return value > min && value < max;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user