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>
This commit is contained in:
@ -11,7 +11,7 @@ namespace GrassCutter
|
||||
/// while driving and unloads at a garage pad. The pickup carries bundles on its bed instead.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Rigidbody))]
|
||||
public class Vehicle : NetworkBehaviour, IInteractable
|
||||
public partial class Vehicle : NetworkBehaviour, IInteractable
|
||||
{
|
||||
public static readonly List<Vehicle> All = new List<Vehicle>();
|
||||
public const ulong Nobody = ulong.MaxValue;
|
||||
@ -109,7 +109,7 @@ namespace GrassCutter
|
||||
|
||||
// ───────────────────────── seat ─────────────────────────
|
||||
|
||||
public string Prompt => HasDriver ? null : Def.bed > 0 ? Loc.F("Ride the {0} ({1} of {2} bundles, E with a bundle loads it)", Def.name, Bed.Count, Def.bed) : Loc.F("Ride the {0} ({1} / {2})", Def.name, GameDefs.Kilos(Tank.Value), GameDefs.Kilos(Capacity));
|
||||
public string Prompt => HasDriver ? null : OnAuto ? Loc.F("Take over the {0} ({1}, {2} / {3})", Def.name, AutoPrompt, GameDefs.Kilos(Tank.Value), GameDefs.Kilos(Capacity)) : Def.bed > 0 ? Loc.F("Ride the {0} ({1} of {2} bundles, E with a bundle loads it)", Def.name, Bed.Count, Def.bed) : Loc.F("Ride the {0} ({1} / {2})", Def.name, GameDefs.Kilos(Tank.Value), GameDefs.Kilos(Capacity));
|
||||
public bool CanInteract => !HasDriver;
|
||||
|
||||
public void Interact()
|
||||
@ -124,6 +124,9 @@ namespace GrassCutter
|
||||
if (HasDriver || RollingOut) return;
|
||||
foreach (var v in All) if (v != this && v.Driver.Value == who) return;
|
||||
Driver.Value = who;
|
||||
// getting in takes it back from the autopilot
|
||||
Auto.Value = (byte)AutoJob.Off;
|
||||
_resumeAt = 0f;
|
||||
if (OwnerClientId != who) NetworkObject.ChangeOwnership(who);
|
||||
}
|
||||
|
||||
@ -253,7 +256,13 @@ namespace GrassCutter
|
||||
Sfx.Play("ui_open");
|
||||
UIRoot.I?.OpenGarage(near.GetComponent<Garage>(), kind);
|
||||
}
|
||||
if (Ctl.CruisePressed && Level(TuneId.Cruise) > 0) _cruise = !_cruise;
|
||||
if (Ctl.CruisePressed && CanAuto)
|
||||
{
|
||||
AutoRpc();
|
||||
Sfx.Play("ui_click", 0.8f, 1.2f);
|
||||
Hud.Toast(Loc.F("Autopilot on: the {0} mows round here and unloads itself. Hop back in to take over.", Def.name), Hud.ToastKind.Info);
|
||||
}
|
||||
else if (Ctl.CruisePressed && Level(TuneId.Cruise) > 0) _cruise = !_cruise;
|
||||
if (Ctl.MovePressed && Def.bed > 0) TipRpc();
|
||||
}
|
||||
else _cruise = false;
|
||||
@ -272,6 +281,13 @@ namespace GrassCutter
|
||||
if (!IsSpawned || !IsOwner || Body.isKinematic) return;
|
||||
bool driving = LocalDriving;
|
||||
var input = driving ? Ctl.Move : Vector2.zero;
|
||||
// the host drives a machine on autopilot
|
||||
bool auto = false;
|
||||
if (IsServer && !HasDriver)
|
||||
{
|
||||
AutoResume();
|
||||
if (OnAuto) { input = AutoInput(Time.fixedDeltaTime); auto = true; }
|
||||
}
|
||||
float boost = driving && Ctl.Sprint ? GameDefs.BoostMul(Level(TuneId.Turbo)) : 1f;
|
||||
if (input.y < -0.1f) _cruise = false;
|
||||
float throttle = _cruise && input.y < 0.1f ? 1f : input.y;
|
||||
@ -329,7 +345,7 @@ namespace GrassCutter
|
||||
var tq = Vector3.Cross(transform.up, lean.normalized) * 18f - Body.angularVelocity * 2.5f;
|
||||
Body.AddTorque(Vector3.ProjectOnPlane(tq, up) * Body.mass, ForceMode.Force);
|
||||
}
|
||||
if (driving && Throttle.Value != throttle) Throttle.Value = throttle;
|
||||
if ((driving || auto) && Throttle.Value != throttle) Throttle.Value = throttle;
|
||||
|
||||
// mow under the cutter: what the header sweeps goes in the hopper
|
||||
bool mowing = false;
|
||||
@ -338,12 +354,12 @@ namespace GrassCutter
|
||||
var ip = intake ? intake.position : transform.position + fwd * length * 0.5f;
|
||||
bool overMeadow = Planet.Altitude(ip) < 1.2f && !(Ground.Instance && Ground.Instance.RockAt(ip));
|
||||
bool onDeck = Ts && Ts.OnDeck(ip);
|
||||
if (overMeadow && !onDeck && Tank.Value < Capacity && driving)
|
||||
if (overMeadow && !onDeck && Tank.Value < Capacity && (driving || auto))
|
||||
{
|
||||
mowing = true;
|
||||
float kg = MowMap.Cut(_hasCut ? _lastCut : ip, ip, CutWidth, blade: true) * GameDefs.GrassDensity;
|
||||
Tank.Value = Mathf.Min(Capacity, Tank.Value + kg);
|
||||
if (Tank.Value >= Capacity - 0.01f) { Sfx.Play("tank_full", 0.8f); Assistant.Say("asst_hopper"); Hud.Toast(Loc.F("{0} hopper full: unload at the base yard, a garage pad or an Unload Bay (follow the UNLOAD markers)", Def.name), Hud.ToastKind.Warn); }
|
||||
if (Tank.Value >= Capacity - 0.01f && driving) { Sfx.Play("tank_full", 0.8f); Assistant.Say("asst_hopper"); Hud.Toast(Loc.F("{0} hopper full: unload at the base yard, a garage pad or an Unload Bay (follow the UNLOAD markers)", Def.name), Hud.ToastKind.Warn); }
|
||||
_lastCut = ip;
|
||||
}
|
||||
_hasCut = mowing;
|
||||
@ -352,7 +368,7 @@ namespace GrassCutter
|
||||
|
||||
// unload: in the yard at the base it's paid as it comes off, on a garage's pad or an unload bay it fills the bin
|
||||
var pad = Tank.Value > 0.1f ? SiloPiece.PadUnder(transform.position) : null;
|
||||
if (Def.bales && driving) Bale(dt);
|
||||
if (Def.bales && (driving || auto)) Bale(dt);
|
||||
Unloading = Tank.Value > 0.1f && (pad || NearDock());
|
||||
if (Tank.Value > 0.1f && (pad || NearDock()) && Ts)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user