From ffee1482d93aa68b38cf50fdf54b622fdbed4c16 Mon Sep 17 00:00:00 2001 From: mirrorcult Date: Sun, 25 Jul 2021 01:44:26 -0700 Subject: [PATCH] Fix crayon decal spawning exception (#4355) * Fix crayon spawning * Popup message --- Content.Server/Crayon/CrayonComponent.cs | 8 ++++++-- Resources/Locale/en-US/crayon/crayon-component.ftl | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Server/Crayon/CrayonComponent.cs b/Content.Server/Crayon/CrayonComponent.cs index e877a8d65c..53f9384b66 100644 --- a/Content.Server/Crayon/CrayonComponent.cs +++ b/Content.Server/Crayon/CrayonComponent.cs @@ -124,9 +124,13 @@ namespace Content.Server.Crayon return true; } - var entityManager = IoCManager.Resolve(); + if (!eventArgs.ClickLocation.IsValid(Owner.EntityManager)) + { + eventArgs.User.PopupMessage(Loc.GetString("crayon-interact-invalid-location")); + return true; + } - var entity = entityManager.SpawnEntity("CrayonDecal", eventArgs.ClickLocation); + var entity = Owner.EntityManager.SpawnEntity("CrayonDecal", eventArgs.ClickLocation); if (entity.TryGetComponent(out AppearanceComponent? appearance)) { appearance.SetData(CrayonVisuals.State, SelectedState); diff --git a/Resources/Locale/en-US/crayon/crayon-component.ftl b/Resources/Locale/en-US/crayon/crayon-component.ftl index 34fe271be1..af8e0a7cdb 100644 --- a/Resources/Locale/en-US/crayon/crayon-component.ftl +++ b/Resources/Locale/en-US/crayon/crayon-component.ftl @@ -3,6 +3,7 @@ crayon-drawing-label = Drawing: [color={$color}]{$state}[/color] ({$charges}/{$capacity}) crayon-interact-not-enough-left-text = Not enough left. +crayon-interact-invalid-location = Can't reach there! ## UI -crayon-window-title = Crayon \ No newline at end of file +crayon-window-title = Crayon