The problem I have is accessing that mobs contents, the way I can think of doing it is cycling through the mobs with a for loop like this
for(var/mob/Shopkeeper/S in world)
But I was wondering if there is a better more efficient way to access something and assign it to a variable that way I can use datums
So if I end up using datums instead (which i think would be a better choice) I was thinking of creating a Market datum for example and have list for the different types of objects in that datum. But the problem im coming across (something that is probably real basic that I missed while learning) is how to access the datum when I need to call up the items in the market.
Also if you think there is a better way than datums to do this im open to suggestions
I suspect whatever your system, the player has to interact with an object of some sort to access the market and mail. I would attach the datum to that. Your system can then just jump off the interaction the player started and handle everything between itself, the datum it holds and the player. The object the player clicked or whatever would act s the interface between the player and the datum tied to the object. So... basically, that object or whatever has a variable to point to the mail or market datum. The datum handles actually managing the mail or store, so you could have many objects all pointing to the same single market or mail datum.