Files
grass-cutters/Assets/Scripts/World/Difficulty.cs
NiemandKG df55b5e417 Smaller planets, 93% sectors, dearer late game, automation perks, autopilot, grass train
Not yet tried in the game: Unity could not get a licence (Unity Hub isn't
running), so this was only type-checked with Roslyn.

- Planets by area: the hard one half the old whole planet, normal a third of
  that, easy a sixth. Saves keep the size set they were made on (sizeGen 0).
- A sector closes at 93% mown.
- Mid and late prices go up (perks, machines, vehicles, tunes); the early
  game stays as it was.
- AUTOMATION perk tree: Long Leash (robot reach), Overdrive Motors, Bigger
  Hoppers, Long-Range Drones and Hive Mind.
- Autopilot, a garage tune for mowers: C hands the machine over. It mows the
  fields around in strokes, unloads at the nearest pad or the base yard and
  comes back. Getting in takes it back; it carries on after a load.
- Grass Train: lays its own track to a station next door, mowing under it,
  then runs back and forth cutting wider each run. Models in gc_train.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 11:39:02 +06:00

63 lines
3.3 KiB
C#

namespace GrassCutter
{
/// <summary>
/// How big Herbaria-7 is. The ball keeps its 163 830 sectors whatever its size, so a smaller ball has smaller sectors
/// too: less grass all round and every sector done sooner. The host picks it for a new save, it stays with the save,
/// and everyone who joins gets the host's ball. 0 is the whole planet, as every save from before there was a choice.
/// </summary>
public enum Difficulty : byte { Hazard = 0, HoldMyBeer = 1, Mommy = 2 }
public static class Difficulties
{
/// <summary>Easiest first, the way the choice is offered.</summary>
public static readonly Difficulty[] Order = { Difficulty.Mommy, Difficulty.HoldMyBeer, Difficulty.Hazard };
public static string Name(Difficulty d) =>
d == Difficulty.Mommy ? "Mommy, I'm Scared!" : d == Difficulty.HoldMyBeer ? "Hold My Beer!" : "I AM THE FUCKING HAZARD!";
public static string Tag(Difficulty d) => Loc.T(d == Difficulty.Mommy ? Loc.N("EASY") : d == Difficulty.HoldMyBeer ? Loc.N("NORMAL") : Loc.N("EXTRA HARD"));
public static string Blurb(Difficulty d) => Loc.T(
d == Difficulty.Mommy ? Loc.N("A sixth of the big planet, sectors to match. Earth can wait a little.")
: d == Difficulty.HoldMyBeer ? Loc.N("A third of the big planet, smaller sectors. Still a lot of lawn.")
: Loc.N("The big planet: the whole of Herbaria-7, every blade of it."));
/// <summary>
/// Which set of sizes a save is on. 0: the first one (radius 1, 1/2, 1/3 of the whole planet), every save from
/// before the planets shrank; they keep their ball, the pieces on it stand where they stood. 1: by area, the hard
/// one half the whole planet, normal a third of that, easy a sixth.
/// </summary>
public const int NewGen = 1;
/// <summary>The planet's radius against the whole one.</summary>
public static float Scale(Difficulty d, int gen) => gen >= 1
? (d == Difficulty.Mommy ? 0.288675f : d == Difficulty.HoldMyBeer ? 0.408248f : 0.707107f)
: (d == Difficulty.Mommy ? 1f / 3f : d == Difficulty.HoldMyBeer ? 0.5f : 1f);
/// <summary>The size set the world is built on right now.</summary>
public static int Gen { get; private set; }
/// <summary>Difficulty and size set in one byte, for the wire.</summary>
public static byte Wire => (byte)((int)Current | (Gen << 4));
public static void ApplyWire(byte b) => Apply((Difficulty)(b & 15), b >> 4);
/// <summary>What the next new save starts on: set by the menu (and `-difficulty 0..2` for the dev bots).</summary>
public static Difficulty Chosen = Difficulty.Hazard;
/// <summary>The ball the world is built on right now.</summary>
public static Difficulty Current { get; private set; } = Difficulty.Hazard;
/// <summary>Builds the world on the ball for this difficulty, if it isn't on it already.</summary>
public static void Apply(Difficulty d, int gen)
{
if (d != Difficulty.Mommy && d != Difficulty.HoldMyBeer) d = Difficulty.Hazard;
gen = gen >= 1 ? 1 : 0;
if (d == Current && gen == Gen) return;
Current = d;
Gen = gen;
Planet.Rescale(GameDefs.PlanetRadius * Scale(d, gen));
}
}
}