VE Lua Documentation

Press F to search!

setMap

Definition


-- @/lua/vehicle/mapmgr.lua:44

local function setMap(newbuildSerial)
  if newbuildSerial and newbuildSerial == mapBuildSerial then return end
  mapBuildSerial = newbuildSerial

  local _map = lpack.decode(obj:getLastMailbox('mapData'))
  if not (_map and _map.graphData and _map.edgeKdTree and _map.maxRadius and _map.nodeAliases) then return end

  maxRadius = _map.maxRadius
  M.nodeAliases = _map.nodeAliases

  mapData = graphpath.newGraphpath()
  mapData:import(_map.graphData)
  updateDrivabilities()
  M.mapData = mapData

  edgeKdTree = kdTreeBox2D.new()
  edgeKdTree:import(_map.edgeKdTree)

  M.rules = _map.rules

  obj:queueGameEngineLua("extensions.hook('onVehicleMapmgrUpdate', "..tostring(objectId)..")")
end

Callers

@/lua/ge/map.lua
  if objbuildSerial ~= buildSerial then
    be:queueObjectLua(objId, string.format("mapmgr.setMap(%d)", buildSerial))