--[[dofile( "data/scripts/lib/utilities.lua" )
local entityTable = {}
table.insert( perk_list,
{
	id = "HEALING_DRONE",
	ui_name = "Healing Drone",
	ui_description = "A drone that heals you.",
	ui_icon = "mods/risk_of_drones/files/dronemod/evaisa/spells/gfx/perks/regen_ui.png",
	perk_icon = "mods/risk_of_drones/files/dronemod/evaisa/spells/gfx/perks/regen_perk.png",
	stackable = STACKABLE_MAX_AMOUNT,
	func = function( entity_perk_item, entity_who_picked, item_name )
		local px, py = EntityGetTransform(get_players()[1])
		local Entity = EntityLoad("mods/risk_of_drones/files/dronemod/evaisa/spells/entities/health_drone.xml",px,py)
		table.insert(entityTable, Entity)
		loop()
	end,
} )

function loop()
   -- local perk_id = "HEALING_DRONE"
    --GamePrint(tostring(GameHasFlagRun(get_perk_picked_flag_name(perk_id))))
	print(1)
	for index, value in ipairs(entityTable) do
		print(2)
		local x, y = EntityGetTransform( value )
		if(x == nil)then
			print(3)
			table.remove(index)
			local Entity = EntityLoad("mods/risk_of_drones/files/dronemod/evaisa/spells/entities/health_drone.xml",px,py)
			table.insert(entityTable, Entity)
		end
	end
	
    SetTimeOut(0.01, "data/scripts/perks/perk_list.lua", "loop")
end]]