Grass Cutters Together: the project as of moon-sweepers f3666f0

A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and
Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date.
Images, audio, models and binaries go through Git LFS (.gitattributes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-06 18:44:40 +06:00
parent 0f0467cd0c
commit d1c3761e58
4190 changed files with 270757 additions and 1 deletions

View File

@ -0,0 +1,248 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace GrassCutter
{
/// <summary>H: the crew's spiral notebook. Each chapter is a tab; lines starting with # are headings, and everything that
/// has a number in the game is read from the game, so the notes can't go out of date.</summary>
public class NotebookScreen
{
public VisualElement Card { get; }
readonly VisualElement _tabs, _page;
readonly List<Button> _buttons = new List<Button>();
int _open;
static readonly (string title, Func<IEnumerable<string>> lines)[] Chapters =
{
(Loc.N("Start Here"), StartHere),
(Loc.N("Tools"), Tools),
(Loc.N("Bundles"), Bundles),
(Loc.N("Upgrades"), Upgrades),
(Loc.N("Building"), Building),
(Loc.N("Power"), Power),
(Loc.N("Production"), Production),
(Loc.N("Machines"), Machines),
(Loc.N("Robots"), Robots),
(Loc.N("Sectors"), Sectors),
(Loc.N("Keys"), Keys),
};
public NotebookScreen(VisualElement layer, Action close)
{
Card = UIK.El("card notebook", layer);
var header = UIK.El("card-header", Card);
UIK.Text(Loc.T("CREW NOTEBOOK"), "t-h1 t-dark", header);
UIK.Btn("X", close, "btn btn-red btn-small", header);
var body = UIK.El("notebook-body", Card);
_tabs = UIK.El("notebook-tabs", body);
var spiral = UIK.El("notebook-spiral", body);
for (int i = 0; i < 16; i++) UIK.El("notebook-ring", spiral);
var scroll = new ScrollView(ScrollViewMode.Vertical);
scroll.AddToClassList("notebook-page");
body.Add(scroll);
_page = scroll.contentContainer;
for (int i = 0; i < Chapters.Length; i++)
{
int c = i;
_buttons.Add(UIK.Btn(Loc.T(Chapters[i].title), () => Open(c), "tab notebook-tab", _tabs));
}
Open(0);
}
void Open(int chapter)
{
_open = chapter;
for (int i = 0; i < _buttons.Count; i++) _buttons[i].EnableInClassList("tab-on", i == _open);
_page.Clear();
foreach (var line in Chapters[chapter].lines())
{
bool head = line.StartsWith("# ");
var l = UIK.Text(head ? line.Substring(2) : line, head ? "t-h2 t-dark notebook-head" : "t-body t-dark notebook-line", _page, head);
l.style.whiteSpace = WhiteSpace.Normal;
}
}
static TeamState Ts => TeamState.Instance;
static IEnumerable<string> StartHere()
{
yield return "# " + Loc.T("The job");
yield return Loc.T("Earth has run out of grass and Herbaria-7 is covered in it. Cut it, bundle it, ship it home.");
yield return "# " + Loc.T("First day");
yield return Loc.T("Take the nail scissors from the SUPPLY WALL on the west side of the deck.");
yield return Loc.T("Hop over the railing with SPACE, hold LEFT CLICK and sweep the blade over the grass. It goes straight into the tool's container.");
yield return Loc.T("Press E at the GRASS DEPOT to hand it in. You're paid at once.");
yield return Loc.T("Spend it on whatever slows you down the most: a wider blade, a bigger container, then belts and machines.");
}
static IEnumerable<string> Tools()
{
yield return "# " + Loc.T("On the supply wall");
foreach (var d in GameDefs.Tools)
{
if (!GameDefs.IsBlade(d.id)) continue;
string price = d.price > 0 ? UIK.Money(Ts ? Ts.ToolPrice(d) : d.price) : Loc.T("free");
float width = Ts ? Ts.ToolWidth(d.id) : d.width;
float cap = Ts ? Ts.ToolCap(d.id) : d.capacity;
yield return Loc.F("{0}: {1:0.#} cm strip, {2:0.##} kg container, {3}", d.name, width * 100f, cap, price);
}
yield return "# " + Loc.T("Gear");
yield return Loc.F("Build Hammer: {0}. B takes it out and opens the build menu.", UIK.Money(GameDefs.Tool(ToolId.Hammer).price));
yield return Loc.F("Jetpack: {0}. Double-tap SPACE in the air for a dash.", UIK.Money(GameDefs.JetpackPrice));
yield return Loc.F("Gravity Boots: {0}. G brings back Earth's pull.", UIK.Money(GameDefs.BootsPrice));
yield return Loc.F("Night Vision: {0}. N goes from the headlamp to night vision to nothing.", UIK.Money(GameDefs.NightVisionPrice));
yield return Loc.T("Every tool keeps its own grass. Slots on the belt are personal, up to six.");
}
static IEnumerable<string> Bundles()
{
yield return "# " + Loc.T("Tying");
yield return Loc.F("Q ties up to {0:0} kg from the tool in your hands into a bundle. Tying sells nothing: a bundle has to reach the depot.", GameDefs.BundleKg);
yield return "# " + Loc.T("Carrying");
yield return Loc.T("E picks a bundle up. LEFT CLICK throws it, E at the depot hands it in, E anywhere else drops it.");
yield return Loc.T("A bundle on a belt rides to the end of the belt.");
yield return "# " + Loc.T("Prices");
yield return Loc.F("Grass pays {0} a kilo.", UIK.Money(GameDefs.PerKg(CargoKind.Grass)));
}
static IEnumerable<string> Upgrades()
{
yield return "# " + Loc.T("The matrix");
yield return Loc.T("The console on the deck sells upgrades for the whole crew. Five branches grow out of the Earth Uplink, which comes free.");
if (Ts) yield return Loc.F("Installed so far: {0} of {1}.", Ts.Installs, TeamState.TotalInstalls);
yield return "# " + Loc.T("Worth buying first");
yield return Loc.T("A bigger container for the tool you use most, then Wider Blades, then Servo Boots.");
yield return Loc.T("Machines are sold at a garage. There's none at the base: build one, see their own chapter.");
}
static IEnumerable<string> Building()
{
yield return "# " + Loc.T("Anywhere on the ball");
yield return Loc.T("With the hammer in hand you can build on any ground that has been mown, not just on the deck.");
yield return Loc.T("Nothing goes on standing grass: cut it first. The ghost turns red and says how much is cut, and its outline on the ground shows what has to go. A belt needs a mown path along its whole length.");
yield return Loc.T("Q changes category, the wheel picks a piece, LEFT CLICK places it, R turns it.");
yield return Loc.T("RIGHT CLICK takes a piece down and gives all the money back. T carries it somewhere else, the middle button copies it.");
yield return "# " + Loc.T("Belts");
yield return Loc.F("Click where a belt starts, click where it ends. {0} a metre, up to {1:0} m in one run.", UIK.Money(GameDefs.Piece(PieceId.Belt).price), GameDefs.BeltLongest);
yield return Loc.T("It carries on from where it ended until it lands on a port or you press RIGHT CLICK. Each click makes a corner.");
yield return Loc.F("CTRL + wheel sets the height, {0:0.0} to {1:0} m. Posts grow down to the ground by themselves.", GameDefs.BeltLowest, GameDefs.BeltHighest);
yield return Loc.T("A belt ending near a port snaps onto it. A belt ending on another belt loads onto it from the side.");
yield return Loc.T("The depot takes twelve belts, three on each side, and pays as soon as a bundle arrives.");
yield return "# " + Loc.T("Splitting and merging");
yield return Loc.T("The splitter deals bundles to every belt joined to it, left, right and straight on, and when one is full the others carry on. E on it makes it a sorter: grass, hay or brick goes left, the rest the other way.");
yield return Loc.T("The merger brings up to three belts into one, in turn. E on it gives one of them the right of way.");
yield return "# " + Loc.T("Foundations");
yield return Loc.T("A slab of level ground. On it things sit on a half-metre grid, F places them freely.");
yield return Loc.T("Slabs of the same shape line up edge to edge. Square ones turn in steps of 90 degrees, hexagons in 30.");
yield return Loc.T("Carry a foundation with T and everything standing on it comes along.");
}
static IEnumerable<string> Power()
{
yield return "# " + Loc.T("Sun and night");
yield return Loc.F("The sun goes round Herbaria-7 every {0:0} minutes, and each place has its own time of day.", GameDefs.DayLength / 60f);
yield return Loc.T("N switches the headlamp. Night vision from the supply wall comes next on the same key.");
yield return "# " + Loc.T("The network");
yield return Loc.T("A panel, a battery or a pole feeds every machine inside its radius. Anything that reaches anything else joins up into one network and shares its power.");
yield return Loc.T("A machine's percentage is how fast it runs: 100% is full speed, 30% is a third of it. It takes grass in and turns it out all the time, never in one go.");
yield return "# " + Loc.T("Solar panels");
foreach (var d in GameDefs.Pieces)
if (GameDefs.IsPanel(d.id))
{
var p = GameDefs.Panel(d.id);
yield return Loc.F("{0}: {1:0.#} kW, {2:0} m, {3}", d.name, p.kw, p.radius, UIK.Money(d.price));
}
yield return "# " + Loc.T("Batteries");
yield return Loc.T("They fill with whatever sun the machines don't use, and when the panels fall short they make up the difference, at night as well.");
foreach (var d in GameDefs.Pieces)
if (GameDefs.IsBattery(d.id))
{
var b = GameDefs.Battery(d.id);
yield return Loc.F("{0}: {1:0} kWh, up to {2:0} kW, {3:0} m, {4}", d.name, b.kwh, b.kw, b.radius, UIK.Money(d.price));
}
yield return "# " + Loc.T("Poles");
yield return Loc.F("{0}: reaches {1:0} m, {2}. String them out to bring power to a far machine.", GameDefs.Piece(PieceId.Pole).name, GameDefs.PoleReach, UIK.Money(GameDefs.Piece(PieceId.Pole).price));
yield return Loc.T("Aim at a panel, a battery, a pole or a machine to read how the network is doing. The lamp on a machine shows it too: green is full speed, amber is short of power, red is none.");
}
static IEnumerable<string> Production()
{
yield return "# " + Loc.T("Worth more than grass");
yield return Loc.F("Grass pays {0} a kilo, hay {1}, brick {2}.", UIK.Money(GameDefs.PerKg(CargoKind.Grass)), UIK.Money(GameDefs.PerKg(CargoKind.Hay)), UIK.Money(GameDefs.PerKg(CargoKind.Brick)));
foreach (var id in new[] { PieceId.Dryer, PieceId.Press })
{
var d = GameDefs.Piece(id);
yield return "# " + d.name;
yield return Loc.F("{0} Draws {1:0} kW, {2}.", d.desc, d.kw, UIK.Money(d.price));
}
yield return "# " + Loc.T("Setting it up");
yield return Loc.T("Bundles go in by belt or from your arms with E, and what's made leaves by the front. With no belt there it lands on the ground.");
yield return Loc.T("A good line: grass into a splitter, one side to the windmill, the other to the press. The windmill's hay goes to the press too, the bricks to the depot.");
yield return Loc.T("One windmill feeds two and a half presses.");
yield return "# " + Loc.T("Fields");
yield return Loc.T("Here and there wild wheat, oats, corn and sunflowers grow up through the grass. They cut and weigh like grass, and a field sector pays more when it's mown clean: half as much again for wheat and oats, double for corn, three times for sunflowers.");
}
static IEnumerable<string> Machines()
{
yield return "# " + Loc.T("Your own");
yield return Loc.T("Everyone buys their own machine at a garage you built with the Hammer, one of each, and anyone can ride it. Upgrades belong to the machine.");
foreach (var d in GameDefs.Vehicles)
yield return d.bed > 0 ? Loc.F("{0}: {1} bundles, {2}", d.name, d.bed, UIK.Money(d.price)) : Loc.F("{0}: {1:0.##} m strip, {2:0} kg hopper, {3}", d.name, d.width, d.hopper, UIK.Money(d.price));
yield return "# " + Loc.T("Driving");
yield return Loc.T("E gets in and out, SHIFT boosts. With Cruise Control, C holds your speed.");
yield return Loc.T("On the pickup E with a bundle in your arms loads it, T tips the bed out.");
yield return "# " + Loc.T("Unloading");
yield return Loc.T("Drive into the yard at the foot of the ramp and it's paid as it comes off. On the pad in front of a garage it goes into the silo, and two ports at the back turn that into bundles for your belts.");
yield return "# " + Loc.T("Calling");
yield return Loc.T("Any garage can bring your machine to its pad, wherever you left it.");
yield return "# " + Loc.T("Upgrades");
yield return Loc.T("They cost the listed price on a $1000 machine, half that on the cheapest and up to three times on the dearest.");
foreach (var t in GameDefs.Tunes) yield return Loc.F("{0}: {1} at the top level", t.name, t.effect(t.prices.Length));
}
static IEnumerable<string> Robots()
{
yield return "# " + Loc.T("Docked");
yield return Loc.T("Build a dock and its robot gets to work on the sectors around it, nearest first, row by row. No power needed.");
foreach (var r in GameDefs.Robots)
if (r.reach > 0) yield return Loc.F("{0}: {1} rings of sectors, {2:0.#} m strip, {3:0} kg hopper, {4}", r.name, r.reach, r.width, r.hopper, UIK.Money(GameDefs.Piece(r.piece).price));
yield return Loc.T("A full robot walks home and the dock ties the grass into bundles. Give the dock a belt: with nowhere to put them it stops at 100 kg.");
yield return "# " + Loc.T("The Reaper");
yield return Loc.T("It needs no dock and goes on to the next unfinished sector by itself, for as long as there is grass.");
yield return Loc.T("Every kilo is shot into a Bundle Catcher, anywhere on the planet. A Catcher holds 100 kg and puts it on a belt. With no Catcher free the Reaper stops when its hopper is full.");
yield return "# " + Loc.T("The Binder");
yield return Loc.T("E hands it the contents of your tool. It ties them into bundles and puts them on the belt, so you don't have to walk to the depot.");
}
static IEnumerable<string> Sectors()
{
yield return "# " + Loc.T("Sectors");
yield return Loc.F("Herbaria-7 is {0:N0} hexagons of about {1:0} m², with gold lines between them.", GameDefs.Sectors, GameDefs.SectorArea);
yield return Loc.F("A sector mown clean pays {0} on top of its grass.", UIK.Money(GameDefs.SectorBonus(0)));
yield return "# " + Loc.T("Stakes and survey points");
yield return Loc.F("{0} survey stakes stand tangled around the planet: hold E to sort one out for {1}.", Landmarks.Stakes, UIK.Money(GameDefs.StakePay));
yield return Loc.F("{0} survey points want reading: hold E for {1}.", Landmarks.Points, UIK.Money(GameDefs.PointPay));
if (Ts) yield return Loc.F("Found so far: {0} stakes, {1} points.", Ts.FoundCount(false), Ts.FoundCount(true));
yield return "# " + Loc.T("Stations");
yield return Loc.T("Eleven more stations stand around the planet. Walk up to one and it opens for the crew: a depot, a supply wall, a console and a travel terminal.");
yield return Loc.F("The terminal takes you to any station you have found for {0}.", UIK.Money(GameDefs.TravelPrice));
yield return "# " + Loc.T("Getting home");
yield return Loc.T("The compass always knows the way to the base: it stands at the north pole. M shows the whole planet.");
}
static IEnumerable<string> Keys()
{
yield return "# " + Loc.T("On foot");
yield return Loc.T("WASD walk, SHIFT run, SPACE jump, E use");
yield return Loc.T("LEFT CLICK cut, Q tie a bundle, 1-6 or the wheel change tool");
yield return Loc.T("B build, G gravity boots");
yield return "# " + Loc.T("Building");
yield return Loc.T("Q category, wheel piece, LEFT CLICK place, RIGHT CLICK remove");
yield return Loc.T("R rotate, T move, middle button copy, CTRL + wheel belt height, F free placement");
yield return Loc.T("N headlamp, M map, H notebook, TAB crew, ESC pause, ~ console");
}
}
}