[Market] Get orders for X resource method.
-
I think it would be wise to add API support for pre-ordered list of resources-filtered market orders.
I think a lot of people do the following:
Game.market.getAllOrders({resourceType:INSERT_RESOURCE_HERE});
This requires all items to be iterated over and over again, even if there is only 1 order for a certain resource. I think it would be wise to add a pre-filtered, per resource.
This pre-processing of data costs about 6 CPU now for me, of the total of 7.80 CPU which is currently required by my "market order engine".
if this is done once for all players I think we could all benefit from it.
I'd love for it to have the same sort of cache as Room.find method.
-
Agreed.
While you're at it, I'd love the same for ID. I don't understand why Game.getObjectById() doesn't return anything for a market order. I shouldn't have to iterate getAllOrders to find a single ID.