Advertisement
charizardlifex

hax ghost

May 26th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. -- Find ghosts to place. Then find buildings to destruct.
  2. function bluebuild(event)
  3. local builder = game.players.localPlayer
  4. 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 }
  5. print("Found " .. #areaList .. "ghosts in area.")
  6. for index, ghost in pairs(areaList) do
  7. if builder.can_reach_entity(ghost) and builder.force == ghost.force then
  8. print("Checking for items in inventory.")
  9. if builder.get_item_count(ghost.ghost_name) > 0 then
  10. local revive = ghost.revive()
  11. print("Placing items.")
  12. if revive.valid then
  13. builder.remove_item({name=ghost.ghost_name})
  14. end
  15. end
  16. end
  17. end
  18. end
  19.  
  20. script.on_event('bluebuild', bluebuild)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement