~melchizedek6809/WolkenWelten

d5b27febe49043952e446b8345ead54c60ad4322 — Ben (Win10) a month ago 78258f0
Fixed multiple issues with the blockchooser
2 files changed, 10 insertions(+), 12 deletions(-)

M client/src/mods/client.nuj
M client/src/mods/z_blockchooser.nuj
M client/src/mods/client.nuj => client/src/mods/client.nuj +2 -2
@@ 117,11 117,11 @@
      [player-flags! [logand [player-flags] [lognot player-flag-dont-move]]]]]

[defun client/selection []
  [cond [blockchooser/active blockchooser/selection]
  [cond [blockchooser/active [- blockchooser/selection 1]]
        [#t inventory/selection]]]

[defun client/select! [sel]
  [cond [blockchooser/active [blockchooser/select! sel]]
  [cond [blockchooser/active [blockchooser/select! [+ 1 sel]]]
        [#t [inventory/select! sel]]]]

[defun client/select-next! []

M client/src/mods/z_blockchooser.nuj => client/src/mods/z_blockchooser.nuj +8 -10
@@ 67,9 67,7 @@
                          :on-hover [\ []
                                     [widget/label! hover-info [block/name i]]]
                          :on-click [\ []
                                     [set! player/pear-shooter-active #f]
                                     [set! blockchooser/selection [- i 1]]
                                     [blockchooser/refresh]]]]]]]]]
                                     [blockchooser/select! i]]]]]]]]]

[defun blockchooser/toggle! []
  "Toggle the visibility of the inventory popup"


@@ 95,13 93,13 @@

[defun blockchooser/select! [sel]
       "Select a particular block"
       [when [widget-focus-on-game?]
             [set! blockchooser/selection sel]
             [when [>= blockchooser/selection [block/count]]
                   [set! blockchooser/selection 1]]
             [when [< blockchooser/selection 1]
                   [set! blockchooser/selection [- [block/count] 1]]]
             [blockchooser/refresh]]]
       [set! blockchooser/active #t]
       [set! blockchooser/selection sel]
       [when [>= blockchooser/selection [block/count]]
         [set! blockchooser/selection 1]]
       [when [< blockchooser/selection 1]
         [set! blockchooser/selection [- [block/count] 1]]]
       [blockchooser/refresh]]

[defun blockchooser/select-next! []
       "Selects the next item from a players inventory"