-
-
Notifications
You must be signed in to change notification settings - Fork 587
Description
Describe the feature you'd like
const config = getReticuleButton(buttonNum) // { id, tooltip fileUp, fileDown, callbackFn }Describe why do you think it is needed
I'm tinkering with reticule buttons, including as an alternative to #4662
// very abridged code
var reticuleHQ = false
function eventSelectionChanged(list)
{
if (list.length > 1) { return }
const obj = list.pop()
if (obj.stattype !== HQ)
{
if (reticuleHQ) { revertReticuleToDefaults() } // <-- PITA
return
}
if (reticuleHQ) { return } // already showing HQ buttons
reticuleHQ = true
hideInterface()
// set reticule buttons
showInterface()
}The problem is that revertReticuleToDefaults() currently can't do much more than assume the prior buttons were what vanilla uses, and trying to include() the rules/reticule.js, as an alternate way of achieving that, turned in to a can of worms.
Being able to retrieve an object that describes the current config of a reticule button prior to altering that button would allow me to reset the button to whatever it was before, regardless of any other mods, etc., that might have altered it. It would be especially nice if that same object could be passed in to an overload setReticule(config) as a single parameter.
I think this could help progress with converting AIs to use Quick Chat. #4664 The stuff that doesn't lend itself to QC can be exposed as reticule buttons when clicking the allied AI HQ building, and can be unique to each AI - assuming there's an easy way to revert buttons afterwards.