-
Notifications
You must be signed in to change notification settings - Fork 148
Add Morg API method to get first item occurrences and distance calculation to geometry.py #155
Conversation
WillowsDad
commented
Apr 19, 2023
For the given item ID(s), returns the first inventory slot index that the item exists in. e.g. [1, 1, 2, 3, 3, 3, 4, 4, 4, 4] -> [0, 2, 3, 6] Args: item_id: The item ID to search for (an single ID, or list of IDs). Returns: The first inventory slot index that the item exists in for each unique item ID. If a single item ID is provided, returns an integer. If no matching item ID is found, returns -1.
""" Gets the distance between the object and it's Rectangle parent left edge. Useful for sorting lists of RuneLiteObjects. Returns: The distance from the point to the center of the object. Note: Only use this if you're sorting a list of RuneLiteObjects that are contained in the same Rectangle. """
Hey, I'm curious about what the use cases are for sorting RL objects from left to right. Wondering if maybe we can make distance calculations way more robust (e.g., allow for sorting by passing a point instead of making functions for each possible scenario). Also, does this make #147 obsolete? |
It's possible that I'll split the API and the Geometry work into two separate PRs to keep it clean. Might be easier to accept the other one you made, then remove the API changes here so it's just Geometry stuff. Depends if this API code is different from the previous PR or not. |
The code is different and more robust then #147, updated #147 with that code. So that part of this PR can be deleted, yes. This was supposed to be only the geometry changes. Woops |
USE CASE: |
Good point, I'll take a look this week/weekend some time. No pressure, I will be able to implement it if you don't have time. Not sure why I didn't think of tile-based movement. |
closed because I pushed the same changes to geometry pr making this obsolete. #160 |