mirror of
https://github.com/a-bad-dev/simple-shooter-game.git
synced 2026-06-08 20:12:11 +00:00
Backport some features to not require 5.15.0+
Also decrease map load time
This commit is contained in:
parent
000b4e9cad
commit
caaf2481d2
2 changed files with 13 additions and 8 deletions
|
|
@ -1,13 +1,18 @@
|
|||
-- Maps mod for SSG
|
||||
function place_map(map)
|
||||
local map_path = core.get_modpath("maps") .. "/maps/" .. map .. "/"
|
||||
local map_path = core.get_modpath("maps") .. "/maps/"
|
||||
local map_list = core.get_dir_list(map_path, true)
|
||||
|
||||
if not core.path_exists(map_path) then
|
||||
return "nope :("
|
||||
for i = 1, #map_list do
|
||||
if map_list[i] == map then
|
||||
break
|
||||
elseif i == #map_list then
|
||||
return "nope :("
|
||||
end
|
||||
end
|
||||
|
||||
local map_data = dofile(map_path .. "map.lua")
|
||||
core.place_schematic({x=0, y=0, z=0}, map_path .. "map.mts", 0, nil, true)
|
||||
local map_data = dofile(map_path .. map .. "/map.lua")
|
||||
core.place_schematic({x=0, y=0, z=0}, map_path .. map .. "/map.mts", 0, nil, true)
|
||||
|
||||
if map_data.spawn_x == nil or map_data.spawn_y == nil or map_data.spawn_z == nil then -- set a default spawnpoint if not set
|
||||
map_data.spawn_x = map_data.size_x / 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue