From 5311de6e9c5387a69abdd4e392fc7b6c409ef19a Mon Sep 17 00:00:00 2001 From: RedFoxIV <38788538+RedFoxIV@users.noreply.github.com> Date: Sun, 9 Mar 2025 21:13:39 +0300 Subject: [PATCH] Mspaintfix2 (#301) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * hmm * feature creep my beloved * jannie buff * toilet * блять * feature creep my belovedest --- .../Crayon/UI/CrayonBoundUserInterface.cs | 16 +++-- Content.Client/Crayon/UI/CrayonWindow.xaml | 7 ++- Content.Client/Crayon/UI/CrayonWindow.xaml.cs | 59 +++++++++++++++--- .../_White/Overlays/CrayonPreviewOverlay.cs | 2 + Content.Shared/Crayon/CrayonComponent.cs | 5 ++ Content.Shared/Crayon/SharedCrayonSystem.cs | 2 +- Resources/Prototypes/Decals/crayons.yml | 38 +++++------ .../Entities/Objects/Fun/crayons.yml | 2 +- .../Objects/Specific/Janitorial/janitor.yml | 2 +- .../Objects/Specific/Janitorial/spray.yml | 4 +- .../_NF/Entities/Objects/Fun/magic_crayon.yml | 22 +++++++ .../Effects/crayondecals.rsi/toilet.png | Bin 436 -> 447 bytes 12 files changed, 122 insertions(+), 37 deletions(-) diff --git a/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs b/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs index 44501767dd..28c9de5369 100644 --- a/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs +++ b/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs @@ -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(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().Where(x => x.Tags.Contains("crayon")); + // WWDP EDIT START + var crayonDecals = _protoManager.EnumeratePrototypes(); + 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)); } } } diff --git a/Content.Client/Crayon/UI/CrayonWindow.xaml b/Content.Client/Crayon/UI/CrayonWindow.xaml index 7acb22551b..c01d691b60 100644 --- a/Content.Client/Crayon/UI/CrayonWindow.xaml +++ b/Content.Client/Crayon/UI/CrayonWindow.xaml @@ -1,10 +1,13 @@ - - + + + + diff --git a/Content.Client/Crayon/UI/CrayonWindow.xaml.cs b/Content.Client/Crayon/UI/CrayonWindow.xaml.cs index 88475562c6..5766af0af5 100644 --- a/Content.Client/Crayon/UI/CrayonWindow.xaml.cs +++ b/Content.Client/Crayon/UI/CrayonWindow.xaml.cs @@ -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>? _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(_proto.Index("Default").Path), 8), + FontColorOverride = labelcolor + }; + + boxcont.AddChild(texturerect); + boxcont.AddChild(buttonlabel); + button.AddChild(boxcont); + // WWDP EDIT END if (_selected == name) { diff --git a/Content.Client/_White/Overlays/CrayonPreviewOverlay.cs b/Content.Client/_White/Overlays/CrayonPreviewOverlay.cs index 69af8fd2ec..8fdde6dd8d 100644 --- a/Content.Client/_White/Overlays/CrayonPreviewOverlay.cs +++ b/Content.Client/_White/Overlays/CrayonPreviewOverlay.cs @@ -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(playerUid) || !_entMan.TryGetComponent(_hands.GetActiveItem(playerUid), out var crayon) || _entMan.HasComponent(playerUid)) return; diff --git a/Content.Shared/Crayon/CrayonComponent.cs b/Content.Shared/Crayon/CrayonComponent.cs index bd459cf42d..85a278e573 100644 --- a/Content.Shared/Crayon/CrayonComponent.cs +++ b/Content.Shared/Crayon/CrayonComponent.cs @@ -54,6 +54,11 @@ namespace Content.Shared.Crayon [AutoNetworkedField] public bool DeleteEmpty = true; + [ViewVariables(VVAccess.ReadWrite)] + [DataField] + [AutoNetworkedField] + public bool AllDecals = false; + /// /// Used clientside only. /// diff --git a/Content.Shared/Crayon/SharedCrayonSystem.cs b/Content.Shared/Crayon/SharedCrayonSystem.cs index 28176c5f41..0dc4688bc7 100644 --- a/Content.Shared/Crayon/SharedCrayonSystem.cs +++ b/Content.Shared/Crayon/SharedCrayonSystem.cs @@ -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(args.State, out var prototype) || !prototype.Tags.Contains("crayon")) + if (!_prototypeManager.TryIndex(args.State, out var prototype) || !component.AllDecals && !prototype.Tags.Contains("crayon")) // WWDP EDIT return; component.SelectedState = args.State; diff --git a/Resources/Prototypes/Decals/crayons.yml b/Resources/Prototypes/Decals/crayons.yml index 10837bb18a..ea13bcfdce 100644 --- a/Resources/Prototypes/Decals/crayons.yml +++ b/Resources/Prototypes/Decals/crayons.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Objects/Fun/crayons.yml b/Resources/Prototypes/Entities/Objects/Fun/crayons.yml index 81ae592077..ee3bd499f1 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/crayons.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/crayons.yml @@ -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: diff --git a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml index ab6c0d4d90..5468b00bab 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml @@ -42,7 +42,7 @@ absorbed: maxVol: 100 - type: UseDelay - delay: 1 + delay: 0.75 - type: PhysicalComposition materialComposition: Plastic: 50 diff --git a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml index 998d3ecf03..f20d7092df 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml @@ -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 diff --git a/Resources/Prototypes/_NF/Entities/Objects/Fun/magic_crayon.yml b/Resources/Prototypes/_NF/Entities/Objects/Fun/magic_crayon.yml index 35ac44cdcf..7e6bc54b21 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Fun/magic_crayon.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Fun/magic_crayon.yml @@ -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 \ No newline at end of file diff --git a/Resources/Textures/Effects/crayondecals.rsi/toilet.png b/Resources/Textures/Effects/crayondecals.rsi/toilet.png index 21c0043fe8680427ac1f2c4c06e8672ae869b4f0..f7bd3b4968385753bf2551c33db3360c4a4ce963 100644 GIT binary patch delta 422 zcmV;X0a^aE1HS{1BYyw^b5ch_0Itp)=>Px$c}YY;R9J=WmQ8NLFc5`jP!SOl-sA|} z|3VN879oo`0)au{|8>(;kP?`2&8mGXN3q|09*-v>QVL%xilP~!u509Z4gk>lse{Lu z6D04w*f=^wh~aLx6Rqj#ab)WCB3fUsS9J!YSrcI%k4J5MT7N7SqIn{Ke!s5<7z_sL zHJu76!qe##?ls!2N!&;e8FzjIFf~zj_VKqcu?ho*A!JD>Z=n7F1Q$ z`7TM4@3FKKihm@{z&I0f<^LGjml{Fvjp~HpAs|q2X{yhr@x=G^NpKL_|d1dospwyKzO4 zG_3$omgRf?jNkEFu4+VCmc5)~t<_lSHJwg7cNkLnK_7+E6)1Y){p(NY6BnsgpE6@m QKmY&$07*qoM6N<$f^@CK8~^|S delta 411 zcmV;M0c8Ha1GEE>BYy#VNkl(M^O99u9}b zHJxxfZs>F(O5AQY?+mnM&CA~Dbn?~5VzFo(_cGAy^}G%A`+t4!HMIyS!t?nY?YFB#ki;5%JYkuq;a-iFN~3thIjm*Q?CDS`*bk6Y*xVaW)Wq3-Ua#9ZQnrCvNM6UU1F8 zcDw!j5!8`iE`Jv`eZPe)%YKnrYaedH^SCi4o&jSF@6+3cI#a=@$l96<0LFB` zZk+4YibX{7Jf~7hX0sWu*DD5t0glHbMxzmi!yy2`S_`F=JU6Z=a7`;ou2!qhyo_T$ z%YzzGnx?IDwALZi?wC%ewLA2w{I?3EPAGce{o_yL3lw8SR-e|_#L55w002ovPDHLk FV1fq@!gT-u