Fix crayon decal spawning exception (#4355)

* Fix crayon spawning

* Popup message
This commit is contained in:
mirrorcult
2021-07-25 01:44:26 -07:00
committed by GitHub
parent 9d36b3371f
commit ffee1482d9
2 changed files with 8 additions and 3 deletions

View File

@@ -124,9 +124,13 @@ namespace Content.Server.Crayon
return true;
}
var entityManager = IoCManager.Resolve<IServerEntityManager>();
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);

View File

@@ -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