Mspaintfix2 (#301)

* hmm

* feature creep my beloved

* jannie buff

* toilet

* блять

* feature creep my belovedest
This commit is contained in:
RedFoxIV
2025-03-09 21:13:39 +03:00
committed by GitHub
parent b2ecbef8d5
commit 5311de6e9c
12 changed files with 122 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Content.Shared.Crayon;
using Content.Shared.Decals;
using Robust.Client.GameObjects;
@@ -13,9 +13,12 @@ namespace Content.Client.Crayon.UI
[ViewVariables]
private CrayonWindow? _menu;
[ViewVariables] // WWDP EDIT
private CrayonComponent? _ownerComp; // WWDP EDIT
public CrayonBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
EntMan.TryGetComponent<CrayonComponent>(owner, out _ownerComp); // WWDP EDIT
}
protected override void Open()
@@ -26,11 +29,16 @@ namespace Content.Client.Crayon.UI
_menu.OnSelected += Select;
PopulateCrayons();
_menu.OpenCenteredLeft();
//_menu.Search.GrabKeyboardFocus();
}
private void PopulateCrayons()
{
var crayonDecals = _protoManager.EnumeratePrototypes<DecalPrototype>().Where(x => x.Tags.Contains("crayon"));
// WWDP EDIT START
var crayonDecals = _protoManager.EnumeratePrototypes<DecalPrototype>();
if(_ownerComp?.AllDecals != true)
crayonDecals = crayonDecals.Where(x => x.Tags.Contains("crayon"));
// WWDP EDIT END
_menu?.Populate(crayonDecals.ToList());
}
@@ -63,12 +71,12 @@ namespace Content.Client.Crayon.UI
public void Select(string state)
{
SendMessage(new CrayonSelectMessage(state));
SendPredictedMessage(new CrayonSelectMessage(state));
}
public void SelectColor(Color color)
{
SendMessage(new CrayonColorMessage(color));
SendPredictedMessage(new CrayonColorMessage(color));
}
}
}

View File

@@ -1,10 +1,13 @@
<DefaultWindow xmlns="https://spacestation14.io"
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'crayon-window-title'}"
MinSize="450 500"
SetSize="450 500">
<BoxContainer Orientation="Vertical">
<ColorSelectorSliders Name="ColorSelector" Visible="False" />
<LineEdit Name="Search" Margin="0 0 0 8" PlaceHolder="{Loc 'crayon-window-placeholder'}" />
<BoxContainer Orientation="Horizontal"> <!-- wwdp edit start -->
<LineEdit Name="Search" Access="Public" Margin="0 0 0 0" HorizontalExpand="True" VerticalAlignment="Center" PlaceHolder="{Loc 'crayon-window-placeholder'}" />
<TextureButton Name="ClearButton" StyleClasses="windowCloseButton" VerticalAlignment="Center" />
</BoxContainer> <!-- wwdp edit end -->
<ScrollContainer VerticalExpand="True">
<BoxContainer Name="Grids" Orientation="Vertical">
</BoxContainer>

View File

@@ -1,17 +1,21 @@
using System.Collections.Generic;
using System.Linq;
using Content.Client.Resources;
using Content.Client.Stylesheets;
using Content.Shared.Crayon;
using Content.Shared.Decals;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.RichText;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Graphics;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
@@ -21,6 +25,8 @@ namespace Content.Client.Crayon.UI
public sealed partial class CrayonWindow : DefaultWindow
{
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
[Dependency] private readonly IResourceCache _cache = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
private readonly SpriteSystem _spriteSystem = default!;
private Dictionary<string, List<(string Name, Texture Texture)>>? _decals;
@@ -40,6 +46,7 @@ namespace Content.Client.Crayon.UI
Search.OnTextChanged += SearchChanged;
ColorSelector.OnColorChanged += SelectColor;
ClearButton.OnPressed += (_) => Search.SetText(String.Empty, true);
}
private void SelectColor(Color color)
@@ -59,8 +66,12 @@ namespace Content.Client.Crayon.UI
return;
var filter = Search.Text;
var comma = filter.IndexOf(',');
var first = (comma == -1 ? filter : filter[..comma]).Trim();
// WWDP EDIT START
var firstcomma = filter.IndexOf(',');
var first = (firstcomma == -1 ? filter : filter[..firstcomma]).Trim();
var comma = filter.LastIndexOf(',')+1;
filter = filter.Substring(comma).Trim();
// WWDP EDIT END
var names = _decals.Keys.ToList();
names.Sort((a, b) => a == "random" ? 1 : b == "random" ? -1 : a.CompareTo(b));
@@ -72,10 +83,15 @@ namespace Content.Client.Crayon.UI
OnSelected?.Invoke(_selected);
}
var hsl = Color.ToHsl(_color);
hsl.Z = MathF.Max(hsl.Z, 0.5f);
Color labelcolor;
labelcolor = Color.FromHsl(hsl);
foreach (var categoryName in names)
{
var locName = Loc.GetString("crayon-category-" + categoryName);
var category = _decals[categoryName].Where(d => locName.Contains(first) || d.Name.Contains(first)).ToList();
var category = _decals[categoryName].Where(d => locName.Contains(filter) || d.Name.Contains(filter)).ToList(); // WWDP EDIT
if (category.Count == 0)
continue;
@@ -96,15 +112,44 @@ namespace Content.Client.Crayon.UI
foreach (var (name, texture) in category)
{
var button = new TextureButton()
// WWDP EDIT START
var button = new ContainerButton()
{
TextureNormal = texture,
Name = name,
ToolTip = name
};
button.OnPressed += ButtonOnPressed;
var boxcont = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Vertical,
MaxWidth = texture.Width * 2
};
var texturerect = new TextureRect()
{
Texture = texture,
Name = name,
ToolTip = name,
Modulate = _color,
Scale = new System.Numerics.Vector2(2, 2)
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
TextureScale = new System.Numerics.Vector2(2, 2)
};
button.OnPressed += ButtonOnPressed;
var buttonlabel = new Label
{
Text = name,
HorizontalAlignment = HAlignment.Center,
Align = Label.AlignMode.Center,
FontOverride = new VectorFont(_cache.GetResource<FontResource>(_proto.Index<FontPrototype>("Default").Path), 8),
FontColorOverride = labelcolor
};
boxcont.AddChild(texturerect);
boxcont.AddChild(buttonlabel);
button.AddChild(boxcont);
// WWDP EDIT END
if (_selected == name)
{

View File

@@ -3,6 +3,7 @@ using Content.Client.Hands.Systems;
using Content.Shared._White.Hands.Components;
using Content.Shared.Crayon;
using Content.Shared.Decals;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
@@ -37,6 +38,7 @@ public sealed class CrayonPreviewOverlay : Overlay
protected override void Draw(in OverlayDrawArgs args)
{
if (_player.LocalEntity is not EntityUid playerUid ||
!_entMan.HasComponent<HandsComponent>(playerUid) ||
!_entMan.TryGetComponent<CrayonComponent>(_hands.GetActiveItem(playerUid), out var crayon) ||
_entMan.HasComponent<HoldingDropComponent>(playerUid))
return;

View File

@@ -54,6 +54,11 @@ namespace Content.Shared.Crayon
[AutoNetworkedField]
public bool DeleteEmpty = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
[AutoNetworkedField]
public bool AllDecals = false;
/// <summary>
/// Used clientside only.
/// </summary>

View File

@@ -47,7 +47,7 @@ public abstract class SharedCrayonSystem : EntitySystem
private void OnCrayonBoundUI(EntityUid uid, CrayonComponent component, CrayonSelectMessage args)
{
// Check if the selected state is valid
if (!_prototypeManager.TryIndex<DecalPrototype>(args.State, out var prototype) || !prototype.Tags.Contains("crayon"))
if (!_prototypeManager.TryIndex<DecalPrototype>(args.State, out var prototype) || !component.AllDecals && !prototype.Tags.Contains("crayon")) // WWDP EDIT
return;
component.SelectedState = args.State;

View File

@@ -143,7 +143,7 @@
state: 9
- type: decal
id: Blasto
id: blasto
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -154,7 +154,7 @@
state: Blasto
- type: decal
id: Clandestine
id: clandestine
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -165,7 +165,7 @@
state: Clandestine
- type: decal
id: Cyber
id: cyber
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -176,7 +176,7 @@
state: Cyber
- type: decal
id: Diablo
id: diablo
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -187,7 +187,7 @@
state: Diablo
- type: decal
id: Donk
id: donk
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -198,7 +198,7 @@
state: Donk
- type: decal
id: Gene
id: gene
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -209,7 +209,7 @@
state: Gene
- type: decal
id: Gib
id: gib
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -220,7 +220,7 @@
state: Gib
- type: decal
id: Max
id: max
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -231,7 +231,7 @@
state: Max
- type: decal
id: Newton
id: newton
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -242,7 +242,7 @@
state: Newton
- type: decal
id: North
id: north
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -253,7 +253,7 @@
state: North
- type: decal
id: Omni
id: omni
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -264,7 +264,7 @@
state: Omni
- type: decal
id: Osiron
id: osiron
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -275,7 +275,7 @@
state: Osiron
- type: decal
id: Prima
id: prima
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -286,7 +286,7 @@
state: Prima
- type: decal
id: Psyke
id: psyke
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -297,7 +297,7 @@
state: Psyke
- type: decal
id: Sirius
id: sirius
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -308,7 +308,7 @@
state: Sirius
- type: decal
id: Tunnel
id: tunnel
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -319,7 +319,7 @@
state: Tunnel
- type: decal
id: Waffle
id: waffle
parent: Graffiti
tags: ["crayon", "crayon-5-graffiti"]
defaultCleanable: true
@@ -627,7 +627,7 @@
state: evac
- type: decal
id: exclamationmark
id: emark
parent: Symbols
tags: ["crayon", "crayon-3-symbols"]
defaultCleanable: true
@@ -869,7 +869,7 @@
state: prolizard
- type: decal
id: questionmark
id: qmark
parent: Symbols
tags: ["crayon", "crayon-3-symbols"]
defaultCleanable: true

View File

@@ -21,7 +21,7 @@
enum.CrayonUiKey.Key:
type: CrayonBoundUserInterface
- type: Crayon
capacity: 55 # wwdp edit 25 -> 55
capacity: 60 # wwdp edit 25 -> 60
- type: Food
- type: SolutionContainerManager
solutions:

View File

@@ -42,7 +42,7 @@
absorbed:
maxVol: 100
- type: UseDelay
delay: 1
delay: 0.75
- type: PhysicalComposition
materialComposition:
Plastic: 50

View File

@@ -34,8 +34,8 @@
solution: spray
- type: UseDelay
- type: Spray
transferAmount: 10
sprayVelocity: 2
transferAmount: 5 # wwdp edit
sprayVelocity: 2.5 # wwdp edit
spraySound:
path: /Audio/Effects/spray2.ogg
- type: TrashOnSolutionEmpty

View File

@@ -29,3 +29,25 @@
- type: Construction
graph: magic_crayon
node: magicCrayon
# wwdp edit # i am not making a new file in _White just for this shit
- type: entity
parent: CrayonMagic
id: CrayoAdmin
suffix: Admeme
name: extra magic crayon
description: Specially blended with shitspawnium crystals and certified toxic.
components:
- type: Sprite
sprite: _NF/Objects/Fun/magic_crayon.rsi
state: icon
- type: Item
sprite: _NF/Objects/Fun/magic_crayon.rsi
heldPrefix: icon
- type: Tag # Removing trash & recyclable
tags:
- Write
- Crayon
- type: Crayon
allDecals: true
capacity: 2147483647 # int.MaxValue, infinite charges

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 447 B