Add a lot of new stuff

This commit is contained in:
IonicCheese 2026-02-19 11:12:27 -08:00
commit 948040e47b
13 changed files with 163 additions and 141 deletions

View file

@ -2,9 +2,11 @@
function place_map(map)
local map_path = core.get_modpath("maps") .. "/maps/"
local map_list = core.get_dir_list(map_path, true)
local map_pos = vector.new(0, 0, 0)
for i = 1, #map_list do
if map_list[i] == map then
map_pos = vector.new(1000 * (i - 1), 0, 0)
break
elseif i == #map_list then
return "nope :("
@ -12,12 +14,11 @@ function place_map(map)
end
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)
map_data.pos = map_pos
core.place_schematic(map_pos, 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
map_data.spawn_y = map_data.barrier_level + 1
map_data.spawn_z = map_data.size_z / 2
if not map_data.spawn then -- set a default spawnpoint if not set
map_data.spawn = vector.new(map_data.size.x / 2, map_data.barrier_level + 1, map_data.size.z / 2) + map_pos
end
if map_data.start_time == nil or map_data.start_time <= 0 then
@ -50,12 +51,15 @@ function place_map(map)
return map_data
end
function remove_barrier(x, y, z)
function remove_barrier()
for node_x = 1, x - 2 do
for node_z = 1, z - 2 do
core.set_node({x = node_x, y = y - 1, z = node_z}, {name = "air"}) -- account for the fact that lua counts starting at 1... i think.... whatever, it works \_('_')_/
end
end
assert(loadstring(map_data.scripts.on_barrier_remove or ""))()
if map_data.on_barrier_remove then
map_data.on_barrier_remove()
end
return ""
end

View file

@ -1,22 +1,14 @@
local map_data = {
return {
name = "1v1",
size_x = 41,
size_y = 31,
size_z = 38,
size = vector.new(41, 31, 38),
barrier_level = 27,
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 15,
scripts = {
on_start = "for x=0, 40 do\nfor y=0, 17 do\nfor z=0, 37 do\ncore.set_node({x=x,y=31+y,z=z}, {name=\"default:glass\"})\nend\nend\nend",
on_barrier_remove = "",
on_end = ""
}
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
}
return map_data

View file

@ -1,22 +1,14 @@
local map_data = {
return {
name = "forest-2",
size_x = 189,
size_y = 71,
size_z = 102,
size = vector.new(189, 71, 102),
barrier_level = 67, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 45,
scripts = { -- "temporary" hack to ensure there's nothing on top of the map
on_start = "for x=0, 188 do\nfor y=0, 4 do\nfor z=0, 101 do\ncore.set_node({x=x,y=71+y,z=z}, {name=\"air\"})\nend\nend\nend",
on_barrier_remove = "",
on_end = ""
}
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
}
return map_data

View file

@ -1,22 +1,14 @@
local map_data = {
return {
name = "forest-3",
size_x = 537,
size_y = 117,
size_z = 244,
size = vector.new(537, 117, 244),
barrier_level = 113, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 60,
scripts = {
on_start = "",
on_barrier_remove = "",
on_end = ""
}
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
}
return map_data

View file

@ -1,22 +1,16 @@
local map_data = {
name = "forest-4",
size_x = 190,
size_y = 69,
size_z = 155,
return {
name = "forest-4",
size = vector.new(190, 69, 155),
barrier_level = 65,
barrier_level = 65,
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 30,
start_time = 30,
scripts = {
on_start = "for x=0, 189 do\nfor y=0, 10 do\nfor z=0, 154 do\ncore.set_node({x=x,y=69+y,z=z}, {name=\"air\"})\nend\nend\nend",
on_barrier_remove = "",
on_end = ""
},
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
classes = {
class_1 = {
@ -35,5 +29,3 @@ local map_data = {
}
}
}
return map_data

View file

@ -1,22 +1,16 @@
local map_data = {
return {
name = "forest",
size_x = 155,
size_y = 53,
size_z = 147,
size = vector.new(155, 53, 147),
barrier_level = 49, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 30,
scripts = { -- "temporary" hack to ensure there's nothing on top of the map
on_start = "for x=0, 154 do\nfor y=0, 16 do\nfor z=0, 146 do\ncore.set_node({x=x,y=53+y,z=z}, {name=\"air\"})\nend\nend\nend",
on_barrier_remove = "",
on_end = ""
},
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
classes = {
class_1 = {
@ -35,5 +29,3 @@ local map_data = {
}
}
}
return map_data

View file

@ -1,22 +1,14 @@
local map_data = {
return {
name = "mini-map",
size_x = 8,
size_y = 19,
size_z = 8,
size = vector.new(8, 19, 8),
barrier_level = 15,
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 15,
scripts = {
on_start = "",
on_barrier_remove = "",
on_end = ""
}
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
}
return map_data

View file

@ -1,22 +1,14 @@
local map_data = {
return {
name = "pine",
size_x = 111,
size_y = 64,
size_z = 107,
size = vector.new(111, 64, 107),
barrier_level = 60, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 30,
scripts = {
on_start = "",
on_barrier_remove = "",
on_end = ""
}
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
}
return map_data

View file

@ -1,22 +1,14 @@
local map_data = {
return {
name = "savanna",
size_x = 341,
size_y = 83,
size_z = 188,
size = vector.new(341, 83, 188),
barrier_level = 79, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil,
spawn = nil,
start_time = 45,
scripts = {
on_start = "",
on_barrier_remove = "",
on_end = ""
}
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
}
return map_data

View file

@ -0,0 +1,31 @@
return {
name = "snow",
size = vector.new(267, 100, 335),
barrier_level = 97, -- <- Y level of the barrier
spawn = nil,
start_time = 45,
on_start = nil,
on_end = nil,
on_barrier_remove = nil,
classes = {
class_1 = {
name = "Long-range",
initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99", "default:torch 1"}
},
class_2 = {
name = "Mid-ranged",
initial_items = {"ctf_ranged:ak47_loaded", "ctf_ranged:glock17_loaded", "ctf_ranged:ammo 99", "default:torch 1"}
},
class_3 = {
name = "Short-range",
initial_items = {"ctf_ranged:benelli_loaded", "ctf_ranged:glock17_loaded", "ctf_ranged:ammo 99", "default:torch 1"}
}
}
}

Binary file not shown.