Add credits overlay prototype

This commit is contained in:
Elias Fleckenstein 2021-04-04 19:13:46 +02:00
parent f54f4ebcf9
commit 90f312f772
4 changed files with 113 additions and 0 deletions

View file

@ -0,0 +1,105 @@
mcl_credits = {
players = {},
}
mcl_credits.description = "A faithful Open Source imitation of Minecraft"
-- Sub-lists are sorted by number of commits
mcl_credits.people = {
{"Creator of MineClone", {
"davedevils",
}},
{"Creator of MineClone2", {
"Wuzzy",
}},
{"Maintainers", {
"Fleckenstein",
"kay27",
"oilboi",
}},
{"Developers", {
"bzoss",
"AFCMS",
"epCode",
"ryvnf",
"iliekprogrammar",
"MysticTempest",
"Rootyjr",
"Nicu",
"aligator",
}},
{"Contributors", {
"Code-Sploit",
"Laurent Rocher",
"HimbeerserverDE",
"TechDudie",
"Alexander Minges",
"ArTee3",
"ZeDique la Ruleta",
"pitchum",
"wuniversales",
"Bu-Gee",
"David McMackins II",
"Nicholas Niro",
"Wouters Dorian",
"Blue Blancmange",
"Jared Moody",
"Li0n",
"Midgard",
"NO11",
"Saku Laesvuori",
"Yukitty",
"ZedekThePD",
"aldum",
"dBeans",
"nickolas360",
"yutyo",
}},
{"3D Models", {
"22i",
"tobyplowy",
}},
{"Textures", {
"XSSheep",
"kingoscargames",
"leorockway",
"xMrVizzy",
}},
}
function mcl_credits.show(player)
local name = player:get_player_name()
if mcl_credits.players[name] then
return
end
local hud_list = {
player:hud_add({
hud_elem_type = "image",
text = "menu_bg.png",
position = {x = 0, y = 0},
alignment = {x = 1, y = 1},
scale = {x = -100, y = -100},
z_index = 1000,
})
}
mcl_credits.players[name] = hud_list
end
function mcl_credits.hide(player)
local name = player:get_player_name()
local list = mcl_credits.players[name]
if list then
for _, id in pairs(list) do
player:hud_remove(id)
end
end
mcl_credits.players[name] = nil
end
controls.register_on_press(function(player, key)
if key == "sneak" then
mcl_credits.hide(player)
elseif key == "aux1" then
mcl_credits.show(player)
end
end)

View file

@ -0,0 +1,4 @@
name = mcl_credits
author = Fleckenstein
description = Show a HUD containing the credits
depends = controls

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -170,6 +170,7 @@ function mcl_portals.end_teleport(obj, pos)
-- Teleport back to the player's spawn or world spawn in the Overworld. -- Teleport back to the player's spawn or world spawn in the Overworld.
if obj:is_player() then if obj:is_player() then
target = mcl_spawn.get_player_spawn_pos(obj) target = mcl_spawn.get_player_spawn_pos(obj)
end end
target = target or mcl_spawn.get_world_spawn_pos(obj) target = target or mcl_spawn.get_world_spawn_pos(obj)
@ -211,6 +212,9 @@ function mcl_portals.end_teleport(obj, pos)
-- Look towards the main End island -- Look towards the main End island
if dim ~= "end" then if dim ~= "end" then
obj:set_look_horizontal(math.pi/2) obj:set_look_horizontal(math.pi/2)
-- Show credits
else
mcl_credits.show(obj)
end end
mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target)) mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target))
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}, true) minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}, true)