Round 6 fixes: held tools, headlamp glare, ladder openings, level horizon, roof hulls, rain hits, idle motion, belt packs, meadow variety
- Held tools sit lower and further right; the hammer faces forward and strikes about the camera's right - Headlamp leaves held items, treats and vending machines alone (rendering layer NoLamp); other lights keep lighting them - Hay grounded on the floor in world space (it floated) - Deck fence opens at each ladder, rail colliders split around it; ladders moved to 2 m off the edge middle, clear of the intakes; climbing goes over a rail only if one is in the way - Crew stand to the soil's up (Planet.Level): flat round the base, the ball's up past it, so the horizon stays level on a small planet - Convex roof hulls for the crew cabin, garage, pitched roof and windmill tower; cabin box lowered to the eaves - Rain and acid rain hits differ by surface: soil, grass, wood, metal - Idle motion: dishes pan, sways sway, sensors turn, eyes blink, windmill turns in the breeze, reels and parked rotors tick over - Belt: take tools off at the supply wall; hold E at a vending machine for a pack of 3 on the belt, LMB has one - New meadow pieces: boulders, slab stones, crystals, mushrooms, stump, bulb plants - -demofix checks for all of the above; loc rows in all 11 tables Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
@ -186,18 +187,64 @@ namespace GrassCutter
|
||||
var at = ground + Planet.Frame * new Vector3(o.x, 0f, o.y) + up * (lift + Random.Range(0f, 6f)) - windDir * 4f;
|
||||
Fx.Emit(_drops, at, fall * Random.Range(0.9f, 1.1f), Random.Range(0.045f, 0.07f), tint, (lift + 3f) / 24f);
|
||||
}
|
||||
_splashDue += dt * 70f * r;
|
||||
_splashDue += dt * 110f * r;
|
||||
for (; _splashDue >= 1f; _splashDue -= 1f)
|
||||
{
|
||||
// where a drop lands: on whatever stands there (deck, roof, machine), else on the soil
|
||||
var o = Random.insideUnitCircle * 12f;
|
||||
var at = Planet.Surface(eye + Planet.Frame * new Vector3(o.x, 0f, o.y));
|
||||
if (Vector3.Dot(eye - at, up) > 25f) break;
|
||||
var on = Fx.Surface.Ground;
|
||||
if (Physics.Raycast(at + up * 30f, -up, out var hit, 31f, HitMask, QueryTriggerInteraction.Ignore) && Vector3.Dot(hit.point - at, up) > -0.05f)
|
||||
{
|
||||
at = hit.point;
|
||||
on = SurfaceOf(hit.collider);
|
||||
}
|
||||
else if (MowMap.Yield(at) > 0.3f) on = Fx.Surface.Grass;
|
||||
Fx.Emit(_splash, at + up * 0.05f, up * 0.4f, Random.Range(0.08f, 0.16f), new Color(tint.r, tint.g, tint.b, 0.5f));
|
||||
Fx.RainHit(at, up, on, tint, Acid);
|
||||
}
|
||||
}
|
||||
Volume(ref _rainLoop, "rain_loop", r * (0.55f + Storm * 0.25f));
|
||||
}
|
||||
|
||||
const int HitMask = (1 << Layers.Default) | (1 << Layers.Build) | (1 << Layers.Vehicle) | (1 << Layers.Prop);
|
||||
|
||||
static readonly Dictionary<Collider, Fx.Surface> s_surface = new Dictionary<Collider, Fx.Surface>();
|
||||
|
||||
/// <summary>What a collider is made of, as far as rain can tell: machines and vehicles are metal, the deck and what is
|
||||
/// built of planks is wood, anything else by its material's name.</summary>
|
||||
static Fx.Surface SurfaceOf(Collider c)
|
||||
{
|
||||
if (s_surface.TryGetValue(c, out var k)) return k;
|
||||
k = Fx.Surface.Ground;
|
||||
if (c.gameObject.layer == Layers.Vehicle || c.GetComponentInParent<Vehicle>()) k = Fx.Surface.Metal;
|
||||
else if (c.GetComponentInParent<DeckTileView>()) k = Fx.Surface.Wood;
|
||||
else if (c.GetComponentInParent<BuildPiece>() is BuildPiece bp)
|
||||
{
|
||||
switch (bp.piece)
|
||||
{
|
||||
case PieceId.Wall: case PieceId.WindowWall: case PieceId.DoorWall: case PieceId.Railing: case PieceId.Fence:
|
||||
case PieceId.Floor: case PieceId.FlatRoof: case PieceId.Roof: case PieceId.Stairs: case PieceId.Steps:
|
||||
case PieceId.Pillar: case PieceId.Planter: case PieceId.Bench: case PieceId.Crates: case PieceId.Square: case PieceId.Hex:
|
||||
k = Fx.Surface.Wood; break;
|
||||
default: k = Fx.Surface.Metal; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var r = c.GetComponent<Renderer>();
|
||||
if (!r) r = c.GetComponentInParent<Renderer>();
|
||||
if (!r && c.transform.parent) r = c.transform.parent.GetComponentInChildren<Renderer>();
|
||||
var n = r && r.sharedMaterial ? r.sharedMaterial.name.ToLowerInvariant() : c.name.ToLowerInvariant();
|
||||
if (n.Contains("metal") || n.Contains("iron") || n.Contains("steel") || n.Contains("hull") || n.Contains("tin") || n.Contains("chrome") || n.Contains("paint")) k = Fx.Surface.Metal;
|
||||
else if (n.Contains("wood") || n.Contains("plank") || n.Contains("timber") || n.Contains("log") || n.Contains("bark") || n.Contains("tree") || n.Contains("hay") || n.Contains("deck")) k = Fx.Surface.Wood;
|
||||
}
|
||||
if (s_surface.Count > 4000) s_surface.Clear();
|
||||
s_surface[c] = k;
|
||||
return k;
|
||||
}
|
||||
|
||||
void TickWind(Vector3 eye, Vector3 up, Vector3 windDir, float dt)
|
||||
{
|
||||
float w = Mathf.Max(Wind, Storm * 0.6f);
|
||||
|
||||
Reference in New Issue
Block a user