-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,003 additions
and
210 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
Subsystem/AbilityAttributesPatch.cs → Subsystem/Patch/AbilityAttributesPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using BBI.Game.Data; | ||
|
||
namespace Subsystem | ||
namespace Subsystem.Patch | ||
{ | ||
public class AbilityAttributesPatch | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
Subsystem/AttributesPatch.cs → Subsystem/Patch/AttributesPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
Subsystem/EntityTypePatch.cs → Subsystem/Patch/EntityTypePatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using BBI.Game.Data; | ||
|
||
namespace Subsystem.Patch | ||
{ | ||
public class HangarBayPatch | ||
{ | ||
public string EntityType { get; set; } | ||
public int? MaxCount { get; set; } | ||
public bool? UsesStrictClassMatching { get; set; } | ||
public UnitClass? HoldsClass { get; set; } | ||
public int? SlotCount { get; set; } | ||
public string UndockPresCtrlBone { get; set; } | ||
public double? UndockTotalSeconds { get; set; } | ||
public double? UndockAnimationSeconds { get; set; } | ||
public double? UndockSlotStaggerSeconds { get; set; } | ||
public double? UndockXOffsetPos { get; set; } | ||
public double? UndockYOffsetPos { get; set; } | ||
public double? UndockSlotXSeperationOffset { get; set; } | ||
public double? DegreesOffsetUndockAngle { get; set; } | ||
public double? UndockSpeed { get; set; } | ||
public string DockPresCtrlBone { get; set; } | ||
public double? DockBringInAnimationSeconds { get; set; } | ||
public double? DockSlotStaggerSeconds { get; set; } | ||
public double? MaxDamageCoolingSeconds { get; set; } | ||
public double? MaxPayloadCoolingSeconds { get; set; } | ||
public double? MinDockCoolingSeconds { get; set; } | ||
public double? DockReceivingXOffset { get; set; } | ||
public double? DockReceivingYOffset { get; set; } | ||
public double? DoorAnimationSeconds { get; set; } | ||
public double? UndockLiftTime { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Subsystem.Patch | ||
{ | ||
public class RangeBasedWeaponAttributesPatch | ||
{ | ||
public double? Accuracy { get; set; } | ||
public double? Distance { get; set; } | ||
public double? MinDistance { get; set; } | ||
public bool Remove { get; set; } | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
Subsystem/ResearchItemAttributesPatch.cs → ...stem/Patch/ResearchItemAttributesPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Subsystem/UnitAttributesPatch.cs → Subsystem/Patch/UnitAttributesPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using BBI.Game.Data; | ||
|
||
namespace Subsystem | ||
namespace Subsystem.Patch | ||
{ | ||
public class UnitAttributesPatch | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using BBI.Game.Data; | ||
|
||
namespace Subsystem.Patch | ||
{ | ||
public class UnitDynamicsAttributesPatch | ||
{ | ||
public UnitDriveType? DriveType { get; set; } | ||
public double? Length { get; set; } | ||
public double? Width { get; set; } | ||
public double? MaxSpeed { get; set; } | ||
public double? ReverseFactor { get; set; } | ||
public double? AccelerationTime { get; set; } | ||
public double? BrakingTime { get; set; } | ||
public double? MaxSpeedTurnRadius { get; set; } | ||
public double? MaxEaseIntoTurnTime { get; set; } | ||
public double? DriftType { get; set; } | ||
public double? ReverseDriftMultiplier { get; set; } | ||
public double? DriftOvershootFactor { get; set; } | ||
public double? FishTailingTimeIntervals { get; set; } | ||
public double? FishTailControlRecover { get; set; } | ||
public double? MinDriftSlipSpeed { get; set; } | ||
public double? MaxDriftRecoverTime { get; set; } | ||
public double? MinCruiseSpeed { get; set; } | ||
public double? DeathDriftTime { get; set; } | ||
public bool? PermanentlyImmobile { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Subsystem.Patch | ||
{ | ||
public class UnitHangarAttributesPatch | ||
{ | ||
public Dictionary<string, HangarBayPatch> HangarBays { get; set; } = new Dictionary<string, HangarBayPatch>(); | ||
public double? AlignmentTime { get; set; } | ||
public double? ApproachTime { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using BBI.Game.Data; | ||
|
||
namespace Subsystem.Patch | ||
{ | ||
public class UnitMovementAttributesPatch | ||
{ | ||
public UnitDriveType? DriveType { get; set; } | ||
public UnitDynamicsAttributesPatch Dynamics { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
|
||
namespace Subsystem | ||
{ | ||
public class PropertyAccessor<T> | ||
{ | ||
private Func<T> getter; | ||
private Action<T> setter; | ||
|
||
public T Get() => getter(); | ||
public void Set(T value) => setter(value); | ||
public string Name { get; private set; } | ||
|
||
public PropertyAccessor(Expression<Func<T>> expression) | ||
{ | ||
var memberExpression = expression.Body as MemberExpression; | ||
|
||
if (memberExpression == null) | ||
{ | ||
throw new ArgumentException("must be a MemberExpression", nameof(expression)); | ||
} | ||
|
||
var instanceExpression = memberExpression.Expression; | ||
var parameter = Expression.Parameter(typeof(T), "obj"); | ||
|
||
var propertyInfo = memberExpression.Member as PropertyInfo; | ||
|
||
if (propertyInfo == null) | ||
{ | ||
throw new ArgumentException("must refer to a property", nameof(expression)); | ||
} | ||
|
||
Name = propertyInfo.Name; | ||
|
||
getter = Expression.Lambda<Func<T>>(Expression.Call(instanceExpression, propertyInfo.GetGetMethod())).Compile(); | ||
setter = Expression.Lambda<Action<T>>(Expression.Call(instanceExpression, propertyInfo.GetSetMethod(), parameter), parameter).Compile(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace Subsystem | ||
{ | ||
public class StringLogger | ||
{ | ||
private readonly Stack<Scope> scopes = new Stack<Scope>(); | ||
|
||
public StringLogger() | ||
{ | ||
scopes.Push(new Scope()); | ||
} | ||
|
||
public IDisposable BeginScope(string name) | ||
{ | ||
var scope = scopes.Peek(); | ||
var newScope = scope.CreateScope(name); | ||
scopes.Push(newScope); | ||
return new ScopeDisposer(this); | ||
} | ||
|
||
public void Log(string log) | ||
{ | ||
scopes.Peek().AddLog(log); | ||
} | ||
|
||
public string GetLog() | ||
{ | ||
var writer = new StringWriter(); | ||
WriteLog(writer); | ||
return writer.ToString(); | ||
} | ||
|
||
public void WriteLog(TextWriter writer) | ||
{ | ||
writeLog(writer, scopes.Peek(), indent: 0); | ||
} | ||
|
||
private void writeLog(TextWriter writer, Scope scope, int indent) | ||
{ | ||
foreach (var logEntry in scope.LogEntries) | ||
{ | ||
writeIndent(writer, indent); | ||
writer.WriteLine(logEntry.Log); | ||
} | ||
|
||
if (scope.LogEntries.Any()) | ||
{ | ||
writer.WriteLine(); | ||
} | ||
|
||
foreach (var kvp in scope.Scopes) | ||
{ | ||
var childScopeName = kvp.Key; | ||
var childScope = kvp.Value; | ||
|
||
writeIndent(writer, indent); | ||
writer.WriteLine(childScopeName); | ||
writer.WriteLine(); | ||
|
||
writeLog(writer, childScope, indent + 1); | ||
} | ||
} | ||
|
||
private static void writeIndent(TextWriter writer, int indent) | ||
{ | ||
for (var i = 0; i < indent; i++) | ||
{ | ||
writer.Write(" "); | ||
} | ||
} | ||
|
||
private class ScopeDisposer : IDisposable | ||
{ | ||
private readonly StringLogger logger; | ||
|
||
public ScopeDisposer(StringLogger logger) | ||
{ | ||
this.logger = logger; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
logger.scopes.Pop(); | ||
} | ||
} | ||
|
||
private class Scope | ||
{ | ||
public IList<KeyValuePair<string, Scope>> Scopes | ||
{ | ||
get { return new ReadOnlyCollection<KeyValuePair<string, Scope>>(scopes); } | ||
} | ||
|
||
public IList<LogEntry> LogEntries | ||
{ | ||
get { return new ReadOnlyCollection<LogEntry>(logEntries); } | ||
} | ||
|
||
private readonly List<KeyValuePair<string, Scope>> scopes = new List<KeyValuePair<string, Scope>>(); | ||
private readonly List<LogEntry> logEntries = new List<LogEntry>(); | ||
|
||
public void AddLog(string log) | ||
{ | ||
logEntries.Add(new LogEntry(log)); | ||
} | ||
|
||
public Scope CreateScope(string name) | ||
{ | ||
var scope = new Scope(); | ||
scopes.Add(new KeyValuePair<string, Scope>(name, scope)); | ||
return scope; | ||
} | ||
} | ||
|
||
private class LogEntry | ||
{ | ||
public string Log { get; private set; } | ||
|
||
public LogEntry(string log) | ||
{ | ||
Log = log; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.