This commit is contained in:
Lizzy Fleckenstein 2021-03-26 17:51:16 +01:00
commit 0372057fe3
17 changed files with 55 additions and 18 deletions

View File

@ -1,5 +1,8 @@
local S = minetest.get_translator("mcl_death_messages") local S = minetest.get_translator("mcl_death_messages")
local N = function(s) return s end local N = function(s) return s end
local C = minetest.colorize
local color_skyblue = mcl_colors.AQUA
local function get_tool_name(item) local function get_tool_name(item)
local name = item:get_meta():get_string("name") local name = item:get_meta():get_string("name")
@ -41,6 +44,9 @@ local msgs = {
["murder"] = { ["murder"] = {
N("@1 was slain by @2 using [@3]"), N("@1 was slain by @2 using [@3]"),
}, },
["murder_hand"] = {
N("@1 was slain by @2"),
},
["murder_any"] = { ["murder_any"] = {
N("@1 was killed."), N("@1 was killed."),
}, },
@ -131,7 +137,7 @@ local last_damages = { }
minetest.register_on_dieplayer(function(player, reason) minetest.register_on_dieplayer(function(player, reason)
-- Death message -- Death message
local message = minetest.settings:get_bool("mcl_showDeathMessages") local message = minetest.settings:get_bool("mcl_showDeathMessages") --Maybe cache the setting?
if message == nil then if message == nil then
message = true message = true
end end
@ -201,7 +207,11 @@ minetest.register_on_dieplayer(function(player, reason)
elseif hitter:is_player() then elseif hitter:is_player() then
hittername = hitter:get_player_name() hittername = hitter:get_player_name()
if hittername ~= nil then if hittername ~= nil then
msg = dmsg("murder", name, hittername, minetest.colorize("#00FFFF", hitter_toolname)) if hitter_toolname == "" then
msg = dmsg("murder_hand", name, hittername)
else
msg = dmsg("murder", name, hittername, C(color_skyblue, hitter_toolname))
end
else else
msg = dmsg("murder_any", name) msg = dmsg("murder_any", name)
end end
@ -229,7 +239,7 @@ minetest.register_on_dieplayer(function(player, reason)
if shooter == nil then if shooter == nil then
msg = dmsg("arrow", name) msg = dmsg("arrow", name)
elseif shooter:is_player() then elseif shooter:is_player() then
msg = dmsg("arrow_name", name, shooter:get_player_name(), minetest.colorize("#00FFFF", get_tool_name(shooter:get_wielded_item()))) msg = dmsg("arrow_name", name, shooter:get_player_name(), C(color_skyblue, get_tool_name(shooter:get_wielded_item())))
elseif s_ent and s_ent._cmi_is_mob then elseif s_ent and s_ent._cmi_is_mob then
if s_ent.nametag ~= "" then if s_ent.nametag ~= "" then
msg = dmsg("arrow_name", name, shooter:get_player_name(), get_tool_name(shooter:get_wielded_item())) msg = dmsg("arrow_name", name, shooter:get_player_name(), get_tool_name(shooter:get_wielded_item()))

View File

@ -56,3 +56,4 @@ A ghast scared @1 to death.=Ein Ghast hat @1 zu Tode erschrocken.
@1 was killed by a baby husk.=@1 wurde von einem Wüstenzombiebaby getötet. @1 was killed by a baby husk.=@1 wurde von einem Wüstenzombiebaby getötet.
@1 was killed by a zombie pigman.=@1 wurde von einem Schweinezombie getötet. @1 was killed by a zombie pigman.=@1 wurde von einem Schweinezombie getötet.
@1 was killed by a baby zombie pigman.=@1 wurde von einem Schweinezombiebaby getötet. @1 was killed by a baby zombie pigman.=@1 wurde von einem Schweinezombiebaby getötet.
@1 was slain by @2.=

View File

@ -55,3 +55,4 @@ A ghast scared @1 to death.=Se ha asustado @1 hasta morir.
@1 was killed by a baby husk.=@1 fue asesinado por un bebé husk. @1 was killed by a baby husk.=@1 fue asesinado por un bebé husk.
@1 was killed by a zombie pigman.=@1 fue asesinado por un cerdo zombie. @1 was killed by a zombie pigman.=@1 fue asesinado por un cerdo zombie.
@1 was killed by a baby zombie pigman.=@1 fue asesinado por un bebé cerdo zombie. @1 was killed by a baby zombie pigman.=@1 fue asesinado por un bebé cerdo zombie.
@1 was slain by @2.=

View File

@ -56,3 +56,4 @@ A ghast scared @1 to death.=Un ghast a éffrayé @1 à mort.
@1 was killed by a baby husk.=@1 a été tué par un bébé zombie momie. @1 was killed by a baby husk.=@1 a été tué par un bébé zombie momie.
@1 was killed by a zombie pigman.=@1 a été tué par un zombie-couchon. @1 was killed by a zombie pigman.=@1 a été tué par un zombie-couchon.
@1 was killed by a baby zombie pigman.=@1 a été tué par un bébé zombie-couchon @1 was killed by a baby zombie pigman.=@1 a été tué par un bébé zombie-couchon
@1 was slain by @2.=

View File

@ -56,3 +56,4 @@ A ghast scared @1 to death.=Гаст напугал @1 до смерти.
@1 was killed by a baby husk.=@1 был(а) убит(а) машылом-кадавром. @1 was killed by a baby husk.=@1 был(а) убит(а) машылом-кадавром.
@1 was killed by a zombie pigman.=@1 был(а) убит(а) зомби-свиночеловеком. @1 was killed by a zombie pigman.=@1 был(а) убит(а) зомби-свиночеловеком.
@1 was killed by a baby zombie pigman.=@1 был(а) убит(а) малышом-зомби-свиночеловеком. @1 was killed by a baby zombie pigman.=@1 был(а) убит(а) малышом-зомби-свиночеловеком.
@1 was slain by @2.=

View File

@ -56,3 +56,4 @@ A ghast scared @1 to death.=
@1 was killed by a baby husk.= @1 was killed by a baby husk.=
@1 was killed by a zombie pigman.= @1 was killed by a zombie pigman.=
@1 was killed by a baby zombie pigman.= @1 was killed by a baby zombie pigman.=
@1 was slain by @2.=

View File

@ -1,3 +1,4 @@
name = mcl_death_messages name = mcl_death_messages
author = 4Evergreen4 author = 4Evergreen4
description = Shows messages in chat when a player dies. description = Shows messages in chat when a player dies.
depends = mcl_colors

View File

@ -489,8 +489,8 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
if filter == nil then if filter == nil then
filter = "" filter = ""
end end
formspec = formspec .. "field[5.3,1.34;4,0.75;suche;;"..minetest.formspec_escape(filter).."]" formspec = formspec .. "field[5.3,1.34;4,0.75;search;;"..minetest.formspec_escape(filter).."]"
formspec = formspec .. "field_close_on_enter[suche;false]" formspec = formspec .. "field_close_on_enter[search;false]"
end end
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
@ -561,11 +561,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
elseif fields.inv then elseif fields.inv then
if players[name].page == "inv" then return end if players[name].page == "inv" then return end
page = "inv" page = "inv"
elseif fields.suche == "" and not fields.creative_next and not fields.creative_prev then elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then
set_inv_page("all", player) set_inv_page("all", player)
page = "nix" page = "nix"
elseif fields.suche ~= nil and not fields.creative_next and not fields.creative_prev then elseif fields.search ~= nil and not fields.creative_next and not fields.creative_prev then
set_inv_search(string.lower(fields.suche),player) set_inv_search(string.lower(fields.search),player)
page = "nix" page = "nix"
end end
@ -612,8 +612,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
players[name].start_i = start_i players[name].start_i = start_i
local filter = "" local filter = ""
if not fields.nix and fields.suche ~= nil and fields.suche ~= "" then if not fields.nix and fields.search ~= nil and fields.search ~= "" then
filter = fields.suche filter = fields.search
players[name].filter = filter players[name].filter = filter
end end

View File

@ -1,6 +1,11 @@
local S = minetest.get_translator("mesecons_commandblock") local S = minetest.get_translator("mesecons_commandblock")
local F = minetest.formspec_escape local F = minetest.formspec_escape
local color_red = mcl_colors.RED
local command_blocks_activated = minetest.settings:get_bool("mcl_enable_commandblocks", true)
local msg_not_activated = S("Command blocks are not enabled on this server")
local function construct(pos) local function construct(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -78,7 +83,7 @@ local function check_commands(commands, player_name)
if string.sub(cmd, 1, 1) == "/" then if string.sub(cmd, 1, 1) == "/" then
msg = S("Error: The command “@1” does not exist; your command block has not been changed. Use the “help” chat command for a list of available commands. Hint: Try to remove the leading slash.", cmd) msg = S("Error: The command “@1” does not exist; your command block has not been changed. Use the “help” chat command for a list of available commands. Hint: Try to remove the leading slash.", cmd)
end end
return false, minetest.colorize("#FF0000", msg) return false, minetest.colorize(color_red, msg)
end end
if player_name then if player_name then
local player_privs = minetest.get_player_privs(player_name) local player_privs = minetest.get_player_privs(player_name)
@ -86,7 +91,7 @@ local function check_commands(commands, player_name)
for cmd_priv, _ in pairs(cmddef.privs) do for cmd_priv, _ in pairs(cmddef.privs) do
if player_privs[cmd_priv] ~= true then if player_privs[cmd_priv] ~= true then
local msg = S("Error: You have insufficient privileges to use the command “@1” (missing privilege: @2)! The command block has not been changed.", cmd, cmd_priv) local msg = S("Error: You have insufficient privileges to use the command “@1” (missing privilege: @2)! The command block has not been changed.", cmd, cmd_priv)
return false, minetest.colorize("#FF0000", msg) return false, minetest.colorize(color_red, msg)
end end
end end
end end
@ -99,9 +104,14 @@ local function commandblock_action_on(pos, node)
return return
end end
minetest.swap_node(pos, {name = "mesecons_commandblock:commandblock_on"})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local commander = meta:get_string("commander")
if not command_blocks_activated then
--minetest.chat_send_player(commander, msg_not_activated)
return
end
minetest.swap_node(pos, {name = "mesecons_commandblock:commandblock_on"})
local commands = resolve_commands(meta:get_string("commands"), pos) local commands = resolve_commands(meta:get_string("commands"), pos)
for _, command in pairs(commands:split("\n")) do for _, command in pairs(commands:split("\n")) do
@ -117,7 +127,6 @@ local function commandblock_action_on(pos, node)
return return
end end
-- Execute command in the name of commander -- Execute command in the name of commander
local commander = meta:get_string("commander")
cmddef.func(commander, param) cmddef.func(commander, param)
end end
end end
@ -129,6 +138,10 @@ local function commandblock_action_off(pos, node)
end end
local on_rightclick = function(pos, node, player, itemstack, pointed_thing) local on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if not command_blocks_activated then
minetest.chat_send_player(player:get_player_name(), msg_not_activated)
return
end
local can_edit = true local can_edit = true
-- Only allow write access in Creative Mode -- Only allow write access in Creative Mode
if not minetest.is_creative_enabled(player:get_player_name()) then if not minetest.is_creative_enabled(player:get_player_name()) then

View File

@ -27,3 +27,4 @@ Access denied. You need the “maphack” privilege to edit command blocks.=Zugr
Editing the command block has failed! You can only change the command block in Creative Mode!=Bearbeitung des Befehlsblocks fehlgeschlagen! Sie können den Befehlsblock nur im Kreativmodus ändern! Editing the command block has failed! You can only change the command block in Creative Mode!=Bearbeitung des Befehlsblocks fehlgeschlagen! Sie können den Befehlsblock nur im Kreativmodus ändern!
Editing the command block has failed! The command block is gone.=Bearbeiten des Befehlsblocks fehlgeschlagen! Der Befehlsblock ist verschwunden. Editing the command block has failed! The command block is gone.=Bearbeiten des Befehlsblocks fehlgeschlagen! Der Befehlsblock ist verschwunden.
Executes server commands when powered by redstone power=Führt Serverbefehle aus, wenn mit Redstoneenergie versorgt Executes server commands when powered by redstone power=Führt Serverbefehle aus, wenn mit Redstoneenergie versorgt
Command blocks are not enabled on this server=

View File

@ -28,3 +28,4 @@ Example 2:@n give @@n mcl_core:apple 5@nGives the nearest player 5 apples=2.
Access denied. You need the “maphack” privilege to edit command blocks.=Acceso denegado. Necesita el privilegio "maphack" para editar bloques de comandos. Access denied. You need the “maphack” privilege to edit command blocks.=Acceso denegado. Necesita el privilegio "maphack" para editar bloques de comandos.
Editing the command block has failed! You can only change the command block in Creative Mode!=¡La edición del bloque de comando ha fallado! ¡Solo puede cambiar el bloque de comandos en modo creativo! Editing the command block has failed! You can only change the command block in Creative Mode!=¡La edición del bloque de comando ha fallado! ¡Solo puede cambiar el bloque de comandos en modo creativo!
Editing the command block has failed! The command block is gone.=¡La edición del bloque de comando ha fallado! El bloque de comando se ha ido. Editing the command block has failed! The command block is gone.=¡La edición del bloque de comando ha fallado! El bloque de comando se ha ido.
Command blocks are not enabled on this server=

View File

@ -27,3 +27,4 @@ Access denied. You need the “maphack” privilege to edit command blocks.=Acc
Editing the command block has failed! You can only change the command block in Creative Mode!=La modification du bloc de commandes a échoué! Vous ne pouvez modifier le bloc de commandes qu'en mode créatif! Editing the command block has failed! You can only change the command block in Creative Mode!=La modification du bloc de commandes a échoué! Vous ne pouvez modifier le bloc de commandes qu'en mode créatif!
Editing the command block has failed! The command block is gone.=La modification du bloc de commandes a échoué! Le bloc de commande a disparu. Editing the command block has failed! The command block is gone.=La modification du bloc de commandes a échoué! Le bloc de commande a disparu.
Executes server commands when powered by redstone power=Exécute les commandes du serveur lorsqu'il est alimenté par l'alimentation Redstone Executes server commands when powered by redstone power=Exécute les commandes du serveur lorsqu'il est alimenté par l'alimentation Redstone
Command blocks are not enabled on this server=Les blocks de commandes ne sont pas activés sur ce serveur

View File

@ -27,3 +27,4 @@ Access denied. You need the “maphack” privilege to edit command blocks.=До
Editing the command block has failed! You can only change the command block in Creative Mode!=Попытка редактирования командного блока потерпела неудачу. Вы можете изменять командные блоки только в творческом режиме! Editing the command block has failed! You can only change the command block in Creative Mode!=Попытка редактирования командного блока потерпела неудачу. Вы можете изменять командные блоки только в творческом режиме!
Editing the command block has failed! The command block is gone.=Попытка редактирования командного блока потерпела неудачу. Командный блок исчез. Editing the command block has failed! The command block is gone.=Попытка редактирования командного блока потерпела неудачу. Командный блок исчез.
Executes server commands when powered by redstone power=При подаче энергии редстоуна выполняет серверные команды Executes server commands when powered by redstone power=При подаче энергии редстоуна выполняет серверные команды
Command blocks are not enabled on this server=

View File

@ -27,3 +27,4 @@ Access denied. You need the “maphack” privilege to edit command blocks.=
Editing the command block has failed! You can only change the command block in Creative Mode!= Editing the command block has failed! You can only change the command block in Creative Mode!=
Editing the command block has failed! The command block is gone.= Editing the command block has failed! The command block is gone.=
Executes server commands when powered by redstone power= Executes server commands when powered by redstone power=
Command blocks are not enabled on this server=

View File

@ -1,3 +1,3 @@
name = mesecons_commandblock name = mesecons_commandblock
depends = mesecons depends = mesecons, mcl_colors
optional_depends = doc, doc_items optional_depends = doc, doc_items

View File

@ -808,7 +808,7 @@ minetest.register_node("mcl_core:obsidian", {
description = S("Obsidian"), description = S("Obsidian"),
_doc_items_longdesc = S("Obsidian is an extremely hard mineral with an enourmous blast-resistance. Obsidian is formed when water meets lava."), _doc_items_longdesc = S("Obsidian is an extremely hard mineral with an enourmous blast-resistance. Obsidian is formed when water meets lava."),
tiles = {"default_obsidian.png"}, tiles = {"default_obsidian.png"},
is_ground_content = true, is_ground_content = false,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
stack_max = 64, stack_max = 64,
groups = {pickaxey=5, building_block=1, material_stone=1}, groups = {pickaxey=5, building_block=1, material_stone=1},

View File

@ -129,6 +129,9 @@ mcl_superflat_classic (Classic superflat map generation) bool false
# If disabled, no ores will be generated. # If disabled, no ores will be generated.
mcl_generate_ores (Generate Ores) bool true mcl_generate_ores (Generate Ores) bool true
# If disabled, command blocks will be unusuable (but still present).
mcl_enable_commandblocks (Enable Command Blocks) bool true
# Make some blocks emit decorative particles like flames. This setting # Make some blocks emit decorative particles like flames. This setting
# specifies the detail level of particles, with higher levels being # specifies the detail level of particles, with higher levels being
# more CPU demanding. # more CPU demanding.