Skip to content

Commit

Permalink
312 create data models take2 (#316)
Browse files Browse the repository at this point in the history
Not actually creating the data models, but a little refactoring

* Rename FrEee.Core, this time to FrEee.Core.Domain

* Actually reference the domain project

* Move IReferrrable to Objects.GameState

* Store a GameSetup inside the Galaxy, instead of all its properties
  • Loading branch information
ekolis committed Jun 14, 2024
1 parent d23739e commit eb17005
Show file tree
Hide file tree
Showing 397 changed files with 1,266 additions and 1,429 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Reflection;
using FrEee.Utility;
using FrEee.Objects.Civilization.Orders;
using FrEee.Serialization;
using FrEee.Objects.Technology;
using FrEee.Objects.GameState;
using FrEee.Modding;
Expand Down Expand Up @@ -281,7 +280,7 @@ internal static Visibility CheckSpaceObjectVisibility(this ISpaceObject sobj, Em
var seers = sys.FindSpaceObjects<ISpaceObject>(s => s.Owner == emp && !s.IsMemory);
if (!seers.Any() || sobj.IsHiddenFrom(emp))
{
if (Galaxy.Current.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp))
if (Galaxy.Current.GameSetup.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp))
return Visibility.Visible;
if (emp.AllSystemsExploredFromStart)
return Visibility.Fogged;
Expand Down Expand Up @@ -356,7 +355,7 @@ public static bool HasVisibility(this ISpaceObject sobj, Empire emp, Visibility
var seers = sys.FindSpaceObjects<ISpaceObject>(s => s.Owner == emp && !s.IsMemory);
if (!seers.Any() || sobj.IsHiddenFrom(emp))
{
if (Galaxy.Current.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp))
if (Galaxy.Current.GameSetup.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp))
return Visibility.Visible >= desiredVisibility;
if (emp.AllSystemsExploredFromStart)
return Visibility.Fogged >= desiredVisibility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ public static ResourceQuantity StandardIncome(this IIncomeProducer o)
var amount = abil.Value1.ToInt();

if (resource.HasValue)
amount = Galaxy.Current.StandardMiningModel.GetRate(amount, o.ResourceValue[resource], pcts[resource] / 100d);
amount = Galaxy.Current.GameSetup.StandardMiningModel.GetRate(amount, o.ResourceValue[resource], pcts[resource] / 100d);

income.Add(resource, amount);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Linq;
using FrEee.Objects.GameState;
using FrEee.Serialization;
using FrEee.Utility;

namespace FrEee.Modding.Abilities;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FrEee.Serialization;
using FrEee.Objects.GameState;
using System.Collections.Generic;

namespace FrEee.Modding.Abilities;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FrEee.Objects.GameState;
using FrEee.Serialization;
using System.Collections.Generic;

namespace FrEee.Modding;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FrEee.Objects.GameState;
using FrEee.Serialization;
using System.Collections.Generic;
using System.Linq;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public AsteroidField Instantiate()
if (abil != null)
asteroids.IntrinsicAbilities.Add(abil);

asteroids.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.MinSpawnedAsteroidValue, Galaxy.Current.MaxSpawnedAsteroidValue);
asteroids.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.MinSpawnedAsteroidValue, Galaxy.Current.MaxSpawnedAsteroidValue);
asteroids.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.MinSpawnedAsteroidValue, Galaxy.Current.MaxSpawnedAsteroidValue);
asteroids.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedAsteroidValue, Galaxy.Current.GameSetup.MaxSpawnedAsteroidValue);
asteroids.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedAsteroidValue, Galaxy.Current.GameSetup.MaxSpawnedAsteroidValue);
asteroids.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedAsteroidValue, Galaxy.Current.GameSetup.MaxSpawnedAsteroidValue);

return asteroids;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,7 @@ public Galaxy Instantiate()
public Galaxy Instantiate(Status status, double desiredProgress, PRNG dice)
{
var gal = new Galaxy();
gal.Width = GameSetup.GalaxySize.Width;
gal.Height = GameSetup.GalaxySize.Height;
gal.MinPlanetValue = GameSetup.MinPlanetValue;
gal.MinSpawnedPlanetValue = GameSetup.MinSpawnedPlanetValue;
gal.MaxSpawnedPlanetValue = GameSetup.MaxSpawnedPlanetValue;
gal.MaxPlanetValue = GameSetup.MaxPlanetValue;
gal.MinAsteroidValue = GameSetup.MinAsteroidValue;
gal.MinSpawnedAsteroidValue = GameSetup.MinSpawnedAsteroidValue;
gal.MaxSpawnedAsteroidValue = GameSetup.MaxSpawnedAsteroidValue;
gal.EventFrequency = GameSetup.EventFrequency;
gal.MaximumEventSeverity = GameSetup.MaximumEventSeverity;
gal.GameSetup = GameSetup;
var bounds = new Rectangle(-GameSetup.GalaxySize.Width / 2, -GameSetup.GalaxySize.Height / 2, GameSetup.GalaxySize.Width, GameSetup.GalaxySize.Height);

var unusedNames = new List<string>(Mod.Current.StarSystemNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public Planet Instantiate()
if (abil != null)
planet.IntrinsicAbilities.Add(abil);

planet.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.MinSpawnedPlanetValue, Galaxy.Current.MaxSpawnedPlanetValue);
planet.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.MinSpawnedPlanetValue, Galaxy.Current.MaxSpawnedPlanetValue);
planet.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.MinSpawnedPlanetValue, Galaxy.Current.MaxSpawnedPlanetValue);
planet.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedPlanetValue, Galaxy.Current.GameSetup.MaxSpawnedPlanetValue);
planet.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedPlanetValue, Galaxy.Current.GameSetup.MaxSpawnedPlanetValue);
planet.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedPlanetValue, Galaxy.Current.GameSetup.MaxSpawnedPlanetValue);

planet.ConditionsAmount = RandomHelper.Range(Mod.Current.Settings.MinRandomPlanetConditions, Mod.Current.Settings.MaxRandomPlanetConditions);

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using FrEee.Objects.GameState;
using FrEee.Extensions;
using FrEee.Utility;
using FrEee.Serialization;
using FrEee.Modding.Abilities;

namespace FrEee.Objects.Civilization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using FrEee.Objects.Civilization;
using FrEee.Objects.GameState;
using FrEee.Objects.Technology;
using FrEee.Serialization;
using FrEee.Utility;
namespace FrEee.Objects.Civilization.Construction;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FrEee.Objects.GameState;
using FrEee.Serialization;

namespace FrEee.Objects.Civilization.Diplomacy.Messages;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public bool AllSystemsExploredFromStart
get
{
if (allSystemsExploredFromStart is null)
allSystemsExploredFromStart = Galaxy.Current.AllSystemsExploredFromStart || this.HasAbility("Galaxy Seen");
allSystemsExploredFromStart = Galaxy.Current.GameSetup.AllSystemsExplored || this.HasAbility("Galaxy Seen");
return allSystemsExploredFromStart.Value;
}
}
Expand Down Expand Up @@ -867,7 +867,7 @@ public void ComputeResearchProgress()
{
// can we see it?
// TODO - rankings too, not just scores
var disp = Galaxy.Current.ScoreDisplay;
var disp = Galaxy.Current.GameSetup.ScoreDisplay;
bool showit = false;
if (viewer == null)
showit = true; // host can see everyone's scores
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FrEee.Objects.GameState;
using FrEee.Serialization;

namespace FrEee.Objects.Civilization;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using FrEee.Objects.Civilization.Orders;
using FrEee.Serialization;
using FrEee.Objects.GameState;

namespace FrEee.Objects.Civilization;

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void Execute(IOrderable ord)

// figure out where the warp point goes, according to our game setup's warp point placement strategy
// only in the target system - in the source system we get a warp point at the sector where the WP opener was
var toSector = Galaxy.Current.WarpPointPlacementStrategy.GetWarpPointSector(fromSys.Location, toSys.Location);
var toSector = Galaxy.Current.GameSetup.WarpPointPlacementStrategy.GetWarpPointSector(fromSys.Location, toSys.Location);

// create the warp points
var wp1 = wpt1.Instantiate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ public IEnumerable<LogMessage> GetErrors(IOrderable o)
// no such colony module
yield return sobj.CreateLogMessage(sobj + " cannot colonize " + Planet + " because it lacks a " + Planet.Surface + " colony module.", LogMessageType.Warning);
}
if (Galaxy.Current.CanColonizeOnlyBreathable && Planet.Atmosphere != sobj.Owner.PrimaryRace.NativeAtmosphere)
if (Galaxy.Current.GameSetup.CanColonizeOnlyBreathable && Planet.Atmosphere != sobj.Owner.PrimaryRace.NativeAtmosphere)
{
// can only colonize breathable atmosphere (due to game setup option)
yield return sobj.CreateLogMessage(sobj + " cannot colonize " + Planet + " because we can only colonize " + sobj.Owner.PrimaryRace.NativeAtmosphere + " planets.", LogMessageType.Warning);
}
if (Galaxy.Current.CanColonizeOnlyHomeworldSurface && Planet.Surface != sobj.Owner.PrimaryRace.NativeSurface)
if (Galaxy.Current.GameSetup.CanColonizeOnlyHomeworldSurface && Planet.Surface != sobj.Owner.PrimaryRace.NativeSurface)
{
// can only colonize breathable atmosphere (due to game setup option)
yield return sobj.CreateLogMessage(sobj + " cannot colonize " + Planet + " because we can only colonize " + sobj.Owner.PrimaryRace.NativeSurface + " planets.", LogMessageType.Warning);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using FrEee.Objects.GameState;
using FrEee.Objects.LogMessages;
using FrEee.Serialization;
using System.Collections.Generic;

namespace FrEee.Objects.Civilization.Orders;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using FrEee.Objects.GameState;
using FrEee.Objects.Space;
using FrEee.Serialization;
using FrEee.Utility;
namespace FrEee.Objects.Civilization.Orders;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Linq;
using FrEee.Objects.GameState;
using FrEee.Utility;
using FrEee.Serialization;
using FrEee.Modding.Abilities;

namespace FrEee.Objects.Civilization;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using FrEee.Objects.Civilization.Orders;
using FrEee.Objects.GameState;
using FrEee.Objects.LogMessages;
using FrEee.Serialization;
using System;
using System.Collections.Generic;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using FrEee.Objects.Vehicles;
using FrEee.Serialization;
using FrEee.Objects.GameState;

namespace FrEee.Objects.Commands;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using FrEee.Objects.Civilization;
using FrEee.Objects.GameState;
using FrEee.Objects.Space;
using FrEee.Serialization;
using System.Collections.Generic;

namespace FrEee.Objects.Commands;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FrEee.Objects.Civilization;
using FrEee.Serialization;
using FrEee.Objects.GameState;
using System.Collections.Generic;

namespace FrEee.Objects.Commands;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using FrEee.Objects.Civilization;
using FrEee.Objects.GameState;
using FrEee.Serialization;
using System.Collections.Generic;

namespace FrEee.Objects.Commands;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using FrEee.Extensions;
using System.Collections.Generic;
using FrEee.Objects.Civilization.Diplomacy.Messages;
using FrEee.Serialization;
using FrEee.Objects.GameState;

namespace FrEee.Objects.Commands;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FrEee.Objects.Civilization;
using FrEee.Serialization;
using FrEee.Objects.GameState;
using System;
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using FrEee.Serialization;
using FrEee.Objects.GameState;
using FrEee.Extensions;
using FrEee.Utility;
Expand Down
File renamed without changes.
Loading

0 comments on commit eb17005

Please sign in to comment.