GE Lua Documentation

Press F to search!

parseMission

Definition


-- @/lua/ge/extensions/gameplay/missions/startTrigger.lua:73

-- creates a list of locations from a start trigger.
local function parseMission(mission)
  local locations = {}
  local trigger = mission.startTrigger -- we can safely assume this exists because it is checked before this function is called
  if trigger.type and startTriggerTypes[trigger.type] then
    local requirementsMet = true
    local missingFields = {}
    for _, field in ipairs(startTriggerRequiredFields[trigger.type] or {}) do
      if trigger[field] == nil then
        requirementsMet = false
        table.insert(missingFields, field)
      end
    end
    if requirementsMet then
      startTriggerTypes[trigger.type](trigger, locations, mission)
      return locations, nil
    else
      return {}, "Missing fields for type " .. trigger.type .. ": " .. dumps(missingFields)
    end
  else
    return {}, "Type invalid: " .. dumps(trigger.type)
  end
end

Callers

@/lua/ge/extensions/gameplay/missions/missions.lua
  end
  local locations, err = gameplay_missions_startTrigger.parseMission(mission)
  if err then