Delete commented-out code blocks
Git keeps the history. SimpleCommodityData records its retired MessagePack keys so they are not reused against old data. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
cc7f2c8877
commit
3dcfaf9783
15 changed files with 1 additions and 381 deletions
|
|
@ -550,48 +550,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
});
|
||||
//Temporary, or not
|
||||
ConsoleController.AddCommand("tow", _ => TowShip());
|
||||
|
||||
// ConsoleController.AddCommand("pingscene",
|
||||
// _ =>
|
||||
// {
|
||||
// var startTime = Time.time;
|
||||
// Observable.EveryUpdate().TakeWhile(_ => Time.time - startTime < 5).Subscribe(
|
||||
// _ => Debug.Log($"{(int) (Time.time - startTime)}"),
|
||||
// () =>
|
||||
// {
|
||||
// var nearestFaction = CurrentSector.Factions.MinBy(f => CurrentSector.HomeZones[f].Distance[Zone.SectorZone]);
|
||||
// var nearestFactionHomeZone = CurrentSector.HomeZones[nearestFaction];
|
||||
// var factionPresence = nearestFaction.InfluenceDistance - nearestFactionHomeZone.Distance[Zone.SectorZone] + 1;
|
||||
//
|
||||
// var loadoutGenerator = new LoadoutGenerator(
|
||||
// ref ItemManager.Random,
|
||||
// ItemManager,
|
||||
// CurrentSector,
|
||||
// Zone.SectorZone,
|
||||
// nearestFaction,
|
||||
// .5f);
|
||||
//
|
||||
// for (int i = 0; i < 8; i++)
|
||||
// {
|
||||
// var ship = EntitySerializer.Unpack(ItemManager, Zone, loadoutGenerator.GenerateShipLoadout(), true);
|
||||
// ship.Position.xz = _currentEntity.Position.xz +
|
||||
// ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
||||
// ship.Zone = Zone;
|
||||
// Zone.Entities.Add(ship);
|
||||
// ship.Activate();
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < 8; i++)
|
||||
// {
|
||||
// var turret = EntitySerializer.Unpack(ItemManager, Zone, loadoutGenerator.GenerateTurretLoadout(), true);
|
||||
// turret.Position.xz = _currentEntity.Position.xz +
|
||||
// ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
||||
// turret.Zone = Zone;
|
||||
// Zone.Entities.Add(turret);
|
||||
// turret.Activate();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
public void BeginDrag(DragObject dragObject)
|
||||
|
|
|
|||
|
|
@ -35,21 +35,6 @@ public class CultCache
|
|||
private readonly Dictionary<Type, DatabaseEntry> _globals = new Dictionary<Type, DatabaseEntry>();
|
||||
private readonly Dictionary<Type, HashSet<DatabaseEntry>> _types = new Dictionary<Type, HashSet<DatabaseEntry>>();
|
||||
|
||||
// private readonly Dictionary<Type, (DirectoryInfo directory, List<Guid> entries)> _externalTypes = new Dictionary<Type, (DirectoryInfo directory, List<Guid> entries)>();
|
||||
|
||||
// private class ExternalEntry
|
||||
// {
|
||||
// public string FilePath;
|
||||
// public DatabaseEntry Entry;
|
||||
//
|
||||
// public ExternalEntry(string filePath, DatabaseEntry entry)
|
||||
// {
|
||||
// FilePath = filePath;
|
||||
// Entry = entry;
|
||||
// }
|
||||
// }
|
||||
// private readonly Dictionary<Guid, ExternalEntry> _externalEntries = new Dictionary<Guid, ExternalEntry>();
|
||||
|
||||
public IEnumerable<DatabaseEntry> AllEntries => _entries.Values;
|
||||
|
||||
public CultCache()
|
||||
|
|
|
|||
|
|
@ -845,42 +845,6 @@ public abstract class Entity
|
|||
yield return b;
|
||||
}
|
||||
|
||||
// public IEnumerable<(T t, Switch s)> GetSwitch<T>() where T : class, IBehavior
|
||||
// {
|
||||
// foreach (var equippedItem in Equipment)
|
||||
// foreach (var group in equippedItem.BehaviorGroups.Values)
|
||||
// foreach(var behavior in group.Behaviors)
|
||||
// if (behavior is T t)
|
||||
// {
|
||||
// var s = group.GetExposed<Switch>();
|
||||
// if (s != null) yield return (t, s);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IEnumerable<(T behavior, Trigger trigger)> GetTrigger<T>() where T : class, IBehavior
|
||||
// {
|
||||
// foreach (var equippedItem in Equipment)
|
||||
// foreach (var group in equippedItem.BehaviorGroups.Values)
|
||||
// foreach(var behavior in group.Behaviors)
|
||||
// if (behavior is T t)
|
||||
// {
|
||||
// var s = group.GetExposed<Trigger>();
|
||||
// if (s != null) yield return (t, s);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IEnumerable<(T behavior, Axis axis)> GetAxis<T>() where T : class, IBehavior
|
||||
// {
|
||||
// foreach (var equippedItem in Equipment)
|
||||
// foreach (var group in equippedItem.BehaviorGroups.Values)
|
||||
// foreach(var behavior in group.Behaviors)
|
||||
// if (behavior is T t)
|
||||
// {
|
||||
// var s = group.GetExposed<Axis>();
|
||||
// if (s != null) yield return (t, s);
|
||||
// }
|
||||
// }
|
||||
|
||||
public virtual void Update(float delta)
|
||||
{
|
||||
var hullData = ItemManager.GetData(Hull) as HullData;
|
||||
|
|
|
|||
|
|
@ -307,21 +307,7 @@ public abstract class ItemData : DatabaseEntry, INamedEntry
|
|||
[DatabaseCategory("Items"), Inspectable, MessagePackObject]
|
||||
public class SimpleCommodityData : ItemData
|
||||
{
|
||||
// // Types of body where this resource can be found
|
||||
// [InspectableField, JsonProperty("resourceBodyType"), Key(6)]
|
||||
// public BodyType ResourceBodyType;
|
||||
//
|
||||
// // Link to map(s) controlling density of resource, multiplied together when more than one
|
||||
// [InspectableDatabaseLink(typeof(GalaxyMapLayerData)), JsonProperty("resourceDensity"), Key(7)]
|
||||
// public List<Guid> ResourceDensity = new List<Guid>();
|
||||
//
|
||||
// // Controls the lowest value in the resource distribution curve
|
||||
// [InspectableField, JsonProperty("distribution"), Key(8)]
|
||||
// public ExponentialLerp Distribution;
|
||||
//
|
||||
// // Minimum amount of resources needed for presence to register
|
||||
// [InspectableField, JsonProperty("floor"), Key(11)]
|
||||
// public float Floor = 5f;
|
||||
// MessagePack keys 6, 7, 8 and 11 belonged to removed resource-distribution fields; do not reuse them.
|
||||
|
||||
[Inspectable, JsonProperty("maxStackSize"), Key(9)]
|
||||
public int MaxStack = 10;
|
||||
|
|
|
|||
|
|
@ -59,54 +59,6 @@ public class ItemManager
|
|||
_logger(s);
|
||||
}
|
||||
|
||||
// public void Update()
|
||||
// {
|
||||
// foreach(var zone in _zones.Values)
|
||||
// zone.Update((float) Time, _deltaTime);
|
||||
//
|
||||
// foreach (var corporation in Cache.GetAll<Corporation>())
|
||||
// {
|
||||
// foreach (var tasks in corporation.Tasks
|
||||
// .Select(id => Cache.Get<AgentTask>(id)) // Fetch the tasks from the database cache
|
||||
// .Where(task => !task.Reserved) // Filter out tasks that have already been reserved
|
||||
// .GroupBy(task => task.Type)) // Group tasks by type
|
||||
// {
|
||||
// // Create a list of available controllers for this task type
|
||||
// var availableControllers = CorporationControllers[corporation.ID]
|
||||
// .Where(controller => controller.Available && controller.TaskType == tasks.Key).ToList();
|
||||
//
|
||||
// // Iterate over the highest priority tasks for which controllers are available
|
||||
// foreach (var task in tasks.OrderByDescending(task => task.Priority).Take(availableControllers.Count))
|
||||
// {
|
||||
// // Find the nearest controller for this task
|
||||
// IController nearestController = availableControllers[0];
|
||||
// List<ZoneDefinition> nearestControllerPath = FindPath(GalaxyZones[availableControllers.First().Zone.Data.ID], GalaxyZones[task.Zone], true);
|
||||
// foreach (var controller in availableControllers.Skip(1))
|
||||
// {
|
||||
// var path = FindPath(GalaxyZones[controller.Zone.Data.ID], GalaxyZones[task.Zone], true);
|
||||
// if (path.Count < nearestControllerPath.Count)
|
||||
// {
|
||||
// nearestControllerPath = path;
|
||||
// nearestController = controller;
|
||||
// }
|
||||
// }
|
||||
// task.Reserved = true;
|
||||
// nearestController.AssignTask(task.ID);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// public int ItemTier(CraftedItemData itemData)
|
||||
// {
|
||||
// if (Tier.ContainsKey(itemData)) return Tier[itemData];
|
||||
//
|
||||
// Tier[itemData] = itemData.Ingredients.Keys.Max(ci => _cache.Get<ItemData>(ci) is CraftedItemData craftableIngredient ? ItemTier(craftableIngredient) : 0);
|
||||
//
|
||||
// return Tier[itemData];
|
||||
// }
|
||||
|
||||
public SimpleCommodityData GetData(SimpleCommodity item)
|
||||
{
|
||||
return item.Data.Value as SimpleCommodityData;
|
||||
|
|
|
|||
|
|
@ -30,18 +30,6 @@ public class LoadoutGenerator
|
|||
Faction = faction;
|
||||
PriceExponent = priceExponent;
|
||||
}
|
||||
//
|
||||
// public LoadoutGenerator(
|
||||
// ref Random random,
|
||||
// ItemManager itemManager,
|
||||
// Faction faction,
|
||||
// float priceExponent)
|
||||
// {
|
||||
// Random = random;
|
||||
// ItemManager = itemManager;
|
||||
// Faction = faction;
|
||||
// PriceExponent = priceExponent;
|
||||
// }
|
||||
|
||||
public EntityPack GenerateShipLoadout(Predicate<HullData> hullFilter = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,20 +106,6 @@ public class StoryProcessor : IZoneResolver, IFactionResolver
|
|||
// If the story has already been read / compiled, return it directly
|
||||
if (_processedStories.ContainsKey(fileName)) return _processedStories[fileName];
|
||||
|
||||
// var compiledFileName = Path.Combine(inkFile.Directory.FullName, $"{fileName}.json");
|
||||
//
|
||||
// // Calculate a hash of the ink file
|
||||
// var hash = File.ReadAllBytes(inkFile.FullName).GetHashSHA1();
|
||||
//
|
||||
// if (File.Exists(compiledFileName) && // If a compiled version of the ink file exists
|
||||
// Settings.HashedStoryFiles.ContainsKey(fileName) && // And its hash has been saved
|
||||
// hash == Settings.HashedStoryFiles[fileName]) // And the saved hash matches the current hash
|
||||
// {
|
||||
// // Load the story from the existing compiled JSON representation
|
||||
// return new Story(File.ReadAllText(compiledFileName));
|
||||
// }
|
||||
//
|
||||
// Settings.HashedStoryFiles[fileName] = hash;
|
||||
var compiler = new Compiler(File.ReadAllText(inkFile.FullName), new Compiler.Options
|
||||
{
|
||||
countAllVisits = true,
|
||||
|
|
|
|||
|
|
@ -54,24 +54,6 @@ public static class WeightedSampleElimination
|
|||
DoEliminate( inputPoints, outputPoints, d_max, weightFunction, densityFunction );
|
||||
}
|
||||
|
||||
// public static void Eliminate(
|
||||
// float2[] inputPoints,
|
||||
// float2[] outputPoints,
|
||||
// float d_max = 0,
|
||||
// float alpha = 8,
|
||||
// float beta = 0.65f,
|
||||
// float gamma = 1.5f)
|
||||
// {
|
||||
// if ( d_max < .001f ) d_max = 2 * GetMaxPoissonDiskRadius( outputPoints.Length );
|
||||
// float d_min = d_max * GetWeightLimitFraction( inputPoints.Length, outputPoints.Length, beta, gamma );
|
||||
// Eliminate( inputPoints, outputPoints, (p0, p1, d2, dmax, density) =>
|
||||
// {
|
||||
// float d = sqrt(d2);
|
||||
// if ( d < d_min ) d = d_min;
|
||||
// return pow( 1f / (d / dmax + .01f), alpha );
|
||||
// }, v => 1, d_max);
|
||||
// }
|
||||
|
||||
public static void Eliminate(
|
||||
float2[] inputPoints,
|
||||
float2[] outputPoints,
|
||||
|
|
|
|||
|
|
@ -37,38 +37,6 @@ public class ZonePack
|
|||
|
||||
}
|
||||
|
||||
// [DatabaseCategory("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
// public class StationData : DatabaseEntry, INamedEntry
|
||||
// {
|
||||
// [JsonProperty("name"), Key(1)]
|
||||
// public string Name;
|
||||
//
|
||||
// // Can be Planet or Orbit
|
||||
// [JsonProperty("parent"), Key(2)]
|
||||
// public Guid Parent;
|
||||
//
|
||||
// [JsonProperty("owner"), Key(3)]
|
||||
// public Guid Owner;
|
||||
//
|
||||
// [JsonProperty("inventory"), Key(4)]
|
||||
// public List<ItemInstance> Inventory = new List<ItemInstance>();
|
||||
//
|
||||
// [JsonProperty("buying"), Key(5)]
|
||||
// public Dictionary<Guid, float> BuyPrices = new Dictionary<Guid, float>();
|
||||
//
|
||||
// [JsonProperty("selling"), Key(6)]
|
||||
// public Dictionary<Guid, float> SellPrices = new Dictionary<Guid, float>();
|
||||
//
|
||||
// [JsonProperty("zone"), Key(7)]
|
||||
// public Guid Zone;
|
||||
//
|
||||
// [IgnoreMember] public string EntryName
|
||||
// {
|
||||
// get => Name;
|
||||
// set => Name = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
[MessagePackObject,
|
||||
JsonObject(MemberSerialization.OptIn),
|
||||
Union(0, typeof(PlanetData)),
|
||||
|
|
|
|||
|
|
@ -28,24 +28,6 @@ public class InventoryMenu : MonoBehaviour
|
|||
private InventoryPanel _selectedPanel;
|
||||
private ItemInstance _selectedItem;
|
||||
private ItemData _selectedItemData;
|
||||
// private List<IDisposable> _backgroundSubscriptions;
|
||||
|
||||
// private ItemInstance _dragItem;
|
||||
// private Transform[] _dragCells;
|
||||
// private Vector2[] _dragOffsets;
|
||||
// private int2 _dragCellOffset;
|
||||
// private ItemRotation _originalRotation;
|
||||
// //private Shape _previousFakeOccupancy;
|
||||
// private Shape _originalOccupancy;
|
||||
// private EquippedItem _originalEquippedItem;
|
||||
// private InventoryPanel _originalPanel;
|
||||
//
|
||||
// private InventoryPanel _dragTargetPanel;
|
||||
// private int2 _dragTargetPosition;
|
||||
// private int2 _lastDragPosition;
|
||||
// private bool _dragTargetValid;
|
||||
// private bool _destroyItem;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// Background.gameObject.SetActive(true);
|
||||
|
|
|
|||
|
|
@ -105,41 +105,7 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
|
|||
Properties.AddProperty("Ships", () => shipCount);
|
||||
}
|
||||
});
|
||||
|
||||
// PathAnimationButton.onClick.AddListener(() =>
|
||||
// {
|
||||
// Map.StartCoroutine(AnimatePath());
|
||||
// });
|
||||
}
|
||||
|
||||
// private IEnumerator AnimatePath()
|
||||
// {
|
||||
// var pathZones = ActionGameManager.CurrentSector.ExitPath;
|
||||
// LegendPanel.SetActive(false);
|
||||
// PathAnimationButton.gameObject.SetActive(false);
|
||||
//
|
||||
// var revealCount = ActionGameManager.CurrentSector.Entrance.Distance[ActionGameManager.CurrentSector.Exit];
|
||||
// Map.StartReveal(
|
||||
// PathAnimationDuration / revealCount * (LinkAnimationDuration / (IconAnimationDuration + LinkAnimationDuration)),
|
||||
// PathAnimationDuration / revealCount * (IconAnimationDuration / (IconAnimationDuration + LinkAnimationDuration)));
|
||||
// MainCamera.enabled = false;
|
||||
// SectorCamera.targetTexture = null;
|
||||
// Canvas.gameObject.SetActive(false);
|
||||
// SectorCamera.gameObject.SetActive(true);
|
||||
//
|
||||
// var pathAnimationLerp = 0f;
|
||||
// while (pathAnimationLerp < 1)
|
||||
// {
|
||||
// var currentTargetZone = pathZones[(int) (pathZones.Length * pathAnimationLerp)];
|
||||
// _position = lerp(_position, currentTargetZone.Position, PathAnimationDamping);
|
||||
// pathAnimationLerp += Time.deltaTime / (PathAnimationDuration * PathAnimationDurationPadding);
|
||||
// UpdateCamera();
|
||||
// yield return null;
|
||||
// }
|
||||
//
|
||||
// LegendPanel.SetActive(true);
|
||||
// PathAnimationButton.gameObject.SetActive(true);
|
||||
// }
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -157,27 +157,6 @@ public class Spreadsheet : MonoBehaviour
|
|||
row.ApplyColumnSizes(_columnSizes);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
// ShowData(
|
||||
// new []{"Column 1", "Column 2", "Column 3", "Column 4", "Column 5"},
|
||||
// new []{2,1,1,1,1},
|
||||
// Enumerable.Range(0,10)
|
||||
// .Select(i=>new SpreadsheetEntryRow
|
||||
// {
|
||||
// Columns = Enumerable.Range(0,5).Select(j=>
|
||||
// {
|
||||
// var value = Random.Range(0, 10000);
|
||||
// return new SpreadsheetEntryColumn
|
||||
// {
|
||||
// Output = () => $"c{(j+1).ToString()}:{value.ToString()}",
|
||||
// SortKey = value
|
||||
// };
|
||||
// }).ToArray()
|
||||
// }).ToArray()
|
||||
// );
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -58,32 +58,4 @@ public class PropertiesList : PropertiesPanel
|
|||
}
|
||||
OnExpand?.Invoke(_expanded);
|
||||
}
|
||||
|
||||
// public override PropertyLabel AddProperty(string name, Func<string> read = null, Action<PointerEventData> onClick = null, bool radio = false)
|
||||
// {
|
||||
// var prop = base.AddProperty(name, read, onClick, radio);
|
||||
// prop.gameObject.SetActive(false);
|
||||
// return prop;
|
||||
// }
|
||||
//
|
||||
// public override PropertiesList AddList(string name)
|
||||
// {
|
||||
// var list = base.AddList(name);
|
||||
// list.gameObject.SetActive(false);
|
||||
// return list;
|
||||
// }
|
||||
//
|
||||
// public override RectTransform AddSection(string name)
|
||||
// {
|
||||
// var section = base.AddSection(name);
|
||||
// section.gameObject.SetActive(false);
|
||||
// return section;
|
||||
// }
|
||||
//
|
||||
// public override PropertyButton AddButton(string name, Action<PointerEventData> onClick)
|
||||
// {
|
||||
// var button = base.AddButton(name, onClick);
|
||||
// button.gameObject.SetActive(false);
|
||||
// return button;
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,29 +357,6 @@ public class PropertiesPanel : MonoBehaviour
|
|||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
// public void Inspect(Entity entity)
|
||||
// {
|
||||
// Clear();
|
||||
// Title.text = entity.Name;
|
||||
// var hullData = Context.GetData(entity.Hull) as HullData;
|
||||
// AddSection(
|
||||
// hullData.HullType == HullType.Ship ? "Ship" :
|
||||
// hullData.HullType == HullType.Station ? "Station" :
|
||||
// "Platform");
|
||||
// //AddList(hullData.Name).Inspect(hull, entity);
|
||||
// //PropertiesPanel.AddProperty("Hull", () => $"{hullData.Name}");
|
||||
// AddEntityProperties(entity);
|
||||
// //cargoList.SetExpanded(false,true);
|
||||
//
|
||||
// RefreshValues();
|
||||
// }
|
||||
|
||||
// private void AddEntityProperties(Entity entity)
|
||||
// {
|
||||
// AddField("Name", () => entity.Name, name => entity.Name = name);
|
||||
// AddProperty("Mass", () => $"{entity.Mass.SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
// }
|
||||
|
||||
private void AddItemProperties(ItemInstance item)
|
||||
{
|
||||
var data = item.Data.Value;
|
||||
|
|
|
|||
|
|
@ -421,31 +421,6 @@ public class ZoneRenderer : MonoBehaviour
|
|||
LODHandler.FindPlanets();
|
||||
}
|
||||
|
||||
// private void Update()
|
||||
// {
|
||||
// if (Tour)
|
||||
// {
|
||||
// _tourTimer -= UnityEngine.Time.deltaTime;
|
||||
// if (_tourTimer < 0)
|
||||
// {
|
||||
// _tourTimer = TourSwitchTime;
|
||||
// _tourIndex = (_tourIndex + 1) % _tourPlanets.Count;
|
||||
// SceneCamera.Follow = _tourPlanets[_tourIndex].Item1;
|
||||
// SceneCamera.LookAt = _tourPlanets[_tourIndex].Item2;
|
||||
// if(_tourIndex==0) Debug.Log("Tour Complete!");
|
||||
// }
|
||||
// // if(_tourIndex>=0)
|
||||
// // {
|
||||
// // var offset = (SceneCamera.Follow.position - SceneCamera.LookAt.position);
|
||||
// // offset.y = 0;
|
||||
// // offset = offset.normalized * TourFollowDistance;
|
||||
// // offset.y = TourHeightOffset;
|
||||
// // offset = Quaternion.AngleAxis(TourFollowOffsetDegrees, Vector3.up) * offset;
|
||||
// // _transposer.m_FollowOffset = offset;
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
void Update()
|
||||
{
|
||||
var maxDepth = 0f;
|
||||
|
|
|
|||
Loading…
Reference in a new issue