forked from ZeroK-RTS/Zero-K
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValidMaps.lua
73 lines (68 loc) · 2.33 KB
/
ValidMaps.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-- $Id: ValidMaps.lua 3171 2008-11-06 09:06:29Z det $
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- ValidMaps.lua
--
-- This file can be added to a mod to dictate which maps
-- can (and can not) be used with it. The map information
-- is the map's default information, and is done before
-- MapOptions.lua can be used by maps.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Map specific call-outs:
--
-- Spring.GetMapList() -> { 'map1.smf', 'map2.smf', 'map3.sm3', etc... }
--
-- Spring.GetMapInfo('map1') -> {
-- author = 'string',
-- desc = 'string',
-- mapX = number,
-- mapY = number,
-- tidal = number,
-- gravity = number,
-- metal = number,
-- windMin = number,
-- windMax = number,
-- extractorRadius = number,
-- startPos = {
-- [1] = { x = number, z = number },
-- [2] = { x = number, z = number },
-- [3] = { x = number, z = number },
-- etc ...
-- },
-- }
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Example filtering code
--
if (false) then
local mapList = Spring.GetMapList()
local validMaps = {}
for _, mapName in ipairs(mapList) do
if (mapName:lower():find('metal')) then
local mapInfo = Spring.GetMapInfo(mapName)
local minX = (16 * 512)
local minY = (8 * 512)
if ((mapInfo.mapX >= minX) and
(mapInfo.mapY >= minY)) then
validMaps[#validMaps + 1] = mapName
end
end
end
if (#validMaps == 0) then
return { 'FAKEMAP' }
else
return validMaps
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
return {} -- returning an empty table means *ALL MAPS* are valid
-- for *NO MAPS*, return a fake map name, ex: { 'FakeMap' }
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------