mirror of
https://github.com/a-bad-dev/simple-shooter-game.git
synced 2026-06-13 05:26:05 +00:00
Fix some bugs
the game at least loads now, though it crashes when you run /start <a map>
This commit is contained in:
parent
a53c37e2f2
commit
0eb14ab41c
2 changed files with 4 additions and 4 deletions
|
|
@ -125,7 +125,7 @@ core.register_on_mods_loaded(function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
core.register_on_joinplayer(function(player)
|
core.register_on_joinplayer(function(player)
|
||||||
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
|
player:set_pos({x=0, y=0, z=0})
|
||||||
player:get_inventory():set_list("main", {})
|
player:get_inventory():set_list("main", {})
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
|
|
@ -172,8 +172,8 @@ core.register_chatcommand("start", {
|
||||||
privs = {match_manager = true},
|
privs = {match_manager = true},
|
||||||
description = "Start the match",
|
description = "Start the match",
|
||||||
func = function()
|
func = function()
|
||||||
local map_data = place_map(map)
|
map_data = place_map(map)
|
||||||
remove_barrier(x=map_data.size_x, y=map_data.barrier_level, z=map_data.size_z)
|
remove_barrier(map_data.size_x, map_data.barrier_level, map_data.size_z)
|
||||||
core.chat_send_all(core.colorize("green", "Match started!"))
|
core.chat_send_all(core.colorize("green", "Match started!"))
|
||||||
alive_players = {}
|
alive_players = {}
|
||||||
for _, player in pairs(core.get_connected_players()) do
|
for _, player in pairs(core.get_connected_players()) do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ function place_map(map)
|
||||||
core.place_schematic({x=0, y=0, z=0}, map_path .. map .. "/map.mts", 0, nil, false)
|
core.place_schematic({x=0, y=0, z=0}, map_path .. map .. "/map.mts", 0, nil, false)
|
||||||
local map_data = dofile(map_path .. map .. "/map.lua")
|
local map_data = dofile(map_path .. map .. "/map.lua")
|
||||||
|
|
||||||
if map_data.spawn_x == nil or map_data.spawn_y == nil or map_data.spawn_z == nil do -- set a default spawnpoint if not set
|
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_x = map_data.size_x / 2
|
||||||
map_data.spawn_y = map_data.barrier_level + 1
|
map_data.spawn_y = map_data.barrier_level + 1
|
||||||
map_data.spawn_z = map_data.size_z / 2
|
map_data.spawn_z = map_data.size_z / 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue