Compare commits

..

25 Commits

Author SHA1 Message Date
loveaabb 195b193260 remove trailing whitespace 2024-05-24 01:39:11 +00:00
loveaabb 83a651d375 change a misset global variable to local 2024-05-18 15:25:03 +00:00
loveaabb 19190d92e7 revert f50ef6b52a
revert 更新 mods/ITEMS/mcl_shields/init.lua

change commit info
2024-05-18 15:21:38 +00:00
loveaabb f50ef6b52a 更新 mods/ITEMS/mcl_shields/init.lua 2024-05-18 15:15:42 +00:00
loveaabb 50fda3e844 Several improvements to the Shield
changes:
1. removed the limitation to block while pointing a node wielding an item
2. check whether the player is pointing to a node defined with right-click Formspec (to avoid the formspec bug while blocking) and whether the player is wielding a node (to avoid continous node placing not functioning) before blocking
3. decreased the interval between right click and block
2024-05-16 15:33:32 +00:00
Mikita Wiśniewski 3b1c55c234 Remove garbage pixels from sweet berry textures (#4281)
Reviewed-on: MineClone2/MineClone2#4281
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
2024-05-05 16:07:47 +00:00
Mikita Wiśniewski 0ef81681ba Make item frames attached to the block they're placed on (fixes #3736) (#4279)
Reviewed-on: MineClone2/MineClone2#4279
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
2024-05-04 11:43:54 +00:00
the-real-herowl efc6ab0bbf Merge pull request 'Hollow logs fixes' (#4268) from hollow_logs into master
Reviewed-on: MineClone2/MineClone2#4268
2024-05-04 10:08:17 +00:00
Bram van den Heuvel 69acc5074b Fix dungeon margin bug (#4276)
Some mapgen settings used to crash the game.

Reviewed-on: MineClone2/MineClone2#4276
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: Bram van den Heuvel <bram.vdh1999@gmail.com>
Co-committed-by: Bram van den Heuvel <bram.vdh1999@gmail.com>
2024-05-03 14:05:51 +00:00
the-real-herowl 7d999535e7 Merge pull request 'Ghast fixes' (#4277) from ghast_fixes into master
Reviewed-on: MineClone2/MineClone2#4277
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
2024-05-03 12:57:32 +00:00
teknomunk 81ca224bb8 Add wear to shears used to harvest comb from a beehive (#4251)
Reviewed-on: MineClone2/MineClone2#4251
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
2024-05-02 11:52:47 +00:00
nixnoxus 3975449ad2 fix mcl_beds: ignore players in other dimensions than overwold (#4257)
beds ignore players in other dimensions than "overworld" (because players can only sleep in the "overworld")

Reviewed-on: MineClone2/MineClone2#4257
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: nixnoxus <nixnoxus@web.de>
Co-committed-by: nixnoxus <nixnoxus@web.de>
2024-05-02 03:13:27 +00:00
teknomunk 6756658ee9 Fix server crash when server restarts after a player dies but they didn't respawn (#4246)
Ensuring that tables storing player data are initialized before being used.

Reviewed-on: MineClone2/MineClone2#4246
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
2024-05-02 03:01:43 +00:00
the-real-herowl 4dde321a04 Ghast fireball fixes 2024-05-02 00:18:43 +02:00
Araca cd0509c2e6 Fix crash with ghast achievement fireball_redir_serv (#4179)
Reviewed-on: MineClone2/MineClone2#4179
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: Araca <araca.prod@gmail.com>
Co-committed-by: Araca <araca.prod@gmail.com>
2024-05-01 22:15:56 +00:00
the-real-herowl cc1e01ad78 Made API actually work for outside the mod 2024-05-01 21:59:10 +02:00
the-real-herowl b9428e3438 Definition validation improved 2024-05-01 21:50:05 +02:00
teknomunk 0c372f987d Stop villagers from eating shulker boxes (#4266)
This modifies the logic for mobs picking up items to only match against the item's name and ignore any text in an items metadata.

Reviewed-on: MineClone2/MineClone2#4266
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
2024-05-01 15:44:14 +00:00
Bakawun 22c4daab22 fix walking and running animation for horse donkey and mule (#4053)
no more gliding horses

Co-authored-by: bakawun <bakawun@getnada.com>
Reviewed-on: MineClone2/MineClone2#4053
Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-authored-by: Bakawun <bakawun@noreply.git.minetest.land>
Co-committed-by: Bakawun <bakawun@noreply.git.minetest.land>
2024-05-01 15:40:57 +00:00
the-real-herowl a25e2b8eb3 Spaces to tabs 2024-04-30 03:55:17 +02:00
the-real-herowl ee2998e21b Replaced early returns with error calls 2024-04-30 03:53:49 +02:00
the-real-herowl e0aadc7996 Updated the textures to the new UV map
Also added explicit use_texture_alpha = "clip"
2024-04-30 03:49:38 +02:00
the-real-herowl 9f65c5efb7 New hollow log model (optimized + UV map improved) 2024-04-30 02:56:13 +02:00
the-real-herowl 7ad4ca2dbe Spaces to tabs 2024-04-30 02:29:12 +02:00
JoseDouglas26 1161d5cd36 Hollow logs (#4267)
Reviewed-on: MineClone2/MineClone2#4267
Co-authored-by: JoseDouglas26 <josedouglas20002014@gmail.com>
Co-committed-by: JoseDouglas26 <josedouglas20002014@gmail.com>
2024-04-30 00:24:12 +00:00
50 changed files with 542 additions and 172 deletions

View File

@ -6,9 +6,6 @@ local pool = {}
local tick = false local tick = false
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
pool[player:get_player_name()] = 0 pool[player:get_player_name()] = 0
end) end)
@ -172,17 +169,17 @@ minetest.register_globalstep(function(_)
local pos = player:get_pos() local pos = player:get_pos()
if tick == true and pool[name] > 0 then if tick == true and (pool[name] or 0) > 0 then
minetest.sound_play("item_drop_pickup", { minetest.sound_play("item_drop_pickup", {
pos = pos, pos = pos,
gain = 0.3, gain = 0.3,
max_hear_distance = 16, max_hear_distance = 16,
pitch = math.random(70, 110) / 100 pitch = math.random(70, 110) / 100
}) })
if pool[name] > 6 then if (pool[name] or 0) > 6 then
pool[name] = 6 pool[name] = 6
else else
pool[name] = pool[name] - 1 pool[name] = (pool[name] or 1) - 1
end end
end end

View File

@ -374,7 +374,7 @@ function mcl_mobs.register_arrow(name, def)
rotate = def.rotate, rotate = def.rotate,
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
local vel = self.object:get_velocity():length() local vel = self.object:get_velocity():length()
self.object:set_velocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel}) self.object:set_velocity(dir * vel)
self._puncher = puncher self._puncher = puncher
end, end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},

View File

@ -87,7 +87,8 @@ function mob_class:check_item_pickup()
end end
if self.pick_up then if self.pick_up then
for k,v in pairs(self.pick_up) do for k,v in pairs(self.pick_up) do
if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then local itemstack = ItemStack(l.itemstring)
if not player_near(p) and self.on_pick_up and itemstack:get_name():find(v) then
local r = self.on_pick_up(self,l) local r = self.on_pick_up(self,l)
if r and r.is_empty and not r:is_empty() then if r and r.is_empty and not r:is_empty() then
l.itemstring = r:to_string() l.itemstring = r:to_string()

View File

@ -126,13 +126,14 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
end, end,
hit_mob = function(self, mob) hit_mob = function(self, mob)
local name = mob:get_luaentity().name
mob:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = 6}, damage_groups = {fleshy = 6},
}, nil) }, nil)
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true) mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
local ent = mob:get_luaentity() local ent = mob:get_luaentity()
if not ent or ent.health <= 0 then if (not ent or ent.health <= 0) and self._puncher and name == "mobs_mc:ghast" then
awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv") awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv")
end end
end, end,

View File

@ -122,10 +122,10 @@ local horse = {
stand_speed = 25, stand_speed = 25,
stand_start = 0, stand_start = 0,
stand_end = 0, stand_end = 0,
walk_speed = 25, walk_speed = 100,
walk_start = 0, walk_start = 0,
walk_end = 40, walk_end = 40,
run_speed = 60, run_speed = 200,
run_start = 0, run_start = 0,
run_end = 40, run_end = 40,
}, },
@ -543,11 +543,6 @@ donkey.description = S("Donkey")
donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}} donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}}
donkey.spawn_in_group = 3 donkey.spawn_in_group = 3
donkey.spawn_in_group_min = 1 donkey.spawn_in_group_min = 1
donkey.animation = {
speed_normal = 25,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
}
donkey.sounds = { donkey.sounds = {
random = "mobs_mc_donkey_random", random = "mobs_mc_donkey_random",
damage = "mobs_mc_donkey_hurt", damage = "mobs_mc_donkey_hurt",

View File

@ -106,6 +106,31 @@ local item_lists = {
"craftpreview", "craftpreview",
} }
local function init_data(name)
player_data[name] = {
filter = "",
pagenum = 1,
iX = sfinv_only and 8 or DEFAULT_SIZE,
items = init_items,
items_raw = init_items,
lang_code = M.get_player_information(name).lang_code or 'en',
}
end
local function get_player_data(name)
-- If the data alrady exists, use it
local data = player_data[name]
if data then return data end
-- Initialize player data if it doesn't exist
init_data(name)
local player = minetest.get_player_by_name(name)
local meta = player:get_meta()
local data = player_data[name]
data.inv_items = deserialize(meta:get_string("inv_items")) or {}
return data
end
local function table_merge(t, t2) local function table_merge(t, t2)
t, t2 = t or {}, t2 or {} t, t2 = t or {}, t2 or {}
local c = #t local c = #t
@ -624,7 +649,7 @@ local function get_recipe_fs(data, iY)
end end
local function make_formspec(name) local function make_formspec(name)
local data = player_data[name] local data = get_player_data(name)
local iY = sfinv_only and 4 or data.iX - 5 local iY = sfinv_only and 4 or data.iX - 5
local ipp = data.iX * iY local ipp = data.iX * iY
@ -831,17 +856,6 @@ local function get_inv_items(player)
return inv_items return inv_items
end end
local function init_data(name)
player_data[name] = {
filter = "",
pagenum = 1,
iX = sfinv_only and 8 or DEFAULT_SIZE,
items = init_items,
items_raw = init_items,
lang_code = M.get_player_information(name).lang_code or 'en',
}
end
local function reset_data(data) local function reset_data(data)
data.filter = "" data.filter = ""
data.pagenum = 1 data.pagenum = 1
@ -877,7 +891,7 @@ end
local function on_receive_fields(player, fields) local function on_receive_fields(player, fields)
local name = player:get_player_name() local name = player:get_player_name()
local data = player_data[name] local data = get_player_data(name)
for elem_name, def in pairs(formspec_elements) do for elem_name, def in pairs(formspec_elements) do
if fields[elem_name] and def.action then if fields[elem_name] and def.action then
@ -981,7 +995,7 @@ if sfinv_only then
on_enter = function(self, player, context) on_enter = function(self, player, context)
if next(recipe_filters) then if next(recipe_filters) then
local name = player:get_player_name() local name = player:get_player_name()
local data = player_data[name] local data = get_player_data(name)
data.items_raw = get_filtered_items(player) data.items_raw = get_filtered_items(player)
search(data) search(data)
@ -1005,7 +1019,7 @@ else
local name = user:get_player_name() local name = user:get_player_name()
if next(recipe_filters) then if next(recipe_filters) then
local data = player_data[name] local data = get_player_data(name)
data.items_raw = get_filtered_items(user) data.items_raw = get_filtered_items(user)
search(data) search(data)
end end
@ -1051,7 +1065,7 @@ if progressive_mode then
local function progressive_filter(recipes, player) local function progressive_filter(recipes, player)
local name = player:get_player_name() local name = player:get_player_name()
local data = player_data[name] local data = get_player_data(name)
if #data.inv_items == 0 then if #data.inv_items == 0 then
return {} return {}
@ -1076,7 +1090,7 @@ if progressive_mode then
for i = 1, #players do for i = 1, #players do
local player = players[i] local player = players[i]
local name = player:get_player_name() local name = player:get_player_name()
local data = player_data[name] local data = get_player_data(name)
local inv_items = get_inv_items(player) local inv_items = get_inv_items(player)
local diff = table_diff(inv_items, data.inv_items) local diff = table_diff(inv_items, data.inv_items)
@ -1095,12 +1109,7 @@ if progressive_mode then
mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter) mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter)
M.register_on_joinplayer(function(player) M.register_on_joinplayer(function(player)
local name = player:get_player_name() get_player_data(player:get_player_name())
init_data(name)
local meta = player:get_meta()
local data = player_data[name]
data.inv_items = deserialize(meta:get_string("inv_items")) or {}
end) end)
local function save_meta(player) local function save_meta(player)
@ -1145,7 +1154,7 @@ end
function mcl_craftguide.show(name) function mcl_craftguide.show(name)
local player = get_player_by_name(name) local player = get_player_by_name(name)
if next(recipe_filters) then if next(recipe_filters) then
local data = player_data[name] local data = get_player_data(name)
data.items_raw = get_filtered_items(player) data.items_raw = get_filtered_items(player)
search(data) search(data)
end end

View File

@ -36,9 +36,14 @@ function mcl_inventory.register_survival_inventory_tab(def)
end end
local player_current_tab = {} local player_current_tab = {}
function get_player_tab(player)
local tab = player_current_tab[player] or "main"
player_current_tab[player] = tab
return tab
end
minetest.register_on_joinplayer(function(player, last_login) minetest.register_on_joinplayer(function(player, last_login)
player_current_tab[player] = "main" get_player_tab(player)
end) end)
minetest.register_on_leaveplayer(function(player, timed_out) minetest.register_on_leaveplayer(function(player, timed_out)
@ -184,7 +189,7 @@ function mcl_inventory.build_survival_formspec(player)
inv:set_width("craft", 2) inv:set_width("craft", 2)
inv:set_size("craft", 4) inv:set_size("craft", 4)
local tab = player_current_tab[player] local tab = get_player_tab(player)
local tab_def = nil local tab_def = nil
@ -213,7 +218,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
for _, d in ipairs(mcl_inventory.registered_survival_inventory_tabs) do for _, d in ipairs(mcl_inventory.registered_survival_inventory_tabs) do
if player_current_tab[player] == d.id and d.access(player) then if get_player_tab(player) == d.id and d.access(player) then
d.handle(player, fields) d.handle(player, fields)
return return
end end

View File

@ -16,19 +16,31 @@ local function offhand_get_count(player)
return mcl_offhand.get_offhand(player):get_count() return mcl_offhand.get_offhand(player):get_count()
end end
minetest.register_on_joinplayer(function(player, last_login) local function get_offhand(player)
mcl_offhand[player] = { -- Get offhand data if it already exists
local offhand = mcl_offhand[player]
if offhand then return offhand end
-- Otherwise initialize it
offhand = {
hud = {}, hud = {},
last_wear = offhand_get_wear(player), last_wear = offhand_get_wear(player),
last_count = offhand_get_count(player), last_count = offhand_get_count(player),
} }
mcl_offhand[player] = offhand
return offhand
end
minetest.register_on_joinplayer(function(player, last_login)
get_offhand(player)
end) end)
local function remove_hud(player, hud) local function remove_hud(player, hud)
local offhand_hud = mcl_offhand[player].hud[hud] local offhand = get_offhand(player)
local offhand_hud = offhand.hud[hud]
if offhand_hud then if offhand_hud then
player:hud_remove(offhand_hud) player:hud_remove(offhand_hud)
mcl_offhand[player].hud[hud] = nil offhand.hud[hud] = nil
end end
end end
@ -48,7 +60,8 @@ local function update_wear_bar(player, itemstack)
else else
color = {255, 511 - wear_i, 0} color = {255, 511 - wear_i, 0}
end end
local wear_bar = mcl_offhand[player].hud.wear_bar local offhand = get_offhand(player)
local wear_bar = offhand.hud.wear_bar
player:hud_change(wear_bar, "text", "mcl_wear_bar.png^[colorize:#" .. rgb_to_hex(color[1], color[2], color[3])) player:hud_change(wear_bar, "text", "mcl_wear_bar.png^[colorize:#" .. rgb_to_hex(color[1], color[2], color[3]))
player:hud_change(wear_bar, "scale", {x = 40 * wear_bar_percent, y = 3}) player:hud_change(wear_bar, "scale", {x = 40 * wear_bar_percent, y = 3})
player:hud_change(wear_bar, "offset", {x = -320 - (20 - player:hud_get(wear_bar).scale.x / 2), y = -13}) player:hud_change(wear_bar, "offset", {x = -320 - (20 - player:hud_get(wear_bar).scale.x / 2), y = -13})
@ -58,7 +71,8 @@ minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
local itemstack = mcl_offhand.get_offhand(player) local itemstack = mcl_offhand.get_offhand(player)
local offhand_item = itemstack:get_name() local offhand_item = itemstack:get_name()
local offhand_hud = mcl_offhand[player].hud local offhand = get_offhand(player)
local offhand_hud = offhand.hud
local item = minetest.registered_items[offhand_item] local item = minetest.registered_items[offhand_item]
if offhand_item ~= "" and item then if offhand_item ~= "" and item then
local item_texture = item.inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px local item_texture = item.inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px
@ -145,7 +159,8 @@ minetest.register_globalstep(function(dtime)
end end
elseif offhand_hud.slot then elseif offhand_hud.slot then
for index, _ in pairs(mcl_offhand[player].hud) do local offhand = get_offhand(player)
for index, _ in pairs(offhand.hud) do
remove_hud(player, index) remove_hud(player, index)
end end
end end

View File

@ -8,7 +8,7 @@ local is_sp = minetest.is_singleplayer()
local weather_mod = minetest.get_modpath("mcl_weather") local weather_mod = minetest.get_modpath("mcl_weather")
local explosions_mod = minetest.get_modpath("mcl_explosions") local explosions_mod = minetest.get_modpath("mcl_explosions")
local spawn_mod = minetest.get_modpath("mcl_spawn") local spawn_mod = minetest.get_modpath("mcl_spawn")
local worlds_mod = minetest.get_modpath("mcl_worlds") local pos_to_dim = minetest.get_modpath("mcl_worlds") and mcl_worlds.pos_to_dimension or function(pos) return "overworld" end
local function mcl_log (message) local function mcl_log (message)
mcl_util.mcl_log (message, "[Beds]") mcl_util.mcl_log (message, "[Beds]")
@ -38,6 +38,16 @@ local function is_night_skip_enabled()
return players_in_bed_setting() <= 100 return players_in_bed_setting() <= 100
end end
local function players_in_overworld(players)
local count = 0
for _, player in pairs(players) do
if player and pos_to_dim(player:get_pos()) == "overworld" then
count = count +1
end
end
return count
end
local function check_in_beds(players) local function check_in_beds(players)
if not players then if not players then
players = minetest.get_connected_players() players = minetest.get_connected_players()
@ -45,7 +55,7 @@ local function check_in_beds(players)
if player_in_bed <= 0 then if player_in_bed <= 0 then
return false return false
end end
return players_in_bed_setting() <= (player_in_bed * 100) / #players return players_in_bed_setting() <= (player_in_bed * 100) / players_in_overworld(players)
end end
-- These monsters do not prevent sleep -- These monsters do not prevent sleep
@ -206,10 +216,10 @@ local function lay_down(player, pos, bed_pos, state, skip)
return true return true
end end
local function update_formspecs(finished, ges) local function update_formspecs(finished, players)
local ges = ges or #minetest.get_connected_players() local ges = players_in_overworld(players or minetest.get_connected_players())
local form_n = "size[12,5;true]" local form_n = "size[12,5;true]"
local all_in_bed = players_in_bed_setting() <= (player_in_bed * 100) / ges local all_in_bed = ges and players_in_bed_setting() <= (player_in_bed * 100) / ges or 0
local night_skip = is_night_skip_enabled() local night_skip = is_night_skip_enabled()
local button_leave = "button_exit[4,3;4,0.75;leave;"..F(S("Leave bed")).."]" local button_leave = "button_exit[4,3;4,0.75;leave;"..F(S("Leave bed")).."]"
local button_abort = "button_exit[4,3;4,0.75;leave;"..F(S("Abort sleep")).."]" local button_abort = "button_exit[4,3;4,0.75;leave;"..F(S("Abort sleep")).."]"
@ -349,13 +359,25 @@ function mcl_beds.get_bed_bottom (pos)
return bed_bottom return bed_bottom
end end
local function recheck_in_beds()
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end
-- check again (a player can change the dimension)
if player_in_bed > 0 then
update_formspecs(false)
minetest.after(5, recheck_in_beds)
end
end
function mcl_beds.on_rightclick(pos, player, is_top) function mcl_beds.on_rightclick(pos, player, is_top)
-- Anti-Inception: Don't allow to sleep while you're sleeping -- Anti-Inception: Don't allow to sleep while you're sleeping
if player:get_meta():get_string("mcl_beds:sleeping") == "true" then if player:get_meta():get_string("mcl_beds:sleeping") == "true" then
return return
end end
if worlds_mod then local dim = pos_to_dim(pos)
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" or dim == "end" then if dim == "nether" or dim == "end" then
-- Bed goes BOOM in the Nether or End. -- Bed goes BOOM in the Nether or End.
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
@ -368,7 +390,6 @@ function mcl_beds.on_rightclick(pos, player, is_top)
end end
return return
end end
end
local name = player:get_player_name() local name = player:get_player_name()
local ppos = player:get_pos() local ppos = player:get_pos()
@ -385,10 +406,13 @@ function mcl_beds.on_rightclick(pos, player, is_top)
mcl_title.set(player, "actionbar", {text=message, color="white", stay=60}) mcl_title.set(player, "actionbar", {text=message, color="white", stay=60})
else -- someone just successfully entered a bed else -- someone just successfully entered a bed
local connected_players = minetest.get_connected_players() local connected_players = minetest.get_connected_players()
local sleep_hud_message = S("@1/@2 players currently in bed.", player_in_bed, math.ceil(players_in_bed_setting() * #connected_players / 100)) local ges = players_in_overworld(connected_players)
local sleep_hud_message = S("@1/@2 players currently in bed.", player_in_bed, math.ceil(players_in_bed_setting() * ges / 100))
for _, player in pairs(connected_players) do for _, player in pairs(connected_players) do
if not mcl_beds.player[player:get_player_name()] then -- only send message to players not sleeping. -- only send message to players not sleeping and in the "overworld"
if mcl_title.params_get(player) then mcl_title.clear(player) end -- clear, old message is still being displayed if not mcl_beds.player[player:get_player_name()] and pos_to_dim(player:get_pos()) == "overworld" then
-- clear, old message is still being displayed
if mcl_title.params_get(player) then mcl_title.clear(player) end
mcl_title.set(player, "actionbar", {text=sleep_hud_message, color="white", stay=60}) mcl_title.set(player, "actionbar", {text=sleep_hud_message, color="white", stay=60})
end end
end end
@ -400,13 +424,8 @@ function mcl_beds.on_rightclick(pos, player, is_top)
update_formspecs(false) update_formspecs(false)
-- skip the night and let all players stand up -- skip the night and let all players stand up
if check_in_beds() then if player_in_bed > 0 then
minetest.after(5, function() minetest.after(5, recheck_in_beds)
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end
end)
end end
end end
@ -433,15 +452,10 @@ minetest.register_on_leaveplayer(function(player)
break break
end end
end end
if check_in_beds(players) then if player_in_bed > 0 then
minetest.after(5, function() minetest.after(5, recheck_in_beds)
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end end
end) update_formspecs(false, players)
end
update_formspecs(false, #players)
end) end)
local message_rate_limit = tonumber(minetest.settings:get("chat_message_limit_per_10sec")) or 8 --NEVER change this! if this was java, i would've declared it as final local message_rate_limit = tonumber(minetest.settings:get("chat_message_limit_per_10sec")) or 8 --NEVER change this! if this was java, i would've declared it as final

View File

@ -8,36 +8,60 @@ local S = minetest.get_translator(minetest.get_current_modname())
-- Function to allow harvesting honey and honeycomb from the beehive and bee nest. -- Function to allow harvesting honey and honeycomb from the beehive and bee nest.
local honey_harvest = function(pos, node, player, itemstack, pointed_thing) local honey_harvest = function(pos, node, player, itemstack, pointed_thing)
local inv = player:get_inventory() local inv = player:get_inventory()
local shears = minetest.get_item_group(player:get_wielded_item():get_name(), "shears") > 0 local item = player:get_wielded_item()
local bottle = player:get_wielded_item():get_name() == "mcl_potions:glass_bottle"
local beehive = "mcl_beehives:beehive"
local is_creative = minetest.is_creative_enabled(player:get_player_name()) local is_creative = minetest.is_creative_enabled(player:get_player_name())
-- Determine the node name to replace the beehive with if harvest is successful
local beehive = "mcl_beehives:beehive"
if node.name == "mcl_beehives:beehive_5" then if node.name == "mcl_beehives:beehive_5" then
beehive = "mcl_beehives:beehive" beehive = "mcl_beehives:beehive"
elseif node.name == "mcl_beehives:bee_nest_5" then elseif node.name == "mcl_beehives:bee_nest_5" then
beehive = "mcl_beehives:bee_nest" beehive = "mcl_beehives:bee_nest"
end end
-- Check for a campfire within 5 blocks below the beehive
local campfire_area = vector.offset(pos, 0, -5, 0) local campfire_area = vector.offset(pos, 0, -5, 0)
local campfire = minetest.find_nodes_in_area(pos, campfire_area, "group:lit_campfire") local campfire = minetest.find_nodes_in_area(pos, campfire_area, "group:lit_campfire")
if bottle then -- Player used a bottle
if item:get_name() == "mcl_potions:glass_bottle" then
local honey = "mcl_honey:honey_bottle" local honey = "mcl_honey:honey_bottle"
if inv:room_for_item("main", honey) then if inv:room_for_item("main", honey) then
-- Replace the beehive with the version without honey or comb
node.name = beehive node.name = beehive
minetest.set_node(pos, node) minetest.set_node(pos, node)
-- Give honey bottle and take the empty bottle if survival mode
inv:add_item("main", "mcl_honey:honey_bottle") inv:add_item("main", "mcl_honey:honey_bottle")
if not is_creative then if not is_creative then
itemstack:take_item() itemstack:take_item()
end end
if not campfire[1] then mcl_util.deal_damage(player, 10) else awards.unlock(player:get_player_name(), "mcl:bee_our_guest") end
-- Hurt the player if there was no campfire, or give award if there was
if not campfire[1] then
mcl_util.deal_damage(player, 10)
else
awards.unlock(player:get_player_name(), "mcl:bee_our_guest")
end end
elseif shears then end
-- Player used shears
elseif minetest.get_item_group(item:get_name(), "shears") > 0 then
-- Give honeycomb
minetest.add_item(pos, "mcl_honey:honeycomb 3") minetest.add_item(pos, "mcl_honey:honeycomb 3")
-- Replace the beehive with the version without honey or comb
node.name = beehive node.name = beehive
minetest.set_node(pos, node) minetest.set_node(pos, node)
-- Hurt the player if there was no campfire
if not campfire[1] then mcl_util.deal_damage(player, 10) end if not campfire[1] then mcl_util.deal_damage(player, 10) end
-- Add wear to the shears
if not is_creative then
mcl_util.use_item_durability(item, 1)
return item
end
end end
end end

View File

@ -638,7 +638,7 @@ function mcl_itemframes.create_base_definitions()
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 1, }, -- attached_node_facedir = 1 }, -- allows for more placement options. groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 1, attached_node_facedir = 1 },
sounds = mcl_sounds.node_sound_defaults(), sounds = mcl_sounds.node_sound_defaults(),
node_placement_prediction = "", node_placement_prediction = "",

View File

@ -251,6 +251,15 @@ local function remove_shield_entity(player, i)
end end
end end
local function is_node_stack(itemstack)
return itemstack:get_definition().drawtype -- only node's definition table contains element "drawtype"
end
local function is_rmb_conflicting_node(nodename)
local nodedef = minetest.registered_nodes[nodename]
return nodedef.on_rightclick
end
local function handle_blocking(player) local function handle_blocking(player)
local player_shield = mcl_shields.players[player] local player_shield = mcl_shields.players[player]
local rmb = player:get_player_control().RMB local rmb = player:get_player_control().RMB
@ -266,7 +275,7 @@ local function handle_blocking(player)
local pos = player:get_pos() local pos = player:get_pos()
if shield_in_hand then if shield_in_hand then
if not_blocking then if not_blocking then
minetest.after(0.25, function() minetest.after(0.05, function()
if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb then if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb then
player_shield.blocking = 2 player_shield.blocking = 2
set_shield(player, true, 2) set_shield(player, true, 2)
@ -277,11 +286,16 @@ local function handle_blocking(player)
end end
elseif shield_in_offhand then elseif shield_in_offhand then
local pointed_thing = mcl_util.get_pointed_thing(player, true) local pointed_thing = mcl_util.get_pointed_thing(player, true)
local offhand_can_block = (wielded_item(player) == "" or not pointed_thing) local wielded_stack = player:get_wielded_item()
and (minetest.get_item_group(wielded_item(player), "bow") ~= 1 and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1) local offhand_can_block = (minetest.get_item_group(wielded_item(player), "bow") ~= 1
and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1)
if pointed_thing and pointed_thing.type == "node" then if pointed_thing and pointed_thing.type == "node" then
if minetest.get_item_group(minetest.get_node(pointed_thing.under).name, "container") > 1 then local pointed_node = minetest.get_node(pointed_thing.under)
if minetest.get_item_group(pointed_node.name, "container") > 1
or is_rmb_conflicting_node(pointed_node.name)
or is_node_stack(wielded_stack)
then
return return
end end
end end
@ -290,7 +304,7 @@ local function handle_blocking(player)
return return
end end
if not_blocking then if not_blocking then
minetest.after(0.25, function() minetest.after(0.05, function()
if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block then if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block then
player_shield.blocking = 1 player_shield.blocking = 1
set_shield(player, true, 1) set_shield(player, true, 1)

View File

@ -1,18 +0,0 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
--Weathered Stone
minetest.register_node("mcl_weathered_nodes:weathered_stone", {
description = "Weathered stone",
_doc_items_longdesc = ("Weathered stone is a decorative block that eventually turns into mossy cobblestone"),
_doc_items_hidden = false,
tiles = {"mcl_weathered_nodes_weathered_stone.png"},
is_ground_content = true,
stack_max = 64,
groups = {pickaxey=1, stone=1, building_block=1, oxidizable = 1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 1.5,
_mcl_oxidized_variant = "mcl_core:mossycobble",
_mcl_waxed_variant = "mcl_core:stone",
})

View File

@ -1,5 +0,0 @@
name = mcl_weathered_nodes
depends = mcl_core, mcl_copper
description = Adds Weathered nodes
author = SmokeyDope
title = Weathered nodes

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

View File

@ -0,0 +1,28 @@
# ```vl_hollow_logs```
This mod registers hollow logs derived from normal logs.
Hollow logs mostly have a decorative function, but some of them can be used in recipes. Changes may appear soon.
## Functions:
### ```vl_hollow_logs.register_hollow_log(defs)```
This is the function that registers the hollow trunk.
For a hollow log to be registered, the <span style="color:firebrick"> defs </span> parameter must be a table that contains up to 5 values, which are, in this order, the <span style="color:firebrick"> itemstring </span> of the hollow log, the <span style="color:firebrick"> itemstring </span> of the stripped hollow log, the <span style="color:firebrick"> description </span> of the hollow log, the <span style="color:firebrick"> description </span> of the stripped hollow log and, optionally, a <span style="color:turquoise"> boolean </span> to inform whether this trunk is NOT flammable. If the hollow log is defined as flammable, it becomes part of the <span style="color:springgreen"> hollow_log_flammable </span> group, which allows the log to be used as fuel for furnaces and also allows it to be an ingredient for chacoal.
Examples:
```lua
-- Flammable
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"}
-- Not flammable
{"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true}
```
### ```vl_hollow_logs.register_craft(material, result)```
This function records the crafting recipe for a hollow log based on its non-hollow variant.
This function also defines a recipe for the stonecutter. The <span style="color:firebrick"> material </span> and <span style="color:firebrick"> result </span> parameters must be, respectively, the <span style="color:firebrick"> complete itemstring </span> of the source material and the (partial) <span style="color:firebrick"> itemstring </span> of the result. See the following examples:
```lua
vl_hollow_logs.register_craft("mcl_core:tree", "tree")
vl_hollow_logs.register_craft("mcl_crimson:stripped_crimson_hyphae", "stripped_crimson_hyphae")
```

View File

@ -0,0 +1,112 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator(minetest.get_current_modname())
vl_hollow_logs = {}
--- Function to register a hollow log. See API.md to learn how to use this function.
---@param defs table {name:string, stripped_name>string, desc:string, stripped_desc:string, not_flammable:boolean|nil}
function vl_hollow_logs.register_hollow_log(defs)
if not defs or #defs < 4 then
error("Incomplete definition provided")
end
for i = 1, 4 do
if type(defs[i]) ~= "string" then
error("defs["..i.."] must be a string")
end
end
if defs[5] and type(defs[5]) ~= "boolean" then
error("defs[5] must be a boolean if present")
end
local modname = minetest.get_current_modname()
if #defs > 5 then
minetest.log("warning", "[vl_hollow_logs] unused vars passed, dumping the table")
minetest.log("warning", "from mod " .. modname .. ": " .. dump(defs))
end
local name = defs[1]
local stripped_name = defs[2]
local desc = defs[3]
local stripped_desc = defs[4]
local collisionbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.375},
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5},
{0.375, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5},
}
}
local groups = {axey = 1, building_block = 1, handy = 1, hollow_log = 1}
if not defs[5] then
groups = table.insert(groups, {fire_encouragement = 5, fire_flammability = 5, flammable = 2, hollow_log_burnable = 1})
end
minetest.register_node(modname .. ":"..name.."_hollow", {
collision_box = collisionbox,
description = S(desc),
drawtype = "mesh",
groups = groups,
mesh = "vl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {modname .. "_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = modname .. ":stripped_"..name.."_hollow"
})
minetest.register_node(modname .. ":"..stripped_name.."_hollow", {
collision_box = collisionbox,
description = S(stripped_desc),
drawtype = "mesh",
groups = groups,
mesh = "vl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {modname .. "_stripped_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
vl_hollow_logs.logs = {
{"acaciatree", "stripped_acacia", "Hollow Acacia Log", "Stripped Hollow Acacia Log"},
{"birchtree", "stripped_birch", "Hollow Birch Log", "Stripped Hollow Birch Log"},
{"darktree", "stripped_dark_oak", "Hollow Dark Oak Log", "Stripped Hollow Dark Oak Log"},
{"jungletree", "stripped_jungle", "Hollow Jungle Log", "Stripped Hollow Jungle Log"},
{"sprucetree", "stripped_spruce", "Hollow Spruce Log", "Stripped Hollow Spruce Log"},
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"}
}
if minetest.get_modpath("mcl_cherry_blossom") then
table.insert(vl_hollow_logs.logs, {"cherrytree", "stripped_cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"})
end
if minetest.get_modpath("mcl_mangrove") then
table.insert(vl_hollow_logs.logs, {"mangrove_tree", "mangrove_stripped", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"})
end
if minetest.get_modpath("mcl_crimson") then
table.insert(vl_hollow_logs.logs, {"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true})
table.insert(vl_hollow_logs.logs, {"warped_hyphae", "stripped_warped_hyphae", "Hollow Warped Stem", "Stripped Hollow Warped Stem", true})
end
for _, defs in pairs(vl_hollow_logs.logs) do
vl_hollow_logs.register_hollow_log(defs)
end
dofile(modpath.."/recipes.lua")

View File

@ -0,0 +1,21 @@
# textdomain: mcl_hollow_logs
Hollow Acacia Log=
Hollow Birch Log=
Hollow Cherry Log=
Hollow Dark Oak Log=
Hollow Jungle Log=
Hollow Mangrove Log=
Hollow Oak Log=
Hollow Spruce Log=
Hollow Crimson Stem=
Hollow Warped Stem=
Stripped Hollow Acacia Log=
Stripped Hollow Birch Log=
Stripped Hollow Cherry Log=
Stripped Hollow Dark Oak Log=
Stripped Hollow Jungle Log=
Stripped Hollow Mangrove Log=
Stripped Hollow Oak Log=
Stripped Hollow Spruce Log=
Stripped Hollow Crimson Stem=
Stripped Hollow Warped Stem=

View File

@ -0,0 +1,21 @@
# textdomain: mcl_hollow_logs
Hollow Acacia Log=Tronco Oco de Acácia
Hollow Birch Log=Tronco Oco de Bétula
Hollow Cherry Log=Tronco Oco de Cerejeira
Hollow Dark Oak Log=Tronco Oco de Carvalho Escuro
Hollow Jungle Log=Tronco Oco da Selva
Hollow Mangrove Log=Tronco Oco de Mangue
Hollow Oak Log=Tronco Oco de Carvalho
Hollow Spruce Log=Tronco Oco de Pinheiro
Hollow Crimson Stem=Caule Oco Carmesim
Hollow Warped Stem=Caule Oco Distorcido
Stripped Hollow Acacia Log=Tronco Oco Descascado de Acácia
Stripped Hollow Birch Log=Tronco Oco Descascado de Bétula
Stripped Hollow Cherry Log=Tronco Oco Descascado de Cerejeira
Stripped Hollow Dark Oak Log=Tronco Oco Descascado de Carvalho Escuro
Stripped Hollow Jungle Log=Tronco Oco Descascado da Selva
Stripped Hollow Mangrove Log=Tronco Oco Descascado de Mangue
Stripped Hollow Oak Log=Tronco Oco Descascado de Carvalho
Stripped Hollow Spruce Log=Tronco Oco Descascado de Pinheiro
Stripped Hollow Crimson Stem=Caule Oco Descascado Carmesim
Stripped Hollow Warped Stem=Caule Oco Descascado Distorcido

View File

@ -0,0 +1,4 @@
name = vl_hollow_logs
depends = mcl_core, mcl_sounds, mcl_util
optional_depends = mcl_cherry_blossom, mcl_crimson, mcl_mangrove
author = JoseDouglas26

View File

@ -0,0 +1,54 @@
# Blender 3.6.7
# www.blender.org
o hollow_log
v -0.312500 -0.500000 0.312500
v -0.312500 0.500000 0.312500
v -0.312500 -0.500000 -0.312500
v -0.312500 0.500000 -0.312500
v 0.312500 -0.500000 0.312500
v 0.312500 0.500000 0.312500
v 0.312500 -0.500000 -0.312500
v 0.312500 0.500000 -0.312500
v -0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.380952 0.000000
vt 0.380952 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.619048 0.000000
vt 0.619048 1.000000
vt 0.928571 0.187500
vt 0.928571 0.812500
vt 1.000000 1.000000
vt 1.000000 -0.000000
vt 0.690476 0.187500
vt 0.690476 0.812500
s 0
f 10/1/1 11/2/1 12/3/1 9/4/1
f 9/1/2 12/2/2 14/3/2 13/4/2
f 13/1/3 14/2/3 16/3/3 15/4/3
f 15/1/4 16/2/4 11/3/4 10/4/4
f 7/5/4 8/6/4 4/2/4 3/1/4
f 5/5/1 6/6/1 8/2/1 7/1/1
f 3/7/5 1/8/5 10/9/5 9/10/5
f 2/8/6 4/7/6 12/10/6 11/9/6
f 7/11/5 3/7/5 9/10/5 13/5/5
f 4/7/6 8/11/6 14/5/6 12/10/6
f 5/12/5 7/11/5 13/5/5 15/6/5
f 8/11/6 6/12/6 16/6/6 14/5/6
f 1/8/5 5/12/5 15/6/5 10/9/5
f 6/12/6 2/8/6 11/9/6 16/6/6
f 3/5/3 4/6/3 2/2/3 1/1/3
f 1/5/2 2/6/2 6/2/2 5/1/2

View File

@ -0,0 +1,48 @@
function vl_hollow_logs.register_craft(material, result)
minetest.register_craft({
output = "vl_hollow_logs:"..result.."_hollow 4",
recipe = {
{"", material, ""},
{material, "", material},
{"", material, ""}
},
type = "shaped"
})
mcl_stonecutter.register_recipe(material, "vl_hollow_logs:"..result.."_hollow", 1)
end
for _, defs in pairs(vl_hollow_logs.logs) do
local mod, material, stripped_material
local name = defs[1]
local stripped_name = defs[2]
if name:find("cherry") then
mod = "mcl_cherry_blossom:"
elseif name:find("mangrove") then
mod = "mcl_mangrove:"
elseif name:find("hyphae") then
mod = "mcl_crimson:"
else
mod = "mcl_core:"
end
material = mod..name
stripped_material = mod..stripped_name
vl_hollow_logs.register_craft(material, name)
vl_hollow_logs.register_craft(stripped_material, stripped_name)
end
minetest.register_craft({
burntime = 10,
recipe = "group:hollow_log_burnable",
type = "fuel",
})
minetest.register_craft({
cooktime = 5,
output = "mcl_core:charcoal_lump",
recipe = "group:hollow_log_burnable",
type = "cooking"
})

View File

@ -406,6 +406,8 @@ local function dungeons_nodes(minp, maxp, blockseed)
local pr = PseudoRandom(blockseed) local pr = PseudoRandom(blockseed)
for a=1, attempts do for a=1, attempts do
local dim = dungeonsizes[pr:next(1, #dungeonsizes)] local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
if ymin <= ymax - dim.y - 1 then
local x = pr:next(minp.x, maxp.x-dim.x-1) local x = pr:next(minp.x, maxp.x-dim.x-1)
local y = pr:next(ymin , ymax -dim.y-1) local y = pr:next(ymin , ymax -dim.y-1)
local z = pr:next(minp.z, maxp.z-dim.z-1) local z = pr:next(minp.z, maxp.z-dim.z-1)
@ -415,6 +417,7 @@ local function dungeons_nodes(minp, maxp, blockseed)
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr}) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
end end
end end
end
function mcl_dungeons.spawn_dungeon(p1, _, pr) function mcl_dungeons.spawn_dungeon(p1, _, pr)
if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end

View File

@ -38,9 +38,19 @@ local player_sneak = {}
local player_visible = {} local player_visible = {}
mcl_player.player_attached = {} mcl_player.player_attached = {}
local function get_player_textures(name)
local textures = player_textures[name]
if textures then return textures end
local textures = { "character.png", "blank.png", "blank.png" }
player_textures[name] = textures
return textures
end
function mcl_player.player_get_animation(player) function mcl_player.player_get_animation(player)
local name = player:get_player_name() local name = player:get_player_name()
local textures = player_textures[name] local textures = get_player_textures(name)
if not player_visible[name] then if not player_visible[name] then
textures = table.copy(textures) textures = table.copy(textures)
@ -63,7 +73,7 @@ end
local function update_player_textures(player) local function update_player_textures(player)
local name = player:get_player_name() local name = player:get_player_name()
local textures = player_textures[name] local textures = get_player_textures(name)
if not player_visible[name] then if not player_visible[name] then
textures = table.copy(textures) textures = table.copy(textures)
@ -125,18 +135,21 @@ end
function mcl_player.player_set_skin(player, texture) function mcl_player.player_set_skin(player, texture)
local name = player:get_player_name() local name = player:get_player_name()
player_textures[name][1] = texture local textures = get_player_textures(name)
textures[1] = texture
update_player_textures(player) update_player_textures(player)
end end
function mcl_player.player_get_skin(player) function mcl_player.player_get_skin(player)
local name = player:get_player_name() local name = player:get_player_name()
return player_textures[name][1] local textures = get_player_textures(name)
return textures[1]
end end
function mcl_player.player_set_armor(player, texture) function mcl_player.player_set_armor(player, texture)
local name = player:get_player_name() local name = player:get_player_name()
player_textures[name][2] = texture local textures = get_player_textures(name)
textures[2] = texture
update_player_textures(player) update_player_textures(player)
end end
@ -151,7 +164,7 @@ function mcl_player.get_player_formspec_model(player, x, y, w, h, fsname)
local name = player:get_player_name() local name = player:get_player_name()
local model = player_model[name] local model = player_model[name]
local anim = models[model].animations[player_anim[name]] local anim = models[model].animations[player_anim[name]]
local textures = player_textures[name] local textures = get_player_textures(name)
if not player_visible[name] then if not player_visible[name] then
textures = table.copy(textures) textures = table.copy(textures)
textures[1] = "blank.png" textures[1] = "blank.png"
@ -179,7 +192,7 @@ minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
mcl_player.player_attached[name] = false mcl_player.player_attached[name] = false
player_visible[name] = true player_visible[name] = true
player_textures[name] = { "character.png", "blank.png", "blank.png" } get_player_textures(name)
--player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) --player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>> -- player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>>

View File

@ -59,6 +59,50 @@ mcl_skins = {
player_formspecs = {}, player_formspecs = {},
} }
local player_skins = mcl_skins.player_skins
local function get_player_skins(player)
local player_skins = player_skins[player]
if player_skins then return player_skins end
local skin = player:get_meta():get_string("mcl_skins:skin")
if skin then
skin = minetest.deserialize(skin)
end
if skin then
if not mcl_skins.texture_to_simple_skin[skin.simple_skins_id] then
skin.simple_skins_id = nil
end
mcl_skins.player_skins[player] = skin
else
if math.random() > 0.5 then
skin = table.copy(mcl_skins.template1)
else
skin = table.copy(mcl_skins.template2)
end
mcl_skins.player_skins[player] = skin
end
mcl_skins.player_formspecs[player] = {
active_tab = "skin",
page_num = 1
}
if #mcl_skins.simple_skins > 0 then
local skin_id = tonumber(player:get_meta():get_string("mcl_skins:skin_id"))
if skin_id and mcl_skins.simple_skins[skin_id] then
local texture = mcl_skins.simple_skins[skin_id].texture
local player_skins = get_player_skins(player)
player_skins.simple_skins_id = texture
end
end
mcl_skins.save(player)
mcl_skins.update_player_skin(player)
return mcl_skins.player_skins[player]
end
function mcl_skins.register_item(item) function mcl_skins.register_item(item)
assert(mcl_skins[item.type], "Skin item type " .. item.type .. " does not exist.") assert(mcl_skins[item.type], "Skin item type " .. item.type .. " does not exist.")
@ -160,7 +204,7 @@ function mcl_skins.update_player_skin(player)
return return
end end
local skin = mcl_skins.player_skins[player] local skin = get_player_skins(player)
local skinval = mcl_skins.compile_skin(skin) local skinval = mcl_skins.compile_skin(skin)
if not skin.cape then skin.cape = "blank.png" end if not skin.cape then skin.cape = "blank.png" end
@ -186,39 +230,7 @@ end
-- Load player skin on join -- Load player skin on join
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local skin = player:get_meta():get_string("mcl_skins:skin") get_player_skins(player)
if skin then
skin = minetest.deserialize(skin)
end
if skin then
if not mcl_skins.texture_to_simple_skin[skin.simple_skins_id] then
skin.simple_skins_id = nil
end
mcl_skins.player_skins[player] = skin
else
if math.random() > 0.5 then
skin = table.copy(mcl_skins.template1)
else
skin = table.copy(mcl_skins.template2)
end
mcl_skins.player_skins[player] = skin
end
mcl_skins.player_formspecs[player] = {
active_tab = "skin",
page_num = 1
}
if #mcl_skins.simple_skins > 0 then
local skin_id = tonumber(player:get_meta():get_string("mcl_skins:skin_id"))
if skin_id and mcl_skins.simple_skins[skin_id] then
local texture = mcl_skins.simple_skins[skin_id].texture
mcl_skins.player_skins[player].simple_skins_id = texture
end
end
mcl_skins.save(player)
mcl_skins.update_player_skin(player)
end) end)
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
@ -245,7 +257,7 @@ end
function mcl_skins.show_formspec(player, active_tab, page_num) function mcl_skins.show_formspec(player, active_tab, page_num)
local formspec_data = mcl_skins.player_formspecs[player] local formspec_data = mcl_skins.player_formspecs[player]
local skin = mcl_skins.player_skins[player] local skin = get_player_skins(player)
formspec_data.active_tab = active_tab formspec_data.active_tab = active_tab
local page_count = calculate_page_count(active_tab, player) local page_count = calculate_page_count(active_tab, player)
@ -555,7 +567,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
mcl_skins.show_formspec(player, active_tab, page_num) mcl_skins.show_formspec(player, active_tab, page_num)
return true return true
elseif fields.nocape then elseif fields.nocape then
mcl_skins.player_skins[player].cape = "blank.png" local player_skins = get_player_skins(player)
player_skins.cape = "blank.png"
mcl_skins.update_player_skin(player) mcl_skins.update_player_skin(player)
mcl_armor.update(player) --update elytra cape mcl_armor.update(player) --update elytra cape
mcl_skins.show_formspec(player, active_tab, page_num) mcl_skins.show_formspec(player, active_tab, page_num)
@ -564,7 +577,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
for cape_index = ((page_num - 1) * 5) + 1, math.min(#mcl_skins.cape, page_num * 5) do for cape_index = ((page_num - 1) * 5) + 1, math.min(#mcl_skins.cape, page_num * 5) do
local cape = mcl_skins.cape[cape_index] local cape = mcl_skins.cape[cape_index]
if fields[cape.name] then if fields[cape.name] then
mcl_skins.player_skins[player].cape = cape.mask -- the actual overlay image local player_skins = get_player_skins(player)
player_skins.cape = cape.mask -- the actual overlay image
mcl_skins.update_player_skin(player) mcl_skins.update_player_skin(player)
mcl_armor.update(player) --update elytra cape mcl_armor.update(player) --update elytra cape
mcl_skins.show_formspec(player, active_tab, page_num) mcl_skins.show_formspec(player, active_tab, page_num)
@ -580,7 +594,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
local skin = mcl_skins.player_skins[player] local skin = get_player_skins(player)
if not skin then return true end if not skin then return true end
if fields.next_page then if fields.next_page then

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B