Tomm0017 / rsmod

New repository: https://github.com/rsmod/rsmod
https://github.com/rsmod/rsmod
Apache License 2.0
123 stars 100 forks source link

Add Player parameter to produceItemBox logic #47

Closed tristonplummer closed 5 years ago

tristonplummer commented 5 years ago

What has been done?

A Player parameter has been added to the logic parameter of QueueTask.produceItemBox. This allows users to easily use method references to handle actions rather than relying on the context of the QueueTask, ie:

fun smeltItem(player: Player, item: Int, amount: Int) {
    player.message("item=$item, amount=$amount")
}

on_obj_option(obj = 24009, option = "smelt") {
    player.queue { produceItemBox(Items.BRONZE_BAR, title = "What would you like to smelt?", logic = ::smeltItem) }
}

Proposed Changes