private async void HandleAfterInteract(EntityUid uid, SpawnAfterInteractComponent component, AfterInteractEvent args)
        {
            if (string.IsNullOrEmpty(component.Prototype))
            {
                return;
            }
            if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridId(EntityManager), out var grid))
            {
                return;
            }
            if (!grid.TryGetTileRef(args.ClickLocation, out var tileRef))
            {
                return;
            }

            bool IsTileClear()
            {
                return(tileRef.Tile.IsEmpty == false);
            }

            if (!IsTileClear())
            {
                return;
            }

            if (component.DoAfterTime > 0)
            {
                var doAfterArgs = new DoAfterEventArgs(args.User, component.DoAfterTime)
                {
                    BreakOnUserMove = true,
                    BreakOnStun     = true,
                    PostCheck       = IsTileClear,
                };
                var result = await _doAfterSystem.WaitDoAfter(doAfterArgs);

                if (result != DoAfterStatus.Finished)
                {
                    return;
                }
            }

            if (component.Deleted || Deleted(component.Owner))
            {
                return;
            }

            if (EntityManager.TryGetComponent <SharedStackComponent?>(component.Owner, out var stackComp) &&
                component.RemoveOnInteract && !_stackSystem.Use(uid, 1, stackComp))
            {
                return;
            }

            EntityManager.SpawnEntity(component.Prototype, args.ClickLocation.SnapToGrid(grid));

            if (component.RemoveOnInteract && stackComp == null && !((!EntityManager.EntityExists(component.Owner) ? EntityLifeStage.Deleted : EntityManager.GetComponent <MetaDataComponent>(component.Owner).EntityLifeStage) >= EntityLifeStage.Deleted))
            {
                EntityManager.DeleteEntity(component.Owner);
            }
        }
        private void OnAfterInteract(EntityUid uid, FloorTileComponent component, AfterInteractEvent args)
        {
            if (!args.CanReach)
            {
                return;
            }

            if (!TryComp <StackComponent>(uid, out var stack))
            {
                return;
            }

            if (component.OutputTiles == null)
            {
                return;
            }

            // this looks a bit sussy but it might be because it needs to be able to place off of grids and expand them
            var location    = args.ClickLocation.AlignWithClosestGridTile();
            var locationMap = location.ToMap(EntityManager);

            if (locationMap.MapId == MapId.Nullspace)
            {
                return;
            }
            _mapManager.TryGetGrid(location.GetGridId(EntityManager), out var mapGrid);

            foreach (var currentTile in component.OutputTiles)
            {
                var currentTileDefinition = (ContentTileDefinition)_tileDefinitionManager[currentTile];

                if (mapGrid != null)
                {
                    var tile     = mapGrid.GetTileRef(location);
                    var baseTurf = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];

                    if (HasBaseTurf(currentTileDefinition, baseTurf.ID))
                    {
                        if (!_stackSystem.Use(uid, 1, stack))
                        {
                            continue;
                        }

                        PlaceAt(mapGrid, location, currentTileDefinition.TileId, component.PlaceTileSound);
                    }
                }
                else if (HasBaseTurf(currentTileDefinition, "space"))
                {
                    mapGrid = _mapManager.CreateGrid(locationMap.MapId);
                    mapGrid.WorldPosition = locationMap.Position;
                    location = new EntityCoordinates(mapGrid.GridEntityId, Vector2.Zero);
                    PlaceAt(mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
                }
            }
        }