Compare commits

..

9 Commits
dev ... master

Author SHA1 Message Date
69b2fb7a32 Revert "Fix registering beds in other mods namespace"
This reverts commit 9321c265b6.
Note: the commit actually touched buckets, not beds
2025-06-20 11:23:02 +02:00
407087977c Beds: Add support for pova and player_monoids (#3200) 2025-06-17 12:24:17 +02:00
844216cbb8 Fix TileDef deprecation warning 2025-06-13 12:11:19 +02:00
05d5461a41 Fix Docker CI test to run on new/old engine versions 2025-06-13 11:57:55 +02:00
9321c265b6 Fix registering beds in other mods namespace 2025-06-13 11:26:05 +02:00
0351c66915 Use new VoxelManip cleanup API 2025-05-31 10:00:04 +02:00
a6bf9dd526 Workaround for sign regression with 5.12.0
---------

Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2025-05-28 18:53:44 +02:00
838ad60ad0 Fix dry_grass_N on dirt producing dirt_with_grass
`dry_grass_N` has groups `grass` and `dry_grass`, so if the check for `grass` is done first, having dry_grass on it makes it turn into `dirt_with_grass` instead of `dirt_with_dry_grass`. Changing the order fixes this.
2025-04-19 19:19:12 +02:00
c6fabe4734 Creative: release memory when player leaves 2025-04-12 12:35:21 +02:00
62 changed files with 104 additions and 106 deletions

View File

@ -1,11 +1,19 @@
name: test
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
cfg:
- { image: 'ghcr.io/minetest/minetest:5.9.0' }
- { image: 'ghcr.io/minetest/minetest:5.10.0' }
- { image: 'ghcr.io/luanti-org/luanti:master' } # latest git
steps:
- uses: actions/checkout@v4
- run: ./utils/test/run.sh
env:
DOCKER_IMAGE: "${{ matrix.cfg.image }}"

View File

@ -19,7 +19,10 @@ read_globals = {
-- Silence errors about custom table methods.
table = { fields = { "copy", "indexof" } },
-- Silence warnings about accessing undefined fields of global 'math'
math = { fields = { "sign" } }
math = { fields = { "sign" } },
-- Mod support
"player_monoids",
"pova",
}
-- Overwrites minetest.handle_node_drops

View File

@ -1,5 +1,3 @@
title = Notre Ami Le Cube 1.11
author = Sys4
title = Minetest Game
description = A basic exploration, mining, crafting, and building, sandbox game with no NPCs, monsters, or animals. Minetest Game is usually used with mods added, and many mods are available for this game. Reliably maintained by Luanti core developers.
min_minetest_version = 5.8
disabled_settings = creative_mode

View File

@ -1,76 +0,0 @@
# This file contains settings of Minetest Game that can be changed in
# minetest.conf.
# By default, all the settings are commented and not functional.
# Uncomment settings by removing the preceding #.
# Whether creative mode (fast digging of all blocks, unlimited resources) should
# be enabled.
creative_mode = false
# Sets the behaviour of the inventory items when a player dies.
# bones: Store items in a bone node but drop items if inside protected area.
# drop: Drop items on the ground.
# keep: Player keeps items.
bones_mode = bones
# The time in seconds after which the bones of a dead player can be looted by
# everyone.
# 0 to disable.
share_bones_time = 1200
# How much earlier the bones of a dead player can be looted by
# everyone if the player dies in a protected area they don't own.
# 0 to disable. By default it is "share_bones_time" divide by four.
share_bones_time_early = 300
# Inform player of condition and location of new bones.
bones_position_message = true
# Whether fire should be enabled. If disabled, 'basic_flame' nodes will
# disappear.
# 'permanent_flame' nodes will remain with either setting.
enable_fire = false
# Enable flame sound.
flame_sound = true
# Whether lavacooling should be enabled.
enable_lavacooling = true
# Whether the stuff in initial_stuff should be given to new players.
give_initial_stuff = true
initial_stuff = default:axe_wood,default:torch 9,default:sapling 2,default:apple 5
# Whether the TNT mod should be enabled.
enable_tnt = true
# The radius of a TNT explosion.
tnt_radius = 3
# Enable the stairs mod ABM that replaces the old 'upside down'
# stair and slab nodes in old maps with the new param2 versions.
enable_stairs_replace_abm = false
# Whether to allow respawning in beds.
# Default value is true.
enable_bed_respawn = true
# Whether players can skip night by sleeping.
# Default value is true.
enable_bed_night_skip = true
# If enabled, fences and walls cannot be jumped over.
enable_fence_tall = true
# Whether the engine's spawn search, which does not check for a suitable
# starting biome, is used.
# Default value is false.
engine_spawn = false
# Whether river water source nodes create flowing sounds.
# Helps rivers create more sound, especially on level sections.
river_source_sounds = true
# Enable cloud variation by the 'weather' mod.
# Non-functional in V6 or Singlenode mapgens.
enable_weather = false

View File

@ -5,6 +5,16 @@ if enable_respawn == nil then
enable_respawn = true
end
-- Physics override management mods (shadow the global variable)
local player_monoids = core.get_modpath("player_monoids") and player_monoids
local pova = core.get_modpath("pova") and pova
if player_monoids and not player_monoids.speed.checkout_branch then
-- This function exists since 2025-05-17
core.log("warning", "[beds] player_monoids is too old, thus not supported.")
player_monoids = nil
end
-- support for MT game translation.
local S = beds.get_translator
@ -50,6 +60,51 @@ local function check_in_beds(players)
return #players > 0
end
local function set_physics_override(player, put_to_bed)
local IDENTIFIER = "beds:lie"
local OVERRIDES = {speed = 0, jump = 0, gravity = 0}
local name = player:get_player_name()
local pdata = beds.player[name]
if put_to_bed then -- Freeze player
if player_monoids then
for k, v in pairs(OVERRIDES) do
local monoid = player_monoids[k]
pdata["monoid_branch_" .. k] = monoid:get_active_branch(player)
-- Change the "context" of the physics overrides
local branch = monoid:checkout_branch(player, IDENTIFIER)
branch:add_change(player, v)
end
elseif pova then
pova.add_override(name, "force", OVERRIDES)
pova.do_override(player)
else
-- Directly use engine API. May conflict with other mods.
pdata.physics_override = player:get_physics_override()
player:set_physics_override(OVERRIDES)
end
else -- Unfreeze player
if player_monoids then
for k, _ in pairs(OVERRIDES) do
local monoid = player_monoids[k]
monoid:checkout_branch(player, pdata["monoid_branch_" .. k])
monoid:get_branch(IDENTIFIER):delete(player)
end
elseif pova then
pova.del_override(name, "force")
pova.do_override(player)
else
-- Restore the changed fields
player:set_physics_override({
speed = pdata.physics_override.speed,
jump = pdata.physics_override.jump,
gravity = pdata.physics_override.gravity
})
end
end
end
local function lay_down(player, pos, bed_pos, state, skip)
local name = player:get_player_name()
local hud_flags = player:hud_get_flags()
@ -72,13 +127,8 @@ local function lay_down(player, pos, bed_pos, state, skip)
player:set_pos(beds.pos[name])
-- physics, eye_offset, etc
local physics_override = beds.player[name].physics_override
set_physics_override(player, false)
beds.player[name] = nil
player:set_physics_override({
speed = physics_override.speed,
jump = physics_override.jump,
gravity = physics_override.gravity
})
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_look_horizontal(math.random(1, 180) / 100)
player_api.player_attached[name] = false
@ -112,9 +162,9 @@ local function lay_down(player, pos, bed_pos, state, skip)
return false
end
beds.player[name] = {}
beds.pos[name] = pos
beds.bed_position[name] = bed_pos
beds.player[name] = {physics_override = player:get_physics_override()}
local yaw, param2 = get_look_yaw(bed_pos)
player:set_look_horizontal(yaw)
@ -126,7 +176,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
y = bed_pos.y + 0.07,
z = bed_pos.z + dir.z / 2
}
player:set_physics_override({speed = 0, jump = 0, gravity = 0})
set_physics_override(player, true)
player:set_pos(p)
player_api.player_attached[name] = true
hud_flags.wielditem = false

View File

@ -1,3 +1,4 @@
name = beds
description = Minetest Game mod: beds
depends = default, wool, spawn
optional_depends = player_monoids, pova

View File

@ -41,15 +41,9 @@ end
function carts:is_rail(pos, railtype)
local node = minetest.get_node(pos).name
if node == "ignore" then
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(pos, pos)
local area = VoxelArea:new{
MinEdge = emin,
MaxEdge = emax,
}
local data = vm:get_data()
local vi = area:indexp(pos)
node = minetest.get_name_from_content_id(data[vi])
-- we really need to know, so load it
minetest.load_area(pos)
node = minetest.get_node(pos).name
end
if minetest.get_item_group(node, "rail") == 0 then
return false

View File

@ -124,6 +124,11 @@ function creative.update_creative_inventory(player_name, tab_content)
inv.size = #creative_list
end
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
player_inventory[name] = nil
end)
-- Create the trash field
local trash = minetest.create_detached_inventory("trash", {
-- Allow the stack to be placed and remove it in on_put()

View File

@ -645,10 +645,11 @@ minetest.register_abm({
-- Snow check is cheapest, so comes first
if name == "default:snow" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
elseif minetest.get_item_group(name, "grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
-- The group grass is also present in dry grass, so check dry grass first
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
elseif minetest.get_item_group(name, "grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
})

View File

@ -397,7 +397,7 @@ minetest.register_node("default:furnace_active", apply_logger({
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
name = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",

View File

@ -2604,6 +2604,9 @@ local function register_sign(material, desc, def)
meta:set_string("formspec", "field[text;;${text}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
if not fields.quit then
return -- workaround for https://github.com/luanti-org/luanti/issues/16187
end
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)

BIN
mods/default/sounds/default_break_glass.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_break_glass.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_break_glass.3.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_cool_lava.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_cool_lava.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_cool_lava.3.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_dig_crumbly.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_dig_dig_immediate.ogg Executable file → Normal file

Binary file not shown.

Binary file not shown.

BIN
mods/default/sounds/default_dirt_footstep.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_dirt_footstep.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_dug_node.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_dug_node.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_glass_footstep.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_grass_footstep.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_grass_footstep.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_grass_footstep.3.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_gravel_footstep.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_gravel_footstep.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_gravel_footstep.3.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_gravel_footstep.4.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_place_node.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_place_node.2.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_place_node.3.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_place_node_hard.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_place_node_hard.2.ogg Executable file → Normal file

Binary file not shown.

0
mods/default/sounds/default_snow_footstep.1.ogg Executable file → Normal file
View File

0
mods/default/sounds/default_snow_footstep.2.ogg Executable file → Normal file
View File

0
mods/default/sounds/default_snow_footstep.3.ogg Executable file → Normal file
View File

0
mods/default/sounds/default_snow_footstep.4.ogg Executable file → Normal file
View File

BIN
mods/default/sounds/default_wood_footstep.1.ogg Executable file → Normal file

Binary file not shown.

BIN
mods/default/sounds/default_wood_footstep.2.ogg Executable file → Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -132,7 +132,9 @@ function default.grow_tree(pos, is_apple_tree, bad)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
if vm.close ~= nil then
vm:close()
end
end
-- Jungle tree
@ -184,7 +186,9 @@ function default.grow_jungle_tree(pos, bad)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
if vm.close ~= nil then
vm:close()
end
end
@ -310,7 +314,9 @@ function default.grow_pine_tree(pos, snow)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
if vm.close ~= nil then
vm:close()
end
end

View File

@ -332,6 +332,9 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
vm1:set_data(data)
vm1:write_to_map()
if vm1.close ~= nil then
vm1:close()
end
-- recalculate new radius
radius = math.floor(radius * math.pow(count, 1/3))
@ -386,8 +389,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
vm:set_data(data)
vm:write_to_map()
vm:update_map()
vm:update_liquids()
if vm.close ~= nil then
vm:close()
end
-- call check_single_for_falling for everything within 1.5x blast radius
for y = -radius * 1.5, radius * 1.5 do

View File

@ -3,6 +3,7 @@ world=$(mktemp -d)
trap 'rm -rf "$world" || :' EXIT
[ -f game.conf ] || { echo "Must be run in game root folder." >&2; exit 1; }
[ -n "$DOCKER_IMAGE" ] || { echo "Specify a docker image." >&2; exit 1; }
chmod -R 777 "$world" # container uses unprivileged user inside
@ -12,7 +13,6 @@ vol=(
-v "$PWD":/var/lib/minetest/.minetest/games/minetest_game
-v "$world":/var/lib/minetest/.minetest/world
)
[ -z "$DOCKER_IMAGE" ] && DOCKER_IMAGE="ghcr.io/minetest/minetest:master"
docker run --rm -i "${vol[@]}" "$DOCKER_IMAGE" --config /etc/minetest/minetest.conf --gameid minetest
test -f "$world/map.sqlite" || exit 1