beamBreak and update for vehicle lua

Discussion in 'Ideas and Suggestions' started by Dummiesman, Apr 5, 2015.

  1. Dummiesman

    Dummiesman
    Expand Collapse

    Joined:
    Sep 17, 2013
    Messages:
    4,700
    Hey! I think it'd be good for modders to have these functions available for custom vehicle Lua

    [xcode=lua]
    local M = {}

    local detectBeam = nil

    local function update()
    if electrics.values["example"] = 0 then --physics stuff end
    end

    local function init
    electrics.values["example"] = 1
    for k,beam in v.data.beams do
    if beam.name == "detectMe" then detectBeam = k end
    end
    end

    local function beamBreak(b)
    if b == detectBeam then
    electrics.values["example"] = 0
    end
    end

    local function reset()
    --since it's harmless
    init()
    end

    M.update = update
    M.beamBreak = beamBreak
    M.init = init
    M.reset = reset

    [/xcode]
     
  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