add inventory ticker - #391
Conversation
|
You system doesn't address the main point of different tick speeds: reducing the number of inventory iterations/item comparisons. rn it just loops over everything at the same tick speed |
|
Sorry misread nvm |
Seggan
left a comment
There was a problem hiding this comment.
This doesn't allow for arbitrary tick speeds right?
no, we don't want arbitrary tick speeds since the number of comparisons increases along the order of nDistinctTickSpeeds * nPlayers, so if we have a bunch of different addons each with their own tick speeds, then we have to check every item again just for that addon's speed. I talked with Idra about this and we decided that these 3 speeds would fulfill 99% of use cases |
Co-authored-by: Seggan <seggan21@gmail.com>
…on-core into add-inventory-ticker
|
oop there's a bug where health talisman health doesn't get removed since there's no onStopTick or something like that, do not merge |
bug has been fixed, not going to add an onStopTick method since that's just unneeded abstraction overhead in a lot of cases |
…ase/PylonInventoryItem.kt Co-authored-by: Seggan <seggan21@gmail.com>
| * @param stack The item itself | ||
| */ | ||
| fun onTick(player: Player, stack: ItemStack) | ||
| /** Speed at which onTick is called */ |
There was a problem hiding this comment.
Formatting (space above and should be 3 lines, like the comment for PylonInventoryItem
There was a problem hiding this comment.
not entirely sure what this was asking me to do, but I think I did it
| /** Determines the rate at which the [onTick] method will be called. | ||
| * [onTick] will be called at [tickInterval] * [PylonConfig.inventoryTickerBaseRate] */ |
There was a problem hiding this comment.
| /** Determines the rate at which the [onTick] method will be called. | |
| * [onTick] will be called at [tickInterval] * [PylonConfig.inventoryTickerBaseRate] */ | |
| /** | |
| * Determines the rate at which the [onTick] method will be called. | |
| * [onTick] will be called at [tickInterval] * [PylonConfig.inventoryTickerBaseRate] | |
| */ |
| interface PylonInventoryTicker { | ||
| /** | ||
| * Called when the item is detected in the player's inventory. | ||
| * will be called at [tickInterval] * [PylonConfig.inventoryTickerBaseRate |
There was a problem hiding this comment.
| * will be called at [tickInterval] * [PylonConfig.inventoryTickerBaseRate | |
| * Will be called at [tickInterval] * [PylonConfig.inventoryTickerBaseRate] |
Closes #380