Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Reverse Engineering UI #1053

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,18 @@ private void UpdateUserInterface(EntityUid uid, ReverseEngineeringMachineCompone
if (!Resolve(uid, ref component))
return;

if (!_ui.TryGetOpenUi(uid, ReverseEngineeringMachineUiKey.Key, out var bui))
return;

EntityUid? item = component.CurrentItem;
if (component.CachedMessage == null)
component.CachedMessage = GetReverseEngineeringScanMessage(component);

var totalTime = TimeSpan.Zero;
var scanning = TryComp<ActiveReverseEngineeringMachineComponent>(uid, out var active);
var canScan = (item != null && !scanning);
var canScan = item != null && !scanning;
var remaining = active != null ? _timing.CurTime - active.StartTime : TimeSpan.Zero;
EntityManager.TryGetNetEntity(item, out var netItem);

var state = new ReverseEngineeringMachineScanUpdateState(netItem, canScan, component.CachedMessage, scanning, component.SafetyOn, component.AutoScan, component.Progress, remaining, component.AnalysisDuration);

_ui.SetUiState(bui.Owner, bui.UiKey, state);
_ui.SetUiState(uid, ReverseEngineeringMachineUiKey.Key, state);
}

private ReverseEngineeringTickResult Roll(ReverseEngineeringMachineComponent component, out int actualRoll)
Expand Down
Loading