-
Notifications
You must be signed in to change notification settings - Fork 55
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
175 changed files
with
6,534 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Content.Shared.Blob; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
[UsedImplicitly] | ||
public sealed class BlobChemSwapBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private BlobChemSwapMenu? _menu; | ||
|
||
public BlobChemSwapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new BlobChemSwapMenu(); | ||
_menu.OnClose += Close; | ||
_menu.OnIdSelected += OnIdSelected; | ||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
if (state is not BlobChemSwapBoundUserInterfaceState st) | ||
return; | ||
|
||
_menu?.UpdateState(st.ChemList, st.SelectedChem); | ||
} | ||
|
||
private void OnIdSelected(BlobChemType selectedId) | ||
{ | ||
SendMessage(new BlobChemSwapPrototypeSelectedMessage(selectedId)); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (disposing) | ||
{ | ||
_menu?.Close(); | ||
_menu = null; | ||
} | ||
} | ||
} |
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 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
Title="{Loc 'blob-chem-swap-ui-window-name'}" | ||
MinSize="250 300" | ||
SetSize="250 300"> | ||
<BoxContainer Orientation="Vertical"> | ||
<ScrollContainer VerticalExpand="True"> | ||
<GridContainer Name="Grid" Columns="3" Margin="0 5" > | ||
</GridContainer> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
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,77 @@ | ||
using System.Numerics; | ||
using Content.Client.Stylesheets; | ||
using Content.Shared.Blob; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class BlobChemSwapMenu : DefaultWindow | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
private readonly SpriteSystem _sprite; | ||
public event Action<BlobChemType>? OnIdSelected; | ||
|
||
private Dictionary<BlobChemType, Color> _possibleChems = new(); | ||
private BlobChemType _selectedId; | ||
|
||
public BlobChemSwapMenu() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
_sprite = _entityManager.System<SpriteSystem>(); | ||
} | ||
|
||
public void UpdateState(Dictionary<BlobChemType, Color> chemList, BlobChemType selectedChem) | ||
{ | ||
_possibleChems = chemList; | ||
_selectedId = selectedChem; | ||
UpdateGrid(); | ||
} | ||
|
||
private void UpdateGrid() | ||
{ | ||
ClearGrid(); | ||
|
||
var group = new ButtonGroup(); | ||
|
||
foreach (var blobChem in _possibleChems) | ||
{ | ||
if (!_prototypeManager.TryIndex("NormalBlobTile", out EntityPrototype? proto)) | ||
continue; | ||
|
||
var button = new Button | ||
{ | ||
MinSize = new Vector2(64, 64), | ||
HorizontalExpand = true, | ||
Group = group, | ||
StyleClasses = {StyleBase.ButtonSquare}, | ||
ToggleMode = true, | ||
Pressed = _selectedId == blobChem.Key, | ||
ToolTip = Loc.GetString($"blob-chem-{blobChem.Key.ToString().ToLower()}-info"), | ||
TooltipDelay = 0.01f, | ||
}; | ||
button.OnPressed += _ => OnIdSelected?.Invoke(blobChem.Key); | ||
Grid.AddChild(button); | ||
|
||
var texture = _sprite.GetPrototypeIcon(proto); | ||
button.AddChild(new TextureRect | ||
{ | ||
Stretch = TextureRect.StretchMode.KeepAspectCentered, | ||
Modulate = blobChem.Value, | ||
Texture = texture.Default, | ||
}); | ||
} | ||
} | ||
|
||
private void ClearGrid() | ||
{ | ||
Grid.RemoveAllChildren(); | ||
} | ||
} |
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,44 @@ | ||
using Content.Shared.Blob; | ||
using Content.Shared.GameTicking; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
public sealed class BlobObserverSystem : SharedBlobObserverSystem | ||
{ | ||
[Dependency] private readonly ILightManager _lightManager = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<BlobObserverComponent, ComponentHandleState>(HandleState); | ||
SubscribeLocalEvent<BlobObserverComponent, PlayerAttachedEvent>(OnPlayerAttached); | ||
SubscribeLocalEvent<BlobObserverComponent, PlayerDetachedEvent>(OnPlayerDetached); | ||
SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup); | ||
} | ||
|
||
private void HandleState(EntityUid uid, BlobObserverComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not BlobChemSwapComponentState state) | ||
return; | ||
component.SelectedChemId = state.SelectedChem; | ||
} | ||
|
||
private void OnPlayerAttached(EntityUid uid, BlobObserverComponent component, PlayerAttachedEvent args) | ||
{ | ||
_lightManager.DrawLighting = false; | ||
} | ||
|
||
private void OnPlayerDetached(EntityUid uid, BlobObserverComponent component, PlayerDetachedEvent args) | ||
{ | ||
_lightManager.DrawLighting = true; | ||
} | ||
|
||
private void RoundRestartCleanup(RoundRestartCleanupEvent ev) | ||
{ | ||
_lightManager.DrawLighting = true; | ||
} | ||
} |
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,9 @@ | ||
using Content.Shared.Blob; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
[RegisterComponent] | ||
public sealed class BlobTileComponent : SharedBlobTileComponent | ||
{ | ||
|
||
} |
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,38 @@ | ||
using Content.Client.DamageState; | ||
using Content.Shared.Blob; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
public sealed class BlobTileSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<BlobTileComponent, ComponentHandleState>(OnBlobTileHandleState); | ||
} | ||
|
||
private void OnBlobTileHandleState(EntityUid uid, BlobTileComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not BlobTileComponentState state) | ||
return; | ||
|
||
if (component.Color == state.Color) | ||
return; | ||
|
||
component.Color = state.Color; | ||
TryComp<SpriteComponent>(uid, out var sprite); | ||
|
||
if (sprite == null) | ||
return; | ||
|
||
foreach (var key in new []{ DamageStateVisualLayers.Base, DamageStateVisualLayers.BaseUnshaded }) | ||
{ | ||
if (!sprite.LayerMapTryGet(key, out _)) | ||
continue; | ||
|
||
sprite.LayerSetColor(key, component.Color); | ||
} | ||
} | ||
} |
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,9 @@ | ||
using Content.Shared.Blob; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
[RegisterComponent] | ||
public sealed class BlobbernautComponent : SharedBlobbernautComponent | ||
{ | ||
|
||
} |
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,39 @@ | ||
using System.Linq; | ||
using Content.Client.DamageState; | ||
using Content.Shared.Blob; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Client.Blob; | ||
|
||
public sealed class BlobbernautSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<BlobbernautComponent, ComponentHandleState>(OnBlobTileHandleState); | ||
} | ||
|
||
private void OnBlobTileHandleState(EntityUid uid, BlobbernautComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not BlobbernautComponentState state) | ||
return; | ||
|
||
if (component.Color == state.Color) | ||
return; | ||
|
||
component.Color = state.Color; | ||
TryComp<SpriteComponent>(uid, out var sprite); | ||
|
||
if (sprite == null) | ||
return; | ||
|
||
foreach (var key in new []{ DamageStateVisualLayers.Base }) | ||
{ | ||
if (!sprite.LayerMapTryGet(key, out _)) | ||
continue; | ||
|
||
sprite.LayerSetColor(key, component.Color); | ||
} | ||
} | ||
} |
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,9 @@ | ||
using Content.Shared.Chemistry.Components; | ||
|
||
namespace Content.Client.Chemistry.Components; | ||
|
||
[RegisterComponent] | ||
public sealed class SmokeComponent : SharedSmokeComponent | ||
{ | ||
|
||
} |
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,35 @@ | ||
using System.Linq; | ||
using Content.Shared.Chemistry.Components; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Client.Chemistry.Components; | ||
|
||
public sealed class SmokeSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<SmokeComponent, ComponentHandleState>(OnBlobTileHandleState); | ||
} | ||
|
||
private void OnBlobTileHandleState(EntityUid uid, SmokeComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not SmokeComponentState state) | ||
return; | ||
|
||
if (component.Color == state.Color) | ||
return; | ||
|
||
component.Color = state.Color; | ||
TryComp<SpriteComponent>(uid, out var sprite); | ||
|
||
if (sprite == null) | ||
return; | ||
|
||
for (var i = 0; i < sprite.AllLayers.Count(); i++) | ||
{ | ||
sprite.LayerSetColor(i, component.Color); | ||
} | ||
} | ||
} |
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,8 @@ | ||
namespace Content.Server.Blob | ||
{ | ||
[RegisterComponent] | ||
public sealed class BlobBorderComponent : Component | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.