Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Find ghosts to place. Then find buildings to destruct.
- function bluebuild(event)
- local builder = game.players.localPlayer
- local areaList = builder.surface.find_entities_filtered{area = {{builder.position.x -10, builder.position.x-10}, {builder.position.x+10, builder.position.x+10}}, type = "entity-ghost", force=game.forces.player }
- print("Found " .. #areaList .. "ghosts in area.")
- for index, ghost in pairs(areaList) do
- if builder.can_reach_entity(ghost) and builder.force == ghost.force then
- print("Checking for items in inventory.")
- if builder.get_item_count(ghost.ghost_name) > 0 then
- local revive = ghost.revive()
- print("Placing items.")
- if revive.valid then
- builder.remove_item({name=ghost.ghost_name})
- end
- end
- end
- end
- end
- script.on_event('bluebuild', bluebuild)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement