Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added gridwar/barriers.data
Binary file not shown.
134 changes: 134 additions & 0 deletions gridwar/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
local MAP_NAME = "GridWar"
local DEATH_BARRIER_Y_OFFSET = 12
local RESPAWN_Y_OFFSET = 2
local AIR_LIGHT_LEVEL = 3
local MESSAGE_INTERVAL = 600


local gridwar_messages = {
"You can never reach the ground",
"Headache?",
"I feel I am in heaven",
"Don't confuse direction",
"Am I in heaven?",
"The void calls to you",
"Reality bends around you",
"Which way is up?",
"Gravity is just a suggestion",
"Lost in the grid...",
"The platform knows your thoughts",
"Time moves differently here",
"Are you still falling?",
"The lights whisper secrets",
"Nothing is as it seems",
"Welcome to the endless maze",
"The grid remembers everything",
"Footsteps echo in eternity",
"Your shadow has left you",
"The air tastes of electricity",
"Distance is an illusion",
"Something watches from below",
"The patterns repeat forever",
"Can you trust your eyes?",
"The platform shifts when you sleep",
"Echoes of forgotten battles",
"The void has infinite patience",
"Your reflection lies to you",
"The grid dreams of escape",
"Falling upward is still falling",
"The silence is deafening",
"I don't feel gravity",
"In a dream",
"I feel light"
}

local message_timer = nil

local function send_atmospheric_message()
if not ctf_map.current_map or ctf_map.current_map.name ~= MAP_NAME then
return
end

local message = gridwar_messages[math.random(#gridwar_messages)]

minetest.chat_send_all(minetest.colorize("#FFAA00", "◊ " .. message .. " ◊"))
end

minetest.register_node("ctf_map:glowing_air", {
description = "Glowing Air",
drawtype = "airlike",
paramtype = "light",
light_source = AIR_LIGHT_LEVEL,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
air_equivalent = true,
drop = "",
groups = {not_in_creative_inventory = 1}
})


local world_bound_pos1, world_bound_pos2 = nil, nil
ctf_api.register_on_new_match(function ()
if ctf_map.current_map and ctf_map.current_map.name == MAP_NAME then
minetest.after(0, function ()
world_bound_pos1 = ctf_map.current_map.pos1
world_bound_pos2 = ctf_map.current_map.pos2
end)

local function schedule_next_message()
if ctf_map.current_map and ctf_map.current_map.name == MAP_NAME then
send_atmospheric_message()
message_timer = minetest.after(MESSAGE_INTERVAL, schedule_next_message)
end
end
message_timer = minetest.after(120, schedule_next_message)
end
end)

ctf_api.register_on_match_end(function ()
if ctf_map.current_map and ctf_map.current_map.name == MAP_NAME then
world_bound_pos1 = nil
world_bound_pos2 = nil

if message_timer then
message_timer:cancel()
message_timer = nil
end
end
end)

minetest.register_on_player_hpchange(function(player, hp_change, reason)
if reason and reason.type == "fall" then
if ctf_map.current_map and ctf_map.current_map.name == MAP_NAME then
return 0
end
end
return hp_change
end, true)

-- teleport barriers

local function is_below_death_barrier(player)
if not world_bound_pos1 then return false end
return player:get_pos().y < world_bound_pos1.y + DEATH_BARRIER_Y_OFFSET
end

local function respawn_player_at_top(player)
if not world_bound_pos2 then return end
local pos = player:get_pos()
local new_pos = {x = pos.x, y = world_bound_pos2.y - RESPAWN_Y_OFFSET, z = pos.z}
player:set_pos(new_pos)
end

minetest.register_globalstep(function ()
if ctf_map.current_map and ctf_map.current_map.name ~= MAP_NAME then
return
end
for _, player in ipairs(minetest:get_connected_players()) do
if is_below_death_barrier(player) then
respawn_player_at_top(player)
end
end
end)
22 changes: 22 additions & 0 deletions gridwar/map.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
game_modes = return {"classes","nade_fight","classic"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
game_modes = return {"classes","nade_fight","classic"}
game_modes = return {"classes","classic"}

barrier_area = return {pos1={z=0,x=0,y=0},pos2={z=222,x=222,y=60}}
teams = local _={};_[1]="flag_pos";_[2]="enabled";return {purple={[_[2]]=true,[_[1]]={z=207,x=207,y=31},pos1={z=222,x=222,y=0},pos2={z=111,x=111,y=60}},blue={[_[2]]=true,[_[1]]={z=207,x=15,y=31},pos1={z=222,x=0,y=0},pos2={z=111,x=111,y=60}},green={[_[2]]=true,[_[1]]={z=15,x=15,y=31},pos1={z=0,x=0,y=0},pos2={z=111,x=111,y=60}},orange={[_[2]]=true,[_[1]]={z=15,x=207,y=31},pos1={z=0,x=222,y=0},pos2={z=111,x=111,y=60}}}
chests = return {{amount=100,pos1={z=114,x=6,y=13},pos2={z=216,x=108,y=55}},{amount=100,pos1={z=6,x=6,y=13},pos2={z=108,x=108,y=55}},{amount=100,pos1={z=6,x=114,y=13},pos2={z=108,x=216,y=55}},{amount=100,pos1={z=114,x=114,y=13},pos2={z=216,x=216,y=55}}}
phys_jump = 1
phys_speed = 1
size = return {z=222,x=222,y=60}
map_version = 3
enabled = true
name = GridWar
phys_gravity = 1
initial_stuff = return {"default:pick_stone","ctf_ranged:pistol_loaded","default:stick 5","default:cobble 99"}
author = mpixel
hint =
license = CC BY-SA 4.0
others =
treasures = default:stone_with_mese;1;3;1;0.15;1;default:stone_with_iron;1;5;1;0.2;1;default:glass;50;99;2;0.3;1;
skybox = none
enable_shadows = 0.26
start_time = 0
time_speed = 1

Binary file added gridwar/map.mts
Binary file not shown.
Binary file added gridwar/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.