Zone.Wormholes owns where wormholes are; the ratio moves to GameplaySettings
The renderer derived wormhole positions from GameSettings.WormholeDistanceRatio and the player's exit read them back from its instances. Zone.Wormholes (and WormholeTo) now derive them from GameplaySettings.WormholeDistanceRatio, which Settings.asset carries under GameplaySettings (0.75, unchanged); ZoneRenderer draws what the zone says. WormholesAreTheZones pins the positions, the exit gate included. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a5b7d459ef
commit
051bf201cd
7 changed files with 63 additions and 31 deletions
|
|
@ -831,7 +831,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
foreach (var zone in wormhole.Target.AdjacentZones)
|
||||
CurrentGalaxy.DiscoveredZones.Add(zone);
|
||||
SectorMap.QueueZoneReveal(wormhole.Target.AdjacentZones);
|
||||
ship.ExitWormhole(ZoneRenderer.WormholeInstances.Keys.First(w => w.Target == oldZone.GalaxyZone).Position,
|
||||
ship.ExitWormhole(Zone.WormholeTo(oldZone.GalaxyZone),
|
||||
Settings.GameplaySettings.WormholeExitVelocity * ItemManager.Random.NextFloat2Direction());
|
||||
CurrentEntity.Zone = Zone;
|
||||
SaveRun();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ public class GameSettings : ScriptableObject
|
|||
public string StartingHullName = "Longinus";
|
||||
public float HeatstrokePhasingFloor = 0;
|
||||
public float HeatstrokePhasingFrequency = 5;
|
||||
public float WormholeDistanceRatio;
|
||||
// The follow camera's distance from the hull's centre of mass, as a multiple of the hull's reach
|
||||
// (Contacts.Radius); 1.5 keeps the Longinus at about 30 m.
|
||||
public float FollowCameraDistancePerReach = 1.5f;
|
||||
|
|
|
|||
|
|
@ -226,6 +226,8 @@ public class GameplaySettings
|
|||
public float WormholeDepth = 1000;
|
||||
public float WormholeExitVelocity = 20;
|
||||
public float WormholeExitRadius = 50;
|
||||
// Wormholes sit at the zone's radius times this (Zone.Wormholes, the one owner of where they are).
|
||||
public float WormholeDistanceRatio = .75f;
|
||||
public float WormholeAnimationDuration = 4;
|
||||
public float WormholeExitCurveStart = .8f;
|
||||
public float ThermalWearExponent = .01f;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,25 @@ public class Zone
|
|||
public GalaxyZone GalaxyZone { get; }
|
||||
public Galaxy Galaxy { get; }
|
||||
|
||||
// The zone's wormholes, the one owner of where they are: one toward each adjacent zone at the zone's radius times
|
||||
// GameplaySettings.WormholeDistanceRatio, then, in the galaxy's exit zone, the run's exit gate (presentation only: whether it
|
||||
// opens is RunGoal.ExitOpen, read when it is used). Plain data derived on every call, stored nowhere; none without a GalaxyZone.
|
||||
public IEnumerable<Wormhole> Wormholes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GalaxyZone == null) yield break;
|
||||
var ratio = _itemManager.GameplaySettings.WormholeDistanceRatio;
|
||||
foreach (var adjacent in GalaxyZone.AdjacentZones)
|
||||
yield return new Wormhole { Target = adjacent, Position = normalize(adjacent.Position - GalaxyZone.Position) * Pack.Radius * ratio };
|
||||
if (GalaxyZone == Galaxy.Exit)
|
||||
yield return new Wormhole { Exit = true, Position = RunGoal.ExitGatePosition(this, ratio) };
|
||||
}
|
||||
}
|
||||
|
||||
// Where this zone's wormhole to `target` sits.
|
||||
public float2 WormholeTo(GalaxyZone target) => Wormholes.First(wormhole => wormhole.Target == target).Position;
|
||||
|
||||
// Cut 6b (docs/fire-control-cut.md, 6.1, Soul finding 6): one zone, one stable identity -- a galaxy seed
|
||||
// reproduces it, and nothing else in the zone (an NPC joining, a shop opening, a wormhole exit) can
|
||||
// perturb it. FireControl.Commit builds its own local generator from this and the shot's own id instead
|
||||
|
|
|
|||
|
|
@ -283,26 +283,8 @@ public class ZoneRenderer : MonoBehaviour
|
|||
if (_clouds.Remove(e.Value, out var instance)) Destroy(instance.gameObject);
|
||||
}));
|
||||
|
||||
if (zone.GalaxyZone != null)
|
||||
{
|
||||
foreach (var adjacentZone in zone.GalaxyZone.AdjacentZones)
|
||||
{
|
||||
var dir = normalize(adjacentZone.Position - zone.GalaxyZone.Position);
|
||||
AddWormhole(new Wormhole
|
||||
{
|
||||
Target = adjacentZone,
|
||||
Position = dir * zone.Pack.Radius * Settings.WormholeDistanceRatio
|
||||
});
|
||||
}
|
||||
|
||||
// The run's exit gate is presentation only: whether it opens is RunGoal.ExitOpen, read when it is used.
|
||||
if (zone.GalaxyZone == zone.Galaxy.Exit)
|
||||
AddWormhole(new Wormhole
|
||||
{
|
||||
Exit = true,
|
||||
Position = RunGoal.ExitGatePosition(zone, Settings.WormholeDistanceRatio)
|
||||
});
|
||||
}
|
||||
// The renderer draws wormholes; Zone.Wormholes decides where they are.
|
||||
foreach (var wormhole in zone.Wormholes) AddWormhole(wormhole);
|
||||
}
|
||||
|
||||
private void LoadMine(Zone zone, Mine mine)
|
||||
|
|
|
|||
Loading…
Reference in a new issue