Skip to content

Commit

Permalink
Merge branch 'minetest:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
oong819 authored Jun 3, 2023
2 parents a2a65a5 + 996fea7 commit a50c326
Show file tree
Hide file tree
Showing 47 changed files with 349 additions and 285 deletions.
4 changes: 2 additions & 2 deletions mods/beds/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ function beds.register_bed(name, def)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
local node2 = minetest.get_node_or_nil(p)
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
not node.param2 == node2.param2 then
if not node2 or minetest.get_item_group(node2.name, "bed") ~= 2 or
node.param2 ~= node2.param2 then
return false
end
if minetest.is_protected(p, user:get_player_name()) then
Expand Down
4 changes: 2 additions & 2 deletions mods/beds/beds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ beds.register_bed("beds:bed", {
"beds_bed_top_bottom.png^[transformR90",
"beds_bed_under.png",
"beds_bed_side_bottom_r.png",
"beds_bed_side_bottom_r.png^[transformfx",
"beds_bed_side_bottom_r.png^[transformFX",
"beds_transparent.png",
"beds_bed_side_bottom.png"
},
top = {
"beds_bed_top_top.png^[transformR90",
"beds_bed_under.png",
"beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top_r.png^[transformFX",
"beds_bed_side_top.png",
"beds_transparent.png",
}
Expand Down
4 changes: 2 additions & 2 deletions mods/beds/locale/beds.zh_TW.tr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# textdomain: beds
Fancy Bed=花式床
Simple Bed=簡易床
This bed is already occupied!=
You have to stop moving before going to bed!=
This bed is already occupied!=這個床已經被占據了!
You have to stop moving before going to bed!=你必須在上床前停止移動!
Good morning.=早安!
@1 of @2 players are in bed=@2位玩家中的@1位在床上
Force night skip=強制跳過夜晚
Expand Down
4 changes: 2 additions & 2 deletions mods/boats/locale/boats.ru.tr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# textdomain: boats
Boat cruise mode on=Режим путешествия на лодке включен
Boat cruise mode off=Режим путешествия на лодке выключен
Boat cruise mode on=Автоход лодки включен
Boat cruise mode off=Автоход лодки выключен
Boat=Лодка
4 changes: 2 additions & 2 deletions mods/bones/locale/bones.sv.tr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# textdomain: bones
Bones=Ben
@1's old bones=@1s Gamla ben
@1 died at @2.=@1 dog på @a.
@1 died at @2, and dropped their inventory.=@1 dog på @a, och tappade deras saker.
@1 died at @2.=@1 dog på @2.
@1 died at @2, and dropped their inventory.=@1 dog på @2, och tappade deras saker.
@1 died at @2, and bones were placed.=@1 dog på @2, och deras ben var placerade.
@1's fresh bones=@1s färska ben
@1's bones=@1s ben
2 changes: 1 addition & 1 deletion mods/bucket/locale/bucket.ja.tr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# textdomain: bucket
Empty Bucket=空のバケツ
Water Bucket=水入りバケツ
River Water Bucket=川の水入りバケツ
River Water Bucket=河川水入りバケツ
Lava Bucket=溶岩入りバケツ
56 changes: 29 additions & 27 deletions mods/creative/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,36 @@ end
dofile(minetest.get_modpath("creative") .. "/inventory.lua")

if minetest.is_creative_enabled("") then
-- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1.
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
-- increased such that nodes of differing levels have an insignificant
-- effect on digtime.
local digtime = 42
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
minetest.register_on_mods_loaded(function()
-- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1.
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
-- increased such that nodes of differing levels have an insignificant
-- effect on digtime.
local digtime = 42
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}

-- Override the hand tool
minetest.override_item("", {
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = caps,
cracky = caps,
snappy = caps,
choppy = caps,
oddly_breakable_by_hand = caps,
-- dig_immediate group doesn't use value 1. Value 3 is instant dig
dig_immediate =
{times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256},
},
damage_groups = {fleshy = 10},
}
})
-- Override the hand tool
minetest.override_item("", {
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = caps,
cracky = caps,
snappy = caps,
choppy = caps,
oddly_breakable_by_hand = caps,
-- dig_immediate group doesn't use value 1. Value 3 is instant dig
dig_immediate =
{times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256},
},
damage_groups = {fleshy = 10},
}
})
end)
end

-- Unlimited node placement
Expand Down
14 changes: 9 additions & 5 deletions mods/creative/inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,18 @@ function creative.register_tab(name, title, items)
creative.update_creative_inventory(player_name, items)
local inv = player_inventory[player_name]
local pagenum = math.floor(inv.start_i / (4*8) + 1)
local pagemax = math.ceil(inv.size / (4*8))
local pagemax = math.max(math.ceil(inv.size / (4*8)), 1)
local esc = minetest.formspec_escape
return sfinv.make_formspec(player, context,
(inv.size == 0 and ("label[3,2;"..esc(S("No items to show.")).."]") or "") ..
"label[5.8,4.15;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
[[
image[4.08,4.2;0.8,0.8;creative_trash_icon.png]
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
list[detached:trash;main;4.02,4.1;1,1;]
listring[]
image_button[5,4.05;0.8,0.8;creative_prev_icon.png;creative_prev;]
image_button[7.2,4.05;0.8,0.8;creative_next_icon.png;creative_next;]
image_button[7.25,4.05;0.8,0.8;creative_next_icon.png;creative_next;]
image_button[2.63,4.05;0.8,0.8;creative_search_icon.png;creative_search;]
image_button[3.25,4.05;0.8,0.8;creative_clear_icon.png;creative_clear;]
]] ..
Expand Down Expand Up @@ -191,10 +192,13 @@ function creative.register_tab(name, title, items)
inv.start_i = 0
inv.filter = ""
sfinv.set_player_inventory_formspec(player, context)
elseif fields.creative_search or
fields.key_enter_field == "creative_filter" then
elseif (fields.creative_search or
fields.key_enter_field == "creative_filter")
and fields.creative_filter then
inv.start_i = 0
inv.filter = fields.creative_filter:lower()
inv.filter = fields.creative_filter:sub(1, 128) -- truncate to a sane length
:gsub("[%z\1-\8\11-\31\127]", "") -- strip naughty control characters (keeps \t and \n)
:lower() -- search is case insensitive
sfinv.set_player_inventory_formspec(player, context)
elseif not fields.quit then
local start_i = inv.start_i or 0
Expand Down
1 change: 0 additions & 1 deletion mods/creative/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
name = creative
description = Minetest Game mod: creative
depends = sfinv
optional_depends = default
46 changes: 36 additions & 10 deletions mods/default/chests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,22 @@ end
default.chest.open_chests = {}

minetest.register_on_player_receive_fields(function(player, formname, fields)
local pn = player:get_player_name()

if formname ~= "default:chest" then
if default.chest.open_chests[pn] then
default.chest.chest_lid_close(pn)
end

return
end
if not player or not fields.quit then
return
end
local pn = player:get_player_name()

if not default.chest.open_chests[pn] then
if not (fields.quit and default.chest.open_chests[pn]) then
return
end

default.chest.chest_lid_close(pn)

return true
end)

Expand Down Expand Up @@ -129,17 +132,22 @@ function default.chest.register_chest(prefixed_name, d)
return itemstack
end

local cn = clicker:get_player_name()

if default.chest.open_chests[cn] then
default.chest.chest_lid_close(cn)
end

minetest.sound_play(def.sound_open, {gain = 0.3,
pos = pos, max_hear_distance = 10}, true)
if not default.chest.chest_lid_obstructed(pos) then
minetest.swap_node(pos,
{ name = name .. "_open",
param2 = node.param2 })
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
minetest.after(0.2, minetest.show_formspec, cn,
"default:chest", default.chest.get_chest_formspec(pos))
default.chest.open_chests[clicker:get_player_name()] = { pos = pos,
default.chest.open_chests[cn] = { pos = pos,
sound = def.sound_close, swap = name }
end
def.on_blast = function() end
Expand Down Expand Up @@ -200,6 +208,12 @@ function default.chest.register_chest(prefixed_name, d)
return inv:is_empty("main")
end
def.on_rightclick = function(pos, node, clicker)
local cn = clicker:get_player_name()

if default.chest.open_chests[cn] then
default.chest.chest_lid_close(cn)
end

minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
max_hear_distance = 10}, true)
if not default.chest.chest_lid_obstructed(pos) then
Expand All @@ -208,9 +222,9 @@ function default.chest.register_chest(prefixed_name, d)
param2 = node.param2 })
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
cn,
"default:chest", default.chest.get_chest_formspec(pos))
default.chest.open_chests[clicker:get_player_name()] = { pos = pos,
default.chest.open_chests[cn] = { pos = pos,
sound = def.sound_close, swap = name }
end
def.on_blast = function(pos)
Expand Down Expand Up @@ -274,6 +288,18 @@ function default.chest.register_chest(prefixed_name, d)
end
})
end

-- close opened chests on load
minetest.register_lbm({
label = "close opened chests on load",
name = "default:close_" .. prefixed_name:gsub(":", "_") .. "_open",
nodenames = {prefixed_name .. "_open"},
run_at_every_load = true,
action = function(pos, node)
node.name = prefixed_name
minetest.swap_node(pos, node)
end
})
end

default.chest.register_chest("default:chest", {
Expand Down
3 changes: 2 additions & 1 deletion mods/default/craftitems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end

if fields.close then
if fields.quit then
book_writers[player_name] = nil
end

Expand Down Expand Up @@ -179,6 +179,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
data.description = S("\"@1\" by @2", short_title, data.owner)
data.text = fields.text:sub(1, max_text_size)
data.text = data.text:gsub("\r\n", "\n"):gsub("\r", "\n")
data.text = data.text:gsub("[%z\1-\8\11-\31\127]", "") -- strip naughty control characters (keeps \t and \n)
data.page = 1
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)

Expand Down
2 changes: 1 addition & 1 deletion mods/default/locale/default.eo.tr
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Empty Bookshelf=Malplena Librobreto
Bookshelf (@1 written, @2 empty books)=Librobreto (@1 skriba(j), @2 malplena(j) libro(j))
Bookshelf=Librobreto
Text too long=Tro longa teksto
"@1"=
Wooden Sign=Ligna Signo
Steel Sign=Ŝtala Signo
Wooden Ladder=Ligna Ŝtupetaro
Expand Down Expand Up @@ -217,4 +218,3 @@ Torch=Torĉo
##### not used anymore #####

Mese Post Light=Mesea Fosta Lampo

2 changes: 1 addition & 1 deletion mods/default/locale/default.fr.tr
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Aspen Tree Leaves=Feuilles de tremble
Aspen Tree Sapling=Pousse de tremble
Coal Ore=Minerai de charbon
Coal Block=Bloc de charbon
Iron Ore=Bloc de fer
Iron Ore=Minerai de fer
Steel Block=Bloc d'acier
Copper Ore=Minerai de cuivre
Copper Block=Bloc de cuivre
Expand Down
Loading

0 comments on commit a50c326

Please sign in to comment.