BeamMP / BeamMP

Bringing multiplayer to BeamNG.drive
https://beammp.com
GNU Affero General Public License v3.0
322 stars 82 forks source link

[Bug] Hotlapping UI app is broken when on a server #512

Open carsakiller opened 5 months ago

carsakiller commented 5 months ago

Have you read our FAQ/Wiki/#before-you-ask ? Yes

Describe the bug When joined to a BeamMP server, the hotlapping UI app is missing its buttons, rendering it completely unusable. image

To Reproduce Steps to reproduce the behavior:

  1. Join a BeamMP server
  2. Press ESC and click UI Apps
  3. Click Add App
  4. Select the Hotlapping UI app
  5. Drag the UI app from the top-left corner to somewhere you can see
  6. Note that the buttons that are meant to be at the top of the UI app are no longer there. (see image below for how the app is supposed to look)

Expected behavior I expect to be able to use the hotlapping UI app in multiplayer, as I can in singleplayer. image

Desktop (please complete the following information):

Additional context I have performed a few tests to see where the issue stems from. Here are my findings:

  1. Safe Mode and viewing the Hotlapping app is fine.
  2. I tried normal and vulkan renderer, both seem to have no effect.
  3. Launching BeamNG using the BeamMP launcher and entering freeroam is fine.
  4. The UI app only breaks when launching using the BeamMP launcher and joining a server.
carsakiller commented 4 months ago

I believe I found the cause of this. In ui/modules/apps/Hotlapping/app.js, the BeamNG devs check if the gamestate is 'freeroam' and disable the controls if not:

line 389:394

let reevaluateControls = function(){
    bngApi.engineLua('core_gamestate.state and core_gamestate.state.state', function(ret) {
        //console.log("Reevaluating on my own.. State = " + ret)
        scope.controlsEnabled = ret == 'freeroam'
    })
}

Other than begging the devs to add "multiplayer" to the check or redefining the entire app.js with our own case that allows the gamemode to be "multiplayer", not sure what could be done about this.

Starystars67 commented 2 months ago

So I too came to the same conclusion in testing this, the only way that I can see this happening is as already outlined above by @carsakiller .

The following would be ideal:

        let reevaluateControls = function(){
             bngApi.engineLua('core_gamestate.state and core_gamestate.state.state', function(ret) {
              //console.log("Reevaluating on my own.. State = " + ret)
              scope.controlsEnabled = ret == 'freeroam' || ret == 'multiplayer'
            })
        }