Belt Visualizer


Highlight a belt line with the press of a button! (G) Cycle between different lanes by highlighting the same belt again. Press again while not selecting a belt to stop highlighting.

Utilities
10 months ago
1.1 - 2.0
93.9K
Logistics

g Startup Setting

7 months ago
(updated 7 months ago)

Not sure whether to file this under Bugs or Requests, but I'm working on a mod that will enable the visualizer on startup (when a player loads into an new or existing game, or joins a multiplayer game), and I tried creating a function with the below in control.lua:

    local player = game.players[event.player_index]
    if script.active_mods["belt-visualizer"] then
      if player.mod_settings['belt-visualizer-default'].value then
        player.set_shortcut_toggled("bv-toggle-hover", true)
      end
    end

And running it during on_player_joined_game, on_cutscene_cancelled, and on_player_created, and it technically works, the toggle looks enabled, but there's no visualizer, until untoggling, and retoggling it again, which kinda defeats the purpose.

Is this a problem with my implementation, or something not expected by this mod's control.lua? Alternatively, if this can't be fixed, then could I request a player setting to start with belt visualizer enabled?

7 months ago
(updated 7 months ago)

The shortcut state is entirely separate from whether hover mode is enabled or not - shortcuts are glorified buttons for the player to click, and their state is meant to be managed by the mod using it. Hover mode is only toggled when a player actually clicks the shortcut (or uses the keybind) and it reads the state of the shortcut to determine if hover mode is active, so setting it from another mod won't do anything. There's no event for that, so it's not directly possible to do.

I could add a remote interface to allow other mods to set the hover state of a player, or I could also just add a per player setting to the mod for enabling hover mode by default. I'm pretty sure if you change the setting in the main menu it will apply to any game you create or join after the fact.

7 months ago

Ahh, I see, I haven't played much with the shortcuts, I thought it would work similar to Alt Mode (which I was able to set by player under the same conditions, must behave differently behind the scenes)

I think per player setting would definitely be the preferred method; I personally would never want this disabled, just like Alt Mode

New response