Compare commits

..

No commits in common. '159a0ad6096f4cb8301218f969db30d40e20d2d8' and 'd7ef4afdc7bf64240b284f95fc32f79f0d7915df' have entirely different histories.

@ -1,11 +1,9 @@
using System; using System;
using CriticalPathAnalyzer.Shared.Packets.C2S; using CriticalPathAnalyzer.Shared.Packets.C2S;
using CriticalPathAnalyzer.Shared.Packets.S2C; using CriticalPathAnalyzer.Shared.Packets.S2C;
using JimmysUnityUtilities;
using LogicAPI.Data; using LogicAPI.Data;
using LogicLog; using LogicLog;
using LogicWorld.Interfaces; using LogicWorld.Interfaces;
using LogicWorld.Outlines;
using LogicWorld.Physics; using LogicWorld.Physics;
using LogicWorld.Players; using LogicWorld.Players;
@ -21,26 +19,21 @@ namespace CriticalPathAnalyzer.Client.Tool {
private static Guid _currentRequestGuid = Guid.NewGuid(); private static Guid _currentRequestGuid = Guid.NewGuid();
private static AnalyzePathResponse _response; private static AnalyzePathResponse _response;
private static readonly OutlineData StartOutline = new OutlineData(new Color24(0x00ff00));
private static readonly OutlineData EndOutline = new OutlineData(new Color24(0xff0000));
public static void Init(ILogicLogger logger) { public static void Init(ILogicLogger logger) {
_logger = logger; _logger = logger;
} }
public static void Clear() { public static void Clear() {
PathHighLighter.RemoveHighLighting();
Outliner.RemoveOutline(_startPegAddress);
Outliner.RemoveOutline(_endPegAddress);
_startPegAddress = PegAddress.Empty; _startPegAddress = PegAddress.Empty;
_endPegAddress = PegAddress.Empty; _endPegAddress = PegAddress.Empty;
PathHighLighter.RemoveHighLighting();
} }
private static PegAddress RayCastPeg() { private static PegAddress? RayCastPeg() {
// Ray-cast into the world to find what the player is looking at // Ray-cast into the world to find what the player is looking at
HitInfo hitInfo = PlayerCaster.CameraCast(Masks.Environment | Masks.Structure | Masks.Peg | Masks.Wire); HitInfo hitInfo = PlayerCaster.CameraCast(Masks.Environment | Masks.Structure | Masks.Peg | Masks.Wire);
if (!hitInfo.HitSomething) { if (!hitInfo.HitSomething) {
return PegAddress.Empty; return null;
} }
// Resolve hit target: // Resolve hit target:
@ -57,17 +50,15 @@ namespace CriticalPathAnalyzer.Client.Tool {
return wire.Point1.IsInputAddress() ? wire.Point1 : wire.Point2; return wire.Point1.IsInputAddress() ? wire.Point1 : wire.Point2;
} }
return PegAddress.Empty; return null;
} }
public static void SelectPathStart() { public static void SelectPathStart() {
_logger.Info("Analyze Path Start"); _logger.Info("Analyze Path Start");
PegAddress pegAddress = RayCastPeg(); PegAddress? pegAddress = RayCastPeg();
if (!pegAddress.IsEmpty()) { if (pegAddress != null) {
Outliner.RemoveOutline(_startPegAddress); _startPegAddress = pegAddress.Value;
Outliner.Outline(pegAddress, StartOutline); if (_startPegAddress != null && _endPegAddress != null) {
_startPegAddress = pegAddress;
if (!_startPegAddress.IsEmpty() && !_endPegAddress.IsEmpty()) {
CalculateCriticalPath(); CalculateCriticalPath();
} }
} }
@ -75,12 +66,10 @@ namespace CriticalPathAnalyzer.Client.Tool {
public static void SelectPathEnd() { public static void SelectPathEnd() {
_logger.Info("Analyze Path End"); _logger.Info("Analyze Path End");
PegAddress pegAddress = RayCastPeg(); PegAddress? pegAddress = RayCastPeg();
if (!pegAddress.IsEmpty()) { if (pegAddress != null) {
Outliner.RemoveOutline(_endPegAddress); _endPegAddress = pegAddress.Value;
Outliner.Outline(pegAddress, EndOutline); if (_startPegAddress != null && _endPegAddress != null) {
_endPegAddress = pegAddress;
if (!_startPegAddress.IsEmpty() && !_endPegAddress.IsEmpty()) {
CalculateCriticalPath(); CalculateCriticalPath();
} }
} }

Loading…
Cancel
Save