Files
grass-cutters/Assets/Scripts/Core/DemoBot.Bots.cs
NiemandKG 27d075103b Feedback round: bots that keep working, Sky Mower, calmer HUD, faster menus, new map
- Robot docks and drone pads with no belt ship straight to Earth; robots widen
  their rings up to 4x once everything in reach is mown, travel 2.5x faster
  empty, hoppers 60/150 kg. Drone reach 70 m + 25 m per upgrade.
- New Sky Mower: a big mowing drone on a pad, 91 sectors, flies over the grass.
- Cut paint follows the blade as a strip, no disc ahead of the machine.
- Sector toasts aggregate, chimes and till sounds throttled, toasts moved and
  narrowed.
- Menus no longer rebuild on every money change (price tint follows the
  wallet), scroll position kept.
- Map drawn as one mesh, opens near the player, ME / + / - / GLOBE, scale bar.
- Key-art still (x_key) and -shotsize for the store stills; -demobots test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 15:38:37 +06:00

61 lines
3.3 KiB
C#

using System.Collections;
using System.Linq;
using UnityEngine;
namespace GrassCutter
{
public partial class DemoBot
{
/// <summary>
/// -demobots: a Robot Mk I, a Sky Mower and a Drone Pad, none of them with a belt. All three should keep earning on
/// their own: the robot and the sky mower widen their rings once they are done, the pad ships what its drones bring.
/// </summary>
IEnumerator Bots()
{
TeamState.DeleteSave();
yield return new WaitForSeconds(2f);
NetSession.Instance.HostLocal();
while (!Me || !Ts) yield return null;
yield return new WaitForSeconds(3f);
Clock(11f);
var robotAt = Soil17(140f, -40f);
var skyAt = Soil17(-120f, 60f);
var padAt = Soil17(40f, 150f);
Quaternion Face(Vector3 p) => Quaternion.LookRotation(Vector3.ProjectOnPlane(Vector3.forward, Planet.Up(p)), Planet.Up(p));
var robot = Spawner.Instance.SpawnPiece(PieceId.RobotI, robotAt, Face(robotAt), robotAt, true).GetComponent<RobotDock>();
var sky = Spawner.Instance.SpawnPiece(PieceId.SkyMower, skyAt, Face(skyAt), skyAt, true).GetComponent<RobotDock>();
var pad = Spawner.Instance.SpawnPiece(PieceId.DronePad, padAt, Face(padAt), padAt, true).GetComponent<DronePad>();
for (int i = 0; i < 9; i++)
{
var a = Quaternion.AngleAxis(i * 40f, Planet.Up(padAt)) * Vector3.ProjectOnPlane(Vector3.forward, Planet.Up(padAt)).normalized * (12f + i * 6f);
Spawner.Instance.SpawnCargo(CargoKind.Grass, Planet.Surface(padAt + a) + Planet.Up(padAt + a) * 0.6f, Quaternion.identity, Vector3.zero);
}
yield return new WaitForSeconds(1f);
Log($"bots built: robot {(robot ? "ok" : "MISSING")}, sky {(sky ? "ok" : "MISSING")}, pad {(pad ? "ok" : "MISSING")}");
if (!robot || !sky || !pad) yield break;
double money = Ts.Money.Value;
Mowbot.Haste = 25f;
yield return new WaitForSeconds(3f);
var skyUp = Planet.Up(sky.Shown);
yield return Look("bot01_sky_mower", sky.Shown + skyUp * 5f + Vector3.ProjectOnPlane(Vector3.right, skyUp).normalized * 9f, sky.Shown, 0.2f);
yield return Look("bot02_robot", robot.Shown + Planet.Up(robot.Shown) * 3f + Vector3.right * 4f, robot.Shown, 0.2f);
for (int k = 1; k <= 6; k++)
{
yield return new WaitForSeconds(15f);
Log($"t+{k * 15} s at {Mowbot.Haste:0}x: earned {Ts.Money.Value - money:0}, closed {Ts.Closed.Value}");
Log($" robot: {robot.Prompt}");
Log($" sky: {sky.Prompt} alt {Planet.Altitude(sky.ShownBody.position) - Planet.Altitude(sky.Shown):0.0} m");
Log($" pad: {pad.Prompt}, delivered {pad.Delivered}");
}
skyUp = Planet.Up(sky.Shown);
yield return Look("bot03_sky_late", sky.Shown + skyUp * 7f + Vector3.ProjectOnPlane(Vector3.forward, skyUp).normalized * -12f, sky.Shown, 0.2f);
yield return Look("bot04_pad", padAt + Planet.Up(padAt) * 6f + Vector3.right * 8f, padAt, 0.2f);
Mowbot.Haste = 1f;
Log("bots done");
Application.Quit();
}
}
}