-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Station AI overlay * implement * Bunch of ports * Fix a heap of bugs and basic scouting * helldivers * Shuffle interactions a bit * navmap stuff * Revert "navmap stuff" This reverts commit d1f89dd4be83233e22cf5dd062b2581f3c6da062. * AI wires implemented * Fix examines * Optimise the overlay significantly * Back to old static * BUI radial working * lots of work * Saving work * thanks fork * alright * pc * AI upload console * AI upload * stuff * Fix copy-paste shitcode * AI actions * navmap work * Fixes * first impressions * a * reh * Revert "navmap work" This reverts commit 6f63fea6e9245e189f368f97be3e32e9b210580e. * OD * radar * weh * Fix examines * scoop mine eyes * fixes * reh * Optimise * Final round of optimisations * Fixes * fixes
- Loading branch information
1 parent
87c7979
commit d8ae58e
Showing
142 changed files
with
2,278 additions
and
256 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
Content.Client/Silicons/StationAi/StationAiBoundUserInterface.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.Silicons.StationAi; | ||
|
||
public sealed class StationAiBoundUserInterface : BoundUserInterface | ||
{ | ||
private StationAiMenu? _menu; | ||
|
||
public StationAiBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
_menu = this.CreateWindow<StationAiMenu>(); | ||
_menu.Track(Owner); | ||
|
||
_menu.OnAiRadial += args => | ||
{ | ||
SendPredictedMessage(new StationAiRadialMessage() | ||
{ | ||
Event = args, | ||
}); | ||
}; | ||
} | ||
} |
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,13 @@ | ||
<ui:RadialMenu xmlns="https://spacestation14.io" | ||
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls" | ||
BackButtonStyleClass="RadialMenuBackButton" | ||
CloseButtonStyleClass="RadialMenuCloseButton" | ||
VerticalExpand="True" | ||
HorizontalExpand="True" | ||
MinSize="450 450"> | ||
|
||
<!-- Main --> | ||
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" Radius="64" ReserveSpaceForHiddenChildren="False"> | ||
</ui:RadialContainer> | ||
|
||
</ui:RadialMenu> |
128 changes: 128 additions & 0 deletions
128
Content.Client/Silicons/StationAi/StationAiMenu.xaml.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 |
---|---|---|
@@ -0,0 +1,128 @@ | ||
using System.Numerics; | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Client.Silicons.StationAi; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class StationAiMenu : RadialMenu | ||
{ | ||
[Dependency] private readonly IClyde _clyde = default!; | ||
[Dependency] private readonly IEntityManager _entManager = default!; | ||
[Dependency] private readonly IEyeManager _eyeManager = default!; | ||
|
||
public event Action<BaseStationAiAction>? OnAiRadial; | ||
|
||
private EntityUid _tracked; | ||
|
||
public StationAiMenu() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void Track(EntityUid owner) | ||
{ | ||
_tracked = owner; | ||
|
||
if (!_entManager.EntityExists(_tracked)) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
BuildButtons(); | ||
UpdatePosition(); | ||
} | ||
|
||
private void BuildButtons() | ||
{ | ||
var ev = new GetStationAiRadialEvent(); | ||
_entManager.EventBus.RaiseLocalEvent(_tracked, ref ev); | ||
|
||
var main = FindControl<RadialContainer>("Main"); | ||
main.DisposeAllChildren(); | ||
var sprites = _entManager.System<SpriteSystem>(); | ||
|
||
foreach (var action in ev.Actions) | ||
{ | ||
// TODO: This radial boilerplate is quite annoying | ||
var button = new StationAiMenuButton(action.Event) | ||
{ | ||
StyleClasses = { "RadialMenuButton" }, | ||
SetSize = new Vector2(64f, 64f), | ||
ToolTip = action.Tooltip != null ? Loc.GetString(action.Tooltip) : null, | ||
}; | ||
|
||
if (action.Sprite != null) | ||
{ | ||
var texture = sprites.Frame0(action.Sprite); | ||
var scale = Vector2.One; | ||
|
||
if (texture.Width <= 32) | ||
{ | ||
scale *= 2; | ||
} | ||
|
||
var tex = new TextureRect | ||
{ | ||
VerticalAlignment = VAlignment.Center, | ||
HorizontalAlignment = HAlignment.Center, | ||
Texture = texture, | ||
TextureScale = scale, | ||
}; | ||
|
||
button.AddChild(tex); | ||
} | ||
|
||
button.OnPressed += args => | ||
{ | ||
OnAiRadial?.Invoke(action.Event); | ||
Close(); | ||
}; | ||
main.AddChild(button); | ||
} | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
UpdatePosition(); | ||
} | ||
|
||
private void UpdatePosition() | ||
{ | ||
if (!_entManager.TryGetComponent(_tracked, out TransformComponent? xform)) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
if (!xform.Coordinates.IsValid(_entManager)) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
var coords = _entManager.System<SpriteSystem>().GetSpriteScreenCoordinates((_tracked, null, xform)); | ||
|
||
if (!coords.IsValid) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
OpenScreenAt(coords.Position, _clyde); | ||
} | ||
} | ||
|
||
public sealed class StationAiMenuButton(BaseStationAiAction action) : RadialMenuTextureButton | ||
{ | ||
public BaseStationAiAction Action = action; | ||
} |
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
30 changes: 30 additions & 0 deletions
30
Content.Client/Silicons/StationAi/StationAiSystem.Airlock.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Content.Shared.Doors.Components; | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.Silicons.StationAi; | ||
|
||
public sealed partial class StationAiSystem | ||
{ | ||
private void InitializeAirlock() | ||
{ | ||
SubscribeLocalEvent<DoorBoltComponent, GetStationAiRadialEvent>(OnDoorBoltGetRadial); | ||
} | ||
|
||
private void OnDoorBoltGetRadial(Entity<DoorBoltComponent> ent, ref GetStationAiRadialEvent args) | ||
{ | ||
args.Actions.Add(new StationAiRadial() | ||
{ | ||
Sprite = ent.Comp.BoltsDown ? | ||
new SpriteSpecifier.Rsi( | ||
new ResPath("/Textures/Structures/Doors/Airlocks/Standard/basic.rsi"), "open") : | ||
new SpriteSpecifier.Rsi( | ||
new ResPath("/Textures/Structures/Doors/Airlocks/Standard/basic.rsi"), "closed"), | ||
Tooltip = ent.Comp.BoltsDown ? Loc.GetString("bolt-open") : Loc.GetString("bolt-close"), | ||
Event = new StationAiBoltEvent() | ||
{ | ||
Bolted = !ent.Comp.BoltsDown, | ||
} | ||
}); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Content.Client/Silicons/StationAi/StationAiSystem.Light.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Content.Shared.Item.ItemToggle.Components; | ||
using Content.Shared.Light.Components; | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.Silicons.StationAi; | ||
|
||
public sealed partial class StationAiSystem | ||
{ | ||
// Used for surveillance camera lights | ||
|
||
private void InitializePowerToggle() | ||
{ | ||
SubscribeLocalEvent<ItemTogglePointLightComponent, GetStationAiRadialEvent>(OnLightGetRadial); | ||
} | ||
|
||
private void OnLightGetRadial(Entity<ItemTogglePointLightComponent> ent, ref GetStationAiRadialEvent args) | ||
{ | ||
if (!TryComp(ent.Owner, out ItemToggleComponent? toggle)) | ||
return; | ||
|
||
args.Actions.Add(new StationAiRadial() | ||
{ | ||
Tooltip = Loc.GetString("toggle-light"), | ||
Sprite = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/light.svg.192dpi.png")), | ||
Event = new StationAiLightEvent() | ||
{ | ||
Enabled = !toggle.Activated | ||
} | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.