Skip to content

Instantly share code, notes, and snippets.

@Timotheeee
Timotheeee / control.lua
Created December 23, 2024 17:48
factorio ghostplacer fix
--- @param player LuaPlayer
local function quickghostentity(player)
-- Get The Area To Check For Ghosts
local area = { { player.position.x - player.reach_distance, player.position.y - player.reach_distance }, { player.position.x + player.reach_distance, player.position.y + player.reach_distance } }
-- Get The Entities In The Area
local ghostList = player.surface.find_entities_filtered { area = area, type = "entity-ghost" }
local markupgradeentityList = player.surface.find_entities_filtered { area = area, to_be_upgraded = true }
local playerInventory = player.get_main_inventory()
local cursorItemStack = player.cursor_stack
if not playerInventory then return end