Auto resource generating workstation

Im looking to make work stations that generate resources after you assign an npc to them. Like medieval dynstaty. Id like to use this premise for my game. If you have any idea how to do this please let me know