Unsolved Distinction between player and non-player at vehicle LUA

Discussion in 'Mod Support' started by vr-bobbington, Oct 20, 2024.

  1. vr-bobbington

    vr-bobbington
    Expand Collapse

    Joined:
    Sep 18, 2024
    Messages:
    24
    I'm trying to implement a performance mod with traffic and BeamMP in mind (mainly the logic here: [New Experimental] Increase FPS for decreased Damage Model by OfficialLambdax · Pull Request #487 · BeamMP/BeamMP · GitHub , with permission from original author @Anonymous-275 )

    I'm trying to do it by injection into stage2.lua with a similar method as here: https://www.beamng.com/threads/0-29-1-performance-mod-selfcollisiondisabler.93250/#post-1614051

    Problem: I don't want to apply it to the player vehicle. At stage2.lua playerInfo is not set yet and I can't get a be:getPlayerVehicle(0) call to GE lua working either.

    So, how do I make a distinction between player and non-player vehicle at this stage of vehicle creation?


    Code:
    local stage2 = require("vehicle/jbeam/stage2")
    
    do
        local pushToPhysics = ({debug.getupvalue(stage2.loadVehicleStage2, 1)})[2]
        local processNodes  = ({debug.getupvalue(pushToPhysics, 1)})[2]
    
        debug.setupvalue(pushToPhysics, 1, function(vehicle)
    
    *do stuff if obj:getid() ~= playerVehicleId*
    
        debug.setupvalue(pushToPhysics, 1, processNodes)
    
            return processNodes(vehicle)
        end)
    end
    
    return stage2
     
  2. _N_S_

    _N_S_
    Expand Collapse

    Joined:
    Oct 28, 2017
    Messages:
    76
    For example, like this
     

    Attached Files:

    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice