local M = {}

local function onBeamNGTrigger(data)
  --Player needs a little help around the loops :)
  if data.triggerName:find("toggleGravity") then
    local noGravity = data.event == "enter"
    be:queueAllObjectLua("obj:setGravity("..(noGravity and 0 or -9.81)..")")
  end
end

local function onScenarioChange(sc)
  if sc.state == "pre-running" then
    be:queueAllObjectLua("obj:setGravity(-9.81)")
  end
end

M.onScenarioChange = onScenarioChange
M.onBeamNGTrigger = onBeamNGTrigger
return M
