2021-04-18 05:13:20 +01:00
|
|
|
using System;
|
|
|
|
|
using TMPro;
|
2026-09-14 17:39:12 +02:00
|
|
|
using CultMath;
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
using CultMath.UnityBridge;
|
2021-04-15 04:25:22 +01:00
|
|
|
using UnityEngine;
|
2026-09-14 17:39:12 +02:00
|
|
|
using static CultMath.math;
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
using Random = UnityEngine.Random;
|
2021-04-15 04:25:22 +01:00
|
|
|
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
// How one floating item looks. Zone owns the item's every fact (existence, position, expiry, pickup); once bound,
|
|
|
|
|
// this reads the latest sim body and draws, spun for show, and writes nothing back (rulings unity-presents-only-r3
|
|
|
|
|
// and sim-speed-presentation). An unbound pickup (FieldTester's test scene) leaves its transform alone.
|
2021-04-15 04:25:22 +01:00
|
|
|
public class ItemPickup : MonoBehaviour
|
|
|
|
|
{
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
public float RotationSpeed = 1f;
|
2021-04-18 05:13:20 +01:00
|
|
|
public float LabelFadeDuration = .5f;
|
|
|
|
|
public float LabelPersistDuration = 3;
|
|
|
|
|
public float LabelDisplayAngle = 15;
|
|
|
|
|
public float LabelDisplayMaxDistance = 500;
|
|
|
|
|
public Transform ScanLabelContainer;
|
|
|
|
|
public TextMeshPro ScanLabel;
|
|
|
|
|
|
2021-04-15 04:25:22 +01:00
|
|
|
public ItemInstance Item { get; set; }
|
2026-08-10 14:57:50 +01:00
|
|
|
public float3 ViewOrigin { get; set; }
|
|
|
|
|
public float3 ViewDirection { get; set; }
|
2021-04-18 05:13:20 +01:00
|
|
|
|
|
|
|
|
private float _displayTime;
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
private float _timeOffset;
|
|
|
|
|
private Zone _zone;
|
2026-10-16 02:35:07 +02:00
|
|
|
private GameplaySettings _settings;
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
private FloatingItem _floating;
|
|
|
|
|
|
2026-10-16 02:35:07 +02:00
|
|
|
public void Bind(Zone zone, FloatingItem floating, GameplaySettings settings)
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
{
|
|
|
|
|
_zone = zone;
|
2026-10-16 02:35:07 +02:00
|
|
|
_settings = settings;
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
_floating = floating;
|
|
|
|
|
Item = floating.Item;
|
|
|
|
|
_timeOffset = Random.value * 100;
|
|
|
|
|
Place();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Place()
|
|
|
|
|
{
|
Draw every moving body at the drawn time T = ExactTime + Lead
Planets, belts, wells, loot, mines, stations, the chunk reticle and the flow
clock are evaluated through DrawAhead (Time, Orbit, Height, Position) at one
drawn time; the rail law lives once in Zone.Offset; OrbitPositionAt, GetHeight,
ChunkPose, EvaluateBelt and RideHeight take a time. Fixes the planet jumping
against a co-moving ship at display rates above the step rate.
Not yet built or run (Unity presenter files are verified by compile only on
Starfire).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 21:26:36 +02:00
|
|
|
var lead = ActionGameManager.Clock.Lead;
|
|
|
|
|
var p = DrawAhead.Position(_floating.Body, lead);
|
2026-10-16 02:35:07 +02:00
|
|
|
transform.position = new Vector3(p.x, DrawAhead.FloaterHeight(_zone, _settings, p, lead), p.y);
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
}
|
2021-04-18 05:13:20 +01:00
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
if (_floating != null)
|
|
|
|
|
{
|
|
|
|
|
Place();
|
|
|
|
|
transform.localRotation = Quaternion.Euler(
|
|
|
|
|
sin(Time.time - _timeOffset * RotationSpeed) * 90, 0, cos(Time.time - _timeOffset * RotationSpeed) * 90);
|
|
|
|
|
}
|
|
|
|
|
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
var diff = transform.position.ToCultMath() - ViewOrigin;
|
2021-04-18 05:13:20 +01:00
|
|
|
var toThis = normalize(diff);
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
var viewAngle = acos(dot(toThis, ViewDirection)) * Mathf.Rad2Deg;
|
2021-04-18 05:13:20 +01:00
|
|
|
if (length(diff) < LabelDisplayMaxDistance && viewAngle < LabelDisplayAngle)
|
|
|
|
|
_displayTime = Time.time;
|
2026-10-13 18:43:15 +02:00
|
|
|
if (_floating?.Holder != null) _displayTime = Time.time;
|
2021-04-18 05:13:20 +01:00
|
|
|
var targetAlpha = Time.time - _displayTime < LabelPersistDuration ? 1 : 0;
|
|
|
|
|
var c = ScanLabel.color;
|
|
|
|
|
c.a = c.a + sign(targetAlpha - c.a) * (Time.deltaTime / LabelFadeDuration);
|
|
|
|
|
ScanLabel.color = c;
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
ScanLabelContainer.rotation = Quaternion.LookRotation((-toThis).ToUnity());
|
2021-04-18 05:13:20 +01:00
|
|
|
}
|
Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).
Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:36:47 +02:00
|
|
|
}
|