Cut 2: the dead mining path goes, and chunks get one owner
MiningTool (its Execute range-checked against nothing, since no writer ever set AsteroidBelt/Asteroid) and Zone.MineAsteroid (mints nothing; the SimpleCommodity drop was commented out) are deleted, per Q1=A: "Bring back the drill, indeed." Union tag 26 is retired, not reused. ResourceScanner's dead survey Execute and its scan-target fields go too; its authored Range/ MinimumDensity/ScanDuration stay pending Q2. PlanetSettings.MiningDifficulty had one reader, now gone. Chunk wear (damage, broken-until) moves off AsteroidBelt's three per-belt dictionaries and onto Zone as the one owner (Q3=A): Zone.Wear is the only writer, ChunkExists/ChunkRadius are the readers, and respawn is a lazy comparison against zone time, never a per-tick loop. ChunkId is (CultRecordKey Field, int Index) -- "Field", not "Belt", because chunks are meant to generalize past asteroid belts to other debris fields later. Persisted in ZonePack's new key 6 (List<ChunkWearPack>, nullable so an older record with no key 6 loads with no wear instead of throwing), pruned of healed, non-broken entries at pack. The break threshold stays strictly greater-than, matching today's behaviour: damage exactly equal to hitpoints does not yet break the chunk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e4d38f16fa
commit
3b9f0f1d09
8 changed files with 150 additions and 224 deletions
|
|
@ -170,7 +170,7 @@ public interface IPowerConsumer
|
|||
Union(23, typeof(ThermotoggleData)),
|
||||
Union(24, typeof(EnergyDrawData)),
|
||||
// Union(25, typeof(MiningControllerData)),
|
||||
Union(26, typeof(MiningToolData)),
|
||||
// Union(26): retired, do not reuse -- was the "hit it with a tool" behavior deleted in Cut 2 (docs/mining-cut.md, Q1=A).
|
||||
// Union(27, typeof(SurveyControllerData)),
|
||||
Union(28, typeof(ResourceScannerData)),
|
||||
// Union(29, typeof(WanderControllerData)),
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using GameCult.Caching;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using CultMath;
|
||||
using static CultMath.math;
|
||||
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class MiningToolData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("dps"), Key(1)]
|
||||
public PerformanceStat DamagePerSecond = new PerformanceStat();
|
||||
|
||||
[Inspectable, JsonProperty("efficiency"), Key(2)]
|
||||
public PerformanceStat Efficiency = new PerformanceStat();
|
||||
|
||||
[Inspectable, JsonProperty("penetration"), Key(3)]
|
||||
public PerformanceStat Penetration = new PerformanceStat();
|
||||
|
||||
[Inspectable, JsonProperty("range"), Key(4)]
|
||||
public PerformanceStat Range = new PerformanceStat();
|
||||
|
||||
public override Behavior CreateInstance(EquippedItem item)
|
||||
{
|
||||
return new MiningTool(this, item);
|
||||
}
|
||||
public override Behavior CreateInstance(ConsumableItemEffect item)
|
||||
{
|
||||
return new MiningTool(this, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class MiningTool : Behavior
|
||||
{
|
||||
public CultRecordKey AsteroidBelt;
|
||||
public int Asteroid;
|
||||
|
||||
private MiningToolData _data;
|
||||
public float Range { get; private set; }
|
||||
|
||||
public MiningTool(MiningToolData data, EquippedItem item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public MiningTool(MiningToolData data, ConsumableItemEffect item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
Range = Evaluate(_data.Range);
|
||||
if (!AsteroidBelt.IsSet() || !Entity.Zone.AsteroidExists(AsteroidBelt, Asteroid))
|
||||
return false;
|
||||
|
||||
var pose = Entity.Zone.ChunkPose(AsteroidBelt, Asteroid);
|
||||
if (length(Entity.Position.xz - pose.xy) - pose.w < Range)
|
||||
{
|
||||
Entity.Zone.MineAsteroid(
|
||||
Entity,
|
||||
AsteroidBelt,
|
||||
Asteroid,
|
||||
Evaluate(_data.DamagePerSecond) * dt,
|
||||
Evaluate(_data.Efficiency),
|
||||
Evaluate(_data.Penetration));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a7eebfaae57b2304580ef7e4a2740993
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -2,13 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using GameCult.Caching;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using CultMath;
|
||||
using static CultMath.math;
|
||||
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class ResourceScannerData : BehaviorData
|
||||
|
|
@ -33,31 +28,18 @@ public class ResourceScannerData : BehaviorData
|
|||
}
|
||||
}
|
||||
|
||||
// Cut 2 (docs/mining-cut.md, Q1=A): the dead survey Execute and its scan-target fields are gone
|
||||
// (ScanTarget/Asteroid/_scanTime/_scanTarget, and the always-false-until-scanned PlanetSurveyFloor write it
|
||||
// worked toward). Range, MinimumDensity and ScanDuration stay authored data on this behavior until Q2 rules
|
||||
// whether the scanner becomes a chunk's detection-range gate (docs/mining-cut.md Q2 consequence "Visibility").
|
||||
public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior
|
||||
{
|
||||
public int Asteroid = -1;
|
||||
|
||||
private ResourceScannerData _data;
|
||||
private float _scanTime;
|
||||
private CultRecordKey _scanTarget;
|
||||
|
||||
public float Range { get; private set; }
|
||||
public float MinimumDensity { get; private set; }
|
||||
public float ScanDuration { get; private set; }
|
||||
|
||||
public CultRecordKey ScanTarget
|
||||
{
|
||||
get => _scanTarget;
|
||||
set
|
||||
{
|
||||
if (!value.Equals(_scanTarget))
|
||||
{
|
||||
_scanTarget = value;
|
||||
_scanTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceScanner(ResourceScannerData data, EquippedItem item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
|
|
@ -68,44 +50,6 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior
|
|||
_data = data;
|
||||
}
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
var planetData = Entity.Zone.Planets[ScanTarget];
|
||||
if (planetData != null)
|
||||
{
|
||||
if (planetData is AsteroidBeltData beltData)
|
||||
{
|
||||
if(Asteroid > -1 &&
|
||||
Asteroid < beltData.Asteroids.Length &&
|
||||
length(Entity.Position.xz - Entity.Zone.ChunkPose(ScanTarget, Asteroid).xy) < Range)
|
||||
{
|
||||
_scanTime += dt;
|
||||
if (_scanTime > ScanDuration)
|
||||
{
|
||||
// TODO: Implement Scanning!
|
||||
//Context.ItemData.Get<Corporation>(Entity.Corporation).PlanetSurveyFloor[ScanTarget] = MinimumDensity;
|
||||
_scanTime = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(length(Entity.Position.xz - Entity.Zone.GetOrbitPosition(planetData.Orbit.Key)) < Range)
|
||||
{
|
||||
_scanTime += dt;
|
||||
if (_scanTime > ScanDuration)
|
||||
{
|
||||
//Context.ItemData.Get<Corporation>(Entity.Corporation).PlanetSurveyFloor[ScanTarget] = MinimumDensity;
|
||||
_scanTime = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Update(float delta)
|
||||
{
|
||||
Range = Evaluate(_data.Range);
|
||||
|
|
|
|||
Loading…
Reference in a new issue