From a706e92d5c6d6033254d2a641a31781ed2dfa7ab Mon Sep 17 00:00:00 2001 From: CaptainSqrBeard Date: Sun, 22 Dec 2024 06:29:42 +0600 Subject: [PATCH] a --- .../Systems/FromTileCrafterSystem.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Content.Shared/_CorvaxNext/FromTileCrafter/Systems/FromTileCrafterSystem.cs b/Content.Shared/_CorvaxNext/FromTileCrafter/Systems/FromTileCrafterSystem.cs index d1aa93ecf25..1fc904daa6a 100644 --- a/Content.Shared/_CorvaxNext/FromTileCrafter/Systems/FromTileCrafterSystem.cs +++ b/Content.Shared/_CorvaxNext/FromTileCrafter/Systems/FromTileCrafterSystem.cs @@ -31,10 +31,14 @@ public override void Initialize() private void OnFromTileCraftComplete(Entity ent, ref FromTileCraftDoAfterEvent args) { - var comp = ent.Comp; + if (_netManager.IsClient) + return; + if (args.Handled || args.Cancelled) return; + var comp = ent.Comp; + var gridUid = GetEntity(args.Grid); if (!TryComp(gridUid, out var grid)) return; @@ -42,13 +46,11 @@ private void OnFromTileCraftComplete(Entity ent, ref F var tileRef = _maps.GetTileRef(gridUid, grid, args.GridTile); var coords = _maps.ToCoordinates(tileRef, grid); - var spread = comp.Spread * grid.TileSize; var offset = new Vector2( - (_robustRandom.NextFloat() - 0.5f) * spread + grid.TileSize * 0.5f, - (_robustRandom.NextFloat() - 0.5f) * spread + grid.TileSize * 0.5f); + ((_robustRandom.NextFloat() - 0.5f) * comp.Spread + 0.5f) * grid.TileSize, + ((_robustRandom.NextFloat() - 0.5f) * comp.Spread + 0.5f) * grid.TileSize); - if (_netManager.IsServer) - Spawn(ent.Comp.EntityToSpawn, coords.Offset(offset)); + Spawn(ent.Comp.EntityToSpawn, coords.Offset(offset)); } private void OnAfterInteract(Entity ent, ref AfterInteractEvent args)