diff options
| -rw-r--r-- | content/data/map_static/gm_construct/barrows | 1 | ||||
| -rw-r--r-- | content/data/map_static/gm_construct/trees | 0 | ||||
| -rw-r--r-- | content/data/map_static/gms_rollinghills/barrows | 2 | ||||
| -rw-r--r-- | gamemode/init.lua | 10 | ||||
| -rw-r--r-- | gamemode/init_static.lua | 28 | ||||
| -rw-r--r-- | gamemode/utility.lua | 8 |
6 files changed, 37 insertions, 12 deletions
diff --git a/content/data/map_static/gm_construct/barrows b/content/data/map_static/gm_construct/barrows new file mode 100644 index 0000000..31be900 --- /dev/null +++ b/content/data/map_static/gm_construct/barrows @@ -0,0 +1 @@ +-4321.8149 -2551.3449 257.5130 diff --git a/content/data/map_static/gm_construct/trees b/content/data/map_static/gm_construct/trees new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/content/data/map_static/gm_construct/trees diff --git a/content/data/map_static/gms_rollinghills/barrows b/content/data/map_static/gms_rollinghills/barrows new file mode 100644 index 0000000..fc421d0 --- /dev/null +++ b/content/data/map_static/gms_rollinghills/barrows @@ -0,0 +1,2 @@ +3131.2876 -980.5972 519.5605 +-4225.0200 6009.3516 513.1411 diff --git a/gamemode/init.lua b/gamemode/init.lua index 922d8fd..cc06bf4 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -21,7 +21,8 @@ include( "chatcommands.lua" ) GM.GAMEMODE_FOLDER_NAME = "gmstranded" include( "utility.lua") - +print("About to include init_static.lua") +include( "init_static.lua") AddCSLuaFolder("client",false) includeFolder("server",false) @@ -40,8 +41,11 @@ GM.NextLoaded = 0 /* Moved to /server/tribes.lua*/ GM.AntlionBarrowSpawns = {} -GM.AntlionBarrowSpawns[ "gm_construct" ] = { Vector( -4321.8149, -2551.3449, 257.5130 ) } -GM.AntlionBarrowSpawns[ "gms_rollinghills" ] = { Vector( 3131.2876, -980.5972, 519.5605 ), Vector( -4225.0200, 6009.3516, 513.1411 ) } +--GM.AntlionBarrowSpawns[ "gm_construct" ] = { Vector( -4321.8149, -2551.3449, 257.5130 ) } +print("Loading spawns for gm_construct") +GM.AntlionBarrowSpawns["gm_construct"] = loadBarrows("gm_construct") +--GM.AntlionBarrowSpawns[ "gms_rollinghills" ] = { Vector( 3131.2876, -980.5972, 519.5605 ), Vector( -4225.0200, 6009.3516, 513.1411 ) } +GM.AntlionBarrowSpawns["gms_rollinghills"] = loadBarrows("gms_rollinghills") GM.AntlionBarrowSpawns[ "gms_rollinghills_daynight" ] = GM.AntlionBarrowSpawns[ "gms_rollinghills" ] GM.AntlionBarrowSpawns[ "gms_rollinghills_daynight_b1" ] = GM.AntlionBarrowSpawns[ "gms_rollinghills" ] diff --git a/gamemode/init_static.lua b/gamemode/init_static.lua index 94104a1..467e614 100644 --- a/gamemode/init_static.lua +++ b/gamemode/init_static.lua @@ -1,8 +1,32 @@ +print("Hello from init_static.lua") -function loadBurrows(mapname) +function loaddata(mapname, filename) + local data = {} + local filepath = "gamemodes/" .. GM.GAMEMODE_FOLDER_NAME .. "content/data/" .. mapname .. "/" .. filename + local testpath = "gamemodes/" .. GM.GAMEMODE_FOLDER_NAME .. "content/*" + local files, dirs = file.Find(testpath, "MOD") + print("files:") + PrintTable(files) + print("dirs:") + PrintTable(dirs) + local strings = file.Read(filepath, "MOD") + if(strings == nil) then return end + for k,v in pairs(strings) do + parts = string.Explode(" ",v,false) + vec = Vector(tonumber(parts[1]),tonumber(parts[2]),tonumber(parts[3])) + table.insert(data,nil,vec) + end + print("Loaded data for " .. mapname) + PrintTable(data) + return data +end +function loadBarrows(mapname) + print("Loading barrows") + return loaddata(mapname, "barrows") end function loadTrees(mapname) - + print("Loading trees") + return loaddata(mapname, "trees") end diff --git a/gamemode/utility.lua b/gamemode/utility.lua index dd30345..19d3807 100644 --- a/gamemode/utility.lua +++ b/gamemode/utility.lua @@ -1,20 +1,14 @@ //Helper functions to refactor the init function findRecursive(folderstring,recursive,dofunction) - print("Recursive called") local folderpath = "gamemodes/" .. GM.GAMEMODE_FOLDER_NAME .. "/gamemode/" .. folderstring .. "/" - print("Attempting to load folderpath " .. folderpath) local files, directories = file.Find(folderpath .. "*", "MOD") - print("Files:") - PrintTable(files) - print("Directories:") - PrintTable(directories) for k,v in pairs(files) do dofunction(folderstring .. "/".. v) end if(recursive) then for k,v in pairs(directories) do - addResourceFolder(folderstring..v,recursive) + findRecursive(folderstring..v,recursive,dofunction) end end end |
