Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a help page for CTF available through command /ctf_help #1217

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
94 changes: 94 additions & 0 deletions mods/other/ctf_help/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
local markdown_help = [[
# Capture the Flag Help

### Basics
* Click the opposite team's flag to take it.
Then, click your team's flag before the enemy takes it in order to capture.
* Each team has a team chest; put useful items in there and **never** take more than you need!

### Modes
* CTF cycles through three modes: Classes, Nade Fight, and Classic.
* At the end of each mode, you get to vote for how many matches of the next mode you would like to play.

* In Classes, right-click your team's flag to change classes.
It's helpful to read the description of the items your class is given.
* In Nade Fight, right-click your grenade to switch between three types of nade.
* In Classic, eat apples to heal and find ores to craft better swords.

### Tips & Tricks
* Sneak while jumping to jump up two blocks.
* Start your messages with `/t` to send a message only visible to teamates.
* Sprint by pressing the fast key (`E` by default).
* Use `/r` to check your rank.
* Use `/m` to add a team marker at pointed location.
* Use `/s` to check the current and previous match summary.
* Use `/top50` to see the leaderboard.
* Use `/team` to check all team members.
* Use `/donate <player> <score>` to donate scores to a player.
* Use `/lb` to see a list of bountied players.
* Use `/msg` <player> to send a PM to a player.

****
]]

local function ctf_help(name, help_content)
local formspec_help = md2f.md2f(0.3, 0, 8, 10, help_content)
local formspec = "size[8,9.5]" ..
formspec_help ..
"button_exit[3,8.75;2,1;exit;Close]"
minetest.show_formspec(name, "ctf_help", formspec)
return true
end

minetest.register_on_newplayer(function(player)
local player_name = player:get_player_name()
local background_hud = player:hud_add({
hud_elem_type = "image",
position = {x = 1, y = 0.15},
offset = {x = -180, y = 20},
text = "background.png",
scale = {x = 1.5, y = 1.2},
alignment = 0
})
local welcome_hud = player:hud_add({
hud_elem_type = "text",
position = {x = 1, y = 0.15},
offset = {x = -180, y = 0},
text = "Welcome to Capture the Flag!",
alignment = 0,
scale = {x = 100, y = 30},
number = 0xFFA500,
})
local text_hud = player:hud_add({
hud_elem_type = "text",
position = {x = 1, y = 0.15},
offset = {x = -180, y = 40},
text = "Run /ctf_help in chat for instructions\non how to play.",
alignment = 0,
scale = {x = 100, y = 30},
number = 0xFFFFFF,
})

minetest.after(60, function()
player:hud_remove(welcome_hud)
player:hud_remove(text_hud)
player:hud_remove(background_hud)
end)

minetest.register_chatcommand("ctf_help", {
func = function(name, param)
if name == player_name then
player:hud_remove(welcome_hud)
player:hud_remove(text_hud)
player:hud_remove(background_hud)
end
ctf_help(name, markdown_help)
end
})
end)

minetest.register_chatcommand("ctf_help", {
func = function(name, param)
ctf_help(name, markdown_help)
end
})
2 changes: 2 additions & 0 deletions mods/other/ctf_help/mod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name = ctf_help
depends = markdown2formspec
Binary file added mods/other/ctf_help/textures/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading