daydream reports: you know how build in place al ... #7928

Open
opened 2024-12-28 10:01:54 +01:00 by yourland-report · 12 comments

daydream reports a bug:

you know how build in place allows a node placed on your head what the players call x-ray vision... what if you could turn that off in selected areas... this would become necessary for fair mysteries or mini games where not having x-ray vision would make it fair for everybody.

Player position:

{
	z = -9643.1826171875,
	x = -7777.8525390625,
	y = 3.5
}

Player look:

{
	z = -0.54790383577347,
	x = -0.83062440156937,
	y = -0.099319748580456
}

Player information:

{
	lang_code = "",
	avg_rtt = 0.16599999368191,
	minor = 8,
	major = 5,
	state = "Active",
	version_string = "5.8.0",
	max_rtt = 1.0410000085831,
	formspec_version = 7,
	ip_version = 6,
	min_rtt = 0.15500000119209,
	min_jitter = 0,
	max_jitter = 0.85000002384186,
	avg_jitter = 0.0039999932050705,
	connection_uptime = 1885,
	serialization_version = 29,
	patch = 0,
	protocol_version = 43
}

Player meta:

{
	fields = {
		died = "371",
		crafted = "305614",
		["hud_manager:spawnit:hud_enabled"] = "n",
		xp_redo_hud_color = "0xFFC001",
		["hud_manager:yl_snowball:hud__enabled"] = "n",
		hotbar_size = "16",
		partychat = "party",
		punch_count = "534288",
		["3d_armor_inventory"] = "return {\"petz:prince_crown 1 600\", \"shields:shield_admin\", \"3d_armor:chestplate_crystal 1 120\", \"3d_armor:leggings_nether 1 3280\", \"nether_mobs:dragon_boots 1 4010\", \"\"}",
		inflicted_damage = "9341226",
		["stamina:level"] = "12",
		["stamina:exhaustion"] = "98",
		["petz:werewolf"] = "0",
		jointime = "1650064821",
		["petz:lycanthropy"] = "0",
		hud_state = "on",
		arenalib_infobox_arenaID = "0",
		["ocean_build.ocean_built"] = "8",
		repellant = "0",
		yl_church = "return {[\"last_death_portal\"] = 1729602840, [\"last_heal\"] = 1673944229, [\"last_death\"] = {[\"z\"] = 1642, [\"x\"] = 2050, [\"y\"] = 21}}",
		xp = "3320544",
		["signslib:pos"] = "(-1031,40,-2936)",
		["petz:old_override_table"] = "return {[\"speed\"] = 2, [\"sneak\"] = true, [\"jump\"] = 1.5, [\"gravity\"] = 1, [\"new_move\"] = true, [\"sneak_glitch\"] = false}",
		["ocean_build.last_warning"] = "1.65235e+09",
		["petz:werewolf_vignette_id"] = "19",
		bitten = "0",
		yl_commons_thankyou = "1406",
		["unified_inventory:bags"] = "return {\"water_life:croc_bag\", \"water_life:croc_bag\", \"water_life:croc_bag\", \"water_life:croc_bag\"}",
		["petz:werewolf_clan_idx"] = "3",
		yl_commons_player_created = "1650064821",
		yl_commons_player_joined = "1735374645",
		played_time = "51764998",
		digged_nodes = "3299471",
		placed_nodes = "545588"
	}
}

Log identifier


[MOD] yl_report log identifier = oh5yt842VwprgNM9FQeWHtAgN7iVb0bc

Profiler save:

profile-20241228T090154.json_prettyEE

Status:

# Server: version: 5.10.0-yl-RelWithDebInfo | game: Minetest Game | uptime: 4d 8h 34min 9s | max lag: 0.183s | clients (12/52): _Amadeus_, AliasAlreadyTaken, Bailiff, CloudZ, daydream, flux, johanlegend, rihu, salmalecoq, sanetol9988, Service, try_114

Teleport command:

/teleport xyz -7778 4 -9643

Compass command:

/give_compass Construction oh5yt842VwprgNM9FQeWHtAgN7iVb0bc D2691E -7778 4 -9643
daydream reports a bug: > you know how build in place allows a node placed on your head what the players call x-ray vision... what if you could turn that off in selected areas... this would become necessary for fair mysteries or mini games where not having x-ray vision would make it fair for everybody. Player position: ``` { z = -9643.1826171875, x = -7777.8525390625, y = 3.5 } ``` Player look: ``` { z = -0.54790383577347, x = -0.83062440156937, y = -0.099319748580456 } ``` Player information: ``` { lang_code = "", avg_rtt = 0.16599999368191, minor = 8, major = 5, state = "Active", version_string = "5.8.0", max_rtt = 1.0410000085831, formspec_version = 7, ip_version = 6, min_rtt = 0.15500000119209, min_jitter = 0, max_jitter = 0.85000002384186, avg_jitter = 0.0039999932050705, connection_uptime = 1885, serialization_version = 29, patch = 0, protocol_version = 43 } ``` Player meta: ``` { fields = { died = "371", crafted = "305614", ["hud_manager:spawnit:hud_enabled"] = "n", xp_redo_hud_color = "0xFFC001", ["hud_manager:yl_snowball:hud__enabled"] = "n", hotbar_size = "16", partychat = "party", punch_count = "534288", ["3d_armor_inventory"] = "return {\"petz:prince_crown 1 600\", \"shields:shield_admin\", \"3d_armor:chestplate_crystal 1 120\", \"3d_armor:leggings_nether 1 3280\", \"nether_mobs:dragon_boots 1 4010\", \"\"}", inflicted_damage = "9341226", ["stamina:level"] = "12", ["stamina:exhaustion"] = "98", ["petz:werewolf"] = "0", jointime = "1650064821", ["petz:lycanthropy"] = "0", hud_state = "on", arenalib_infobox_arenaID = "0", ["ocean_build.ocean_built"] = "8", repellant = "0", yl_church = "return {[\"last_death_portal\"] = 1729602840, [\"last_heal\"] = 1673944229, [\"last_death\"] = {[\"z\"] = 1642, [\"x\"] = 2050, [\"y\"] = 21}}", xp = "3320544", ["signslib:pos"] = "(-1031,40,-2936)", ["petz:old_override_table"] = "return {[\"speed\"] = 2, [\"sneak\"] = true, [\"jump\"] = 1.5, [\"gravity\"] = 1, [\"new_move\"] = true, [\"sneak_glitch\"] = false}", ["ocean_build.last_warning"] = "1.65235e+09", ["petz:werewolf_vignette_id"] = "19", bitten = "0", yl_commons_thankyou = "1406", ["unified_inventory:bags"] = "return {\"water_life:croc_bag\", \"water_life:croc_bag\", \"water_life:croc_bag\", \"water_life:croc_bag\"}", ["petz:werewolf_clan_idx"] = "3", yl_commons_player_created = "1650064821", yl_commons_player_joined = "1735374645", played_time = "51764998", digged_nodes = "3299471", placed_nodes = "545588" } } ``` Log identifier ``` [MOD] yl_report log identifier = oh5yt842VwprgNM9FQeWHtAgN7iVb0bc ``` Profiler save: ``` profile-20241228T090154.json_prettyEE ``` Status: ``` # Server: version: 5.10.0-yl-RelWithDebInfo | game: Minetest Game | uptime: 4d 8h 34min 9s | max lag: 0.183s | clients (12/52): _Amadeus_, AliasAlreadyTaken, Bailiff, CloudZ, daydream, flux, johanlegend, rihu, salmalecoq, sanetol9988, Service, try_114 ``` Teleport command: ``` /teleport xyz -7778 4 -9643 ``` Compass command: ``` /give_compass Construction oh5yt842VwprgNM9FQeWHtAgN7iVb0bc D2691E -7778 4 -9643 ```
AliasAlreadyTaken was assigned by yourland-report 2024-12-28 10:01:54 +01:00

I love this idea

I love this idea
Owner

Problem is x-ray is a function of 'build where you are' which is not only an engine option choice but a much needed one in many innocent cases. And players already can't build in a protected quest area or mini game area, only for a second they can, and that makes gaming unfair.

The only way around this that I can think of is if you engage in build where you are in protected space, you get sent to spawn. This could be on the SECOND attempt tho because the first can always been an accident.

It's a hard one, but build where you are is a client setting anyways. Having even one 'x-ray' look at things in a mini game can give a wild advantage... but we'll have to think outside the box to counter-act it I think.

send to spawn?
area ban from mini game or quest area?
let stay but eliminate from prizes?

I bet if you get eliminated from prizes, a whole lot less accidents happen!

Problem is x-ray is a function of 'build where you are' which is not only an engine option choice but a much needed one in many innocent cases. And players already can't build in a protected quest area or mini game area, only for a second they can, and that makes gaming unfair. The only way around this that I can think of is if you engage in build where you are in protected space, you get sent to spawn. This could be on the SECOND attempt tho because the first can always been an accident. It's a hard one, but **build where you are is a client setting** anyways. Having even one 'x-ray' look at things in a mini game can give a wild advantage... but we'll have to think outside the box to counter-act it I think. send to spawn? area ban from mini game or quest area? let stay but eliminate from prizes? I bet if you get eliminated from prizes, a whole lot less accidents happen!
Member

There's more than one way to end up with your head inside a block, even with "build where you are" option turned off - both using additional items, or just engine quirks (just turn it off and experiment a little :p). So, whatever this option is set to, it's just for player's convenience during building, it can't prevent cheating even if you force it off (and you can't...).

What you really want, is to detect if player's view is inside the block. Then, you can start suffocating them, making them "blind", etc.

I noticed that in singleplayer, game detects when my head is inside the block and makes my view completely black. Using same client, I get "X-ray" effect on YL. Idk why? MTG difference?

But even with this black screen effect, I can position myself in such a way that the camera position is outside the block (-> no black screen), but almost half of the viewing frustum is still inside - and I get same x-ray view.

Ideally this should be fixed in the engine. Client additionaly should gently push players outside the block if they get inside...

There's more than one way to end up with your head inside a block, even with "build where you are" option turned off - both using additional items, or just engine quirks (just turn it off and experiment a little :p). So, whatever this option is set to, it's just for player's convenience during building, it can't prevent cheating even if you force it off (and you can't...). What you really want, is to detect if player's view is inside the block. Then, you can start suffocating them, making them "blind", etc. I noticed that in singleplayer, game detects when my head is inside the block and makes my view completely black. Using same client, I get "X-ray" effect on YL. Idk why? MTG difference? But even with this black screen effect, I can position myself in such a way that the camera position is outside the block (-> no black screen), but almost half of the viewing frustum is still inside - and I get same x-ray view. Ideally this should be fixed in the engine. Client additionaly should gently push players outside the block if they get inside...

Apparently enable_build_where_you_stand is NOT a serverside configuration, but a clientside one.

Means, anyone could negate any damage if they placed a block at their feet and gain xray when placing a block at their head. Neither is intended, but it is clearly a bug/cheat/...

Repro:

Enable clientside https://github.com/minetest/minetest/blob/master/minetest.conf.example#L29

#    If enabled, you can place nodes at the position (feet + eye level) where you stand.
#    This is helpful when working with nodeboxes in small areas.
#    type: bool
# enable_build_where_you_stand = false

Place a block at head level: xray
Place a block at feet level: no more damage

Question is how do we prevent this? How do we express "The head is inside a block"? We can't simply query the position above the feet and blind the player if this position is not-air. There are slabs where the player might fit below.

Same goes for the feet: We can't simply suffocate or move the player when his foot position is at the same rounded pos like a block.

We also can't rely on the hitbox, it might overlap with a corner.

How do we technically say "the position of the feet" or "the position of the eyes" are inside a block?

Can a raycast say whether we're inside or outside?

Some tests:

  • Full block at the feet causes monsters not hit the player (no hit at all, not only 0 damage): NOK
  • Full block at the feet causes pvp directly hit the player: OK
  • Slab (half a block) at the feet causes monsters not hit the player: NOK
  • Standing ON the slab causes monsters to hit the player: OK
  • Standing in a fence means there are multiple collisionboxes involved. As soon as there is no line of sight to the feet of a player, the monster cannot hurt the player: NOK
Apparently `enable_build_where_you_stand` is NOT a serverside configuration, but a clientside one. Means, anyone could negate any damage if they placed a block at their feet and gain xray when placing a block at their head. Neither is intended, but it is clearly a bug/cheat/... Repro: Enable clientside https://github.com/minetest/minetest/blob/master/minetest.conf.example#L29 ``` # If enabled, you can place nodes at the position (feet + eye level) where you stand. # This is helpful when working with nodeboxes in small areas. # type: bool # enable_build_where_you_stand = false ``` Place a block at head level: xray Place a block at feet level: no more damage Question is how do we prevent this? How do we express "The head is inside a block"? We can't simply query the position above the feet and blind the player if this position is not-air. There are slabs where the player might fit below. Same goes for the feet: We can't simply suffocate or move the player when his foot position is at the same rounded pos like a block. We also can't rely on the hitbox, it might overlap with a corner. How do we technically say "the position of the feet" or "the position of the eyes" are inside a block? Can a raycast say whether we're inside or outside? Some tests: * Full block at the feet causes monsters not hit the player (no hit at all, not only 0 damage): NOK * Full block at the feet causes pvp directly hit the player: OK * Slab (half a block) at the feet causes monsters not hit the player: NOK * Standing ON the slab causes monsters to hit the player: OK * Standing in a fence means there are multiple collisionboxes involved. As soon as there is no line of sight to the feet of a player, the monster cannot hurt the player: NOK

There is

https://github.com/minetest/minetest/blob/master/doc/lua_api.md?plain=1#L9932

damage_per_second = 0

we could apply this to each and every block :P

There is

https://github.com/minetest/minetest/blob/master/builtin/game/item_entity.lua#L185

That's how item entities are forced out of blocks, but apparently that only works for full blocks, not for slabs or any other

There is https://github.com/minetest/minetest/blob/master/doc/lua_api.md?plain=1#L9932 damage_per_second = 0 we could apply this to each and every block :P There is https://github.com/minetest/minetest/blob/master/builtin/game/item_entity.lua#L185 That's how item entities are forced out of blocks, but apparently that only works for full blocks, not for slabs or any other
Member

If the build in of head and legs is a problem, then certainly also the lateral view of walls via "C".

If the build in of head and legs is a problem, then certainly also the lateral view of walls via "C".
  • Full block at the feet causes monsters not hit the player (no hit at all, not only 0 damage): NOK

Full block at feet (and possibly head) can happen during mining quite often (when loose sand or gravel falls on to of your head).

So if one block of sand falls at you and ends at your feet, does that protect you from monsters as well?

I think the fix should be to change monsters to be able to hit head of the player, as being submerged in blocks can happen quite easily also in legitimate way.

Also, on some other servers, if you are fully within a solid block, you lose breath like if you are submerged in a liquid. This way you can't stay inside such block for very long, otherwise you'll suffocate to death. If this is not enabled here, maybe enable that as well?

> * Full block at the feet causes monsters not hit the player (no hit at all, not only 0 damage): NOK Full block at feet (and possibly head) can happen during mining quite often (when loose sand or gravel falls on to of your head). So if one block of sand falls at you and ends at your feet, does that protect you from monsters as well? I think the fix should be to change monsters to be able to hit head of the player, as being submerged in blocks can happen quite easily also in legitimate way. Also, on some other servers, if you are fully within a solid block, you lose breath like if you are submerged in a liquid. This way you can't stay inside such block for very long, otherwise you'll suffocate to death. If this is not enabled here, maybe enable that as well?
Member

So if one block of sand falls at you and ends at your feet, does that protect you from monsters as well?

Well we can test it, can't we?

Also, on some other servers, if you are fully within a solid block, you lose breath like if you are submerged in a liquid. This way you can't stay inside such block for very long, otherwise you'll suffocate to death. If this is not enabled here, maybe enable that as well?

That might be countered by use of Gilly-staff like in Liquid.

> So if one block of sand falls at you and ends at your feet, does that protect you from monsters as well? Well we can test it, can't we? > Also, on some other servers, if you are fully within a solid block, you lose breath like if you are submerged in a liquid. This way you can't stay inside such block for very long, otherwise you'll suffocate to death. If this is not enabled here, maybe enable that as well? That might be countered by use of Gilly-staff like in Liquid.

local function is_inside_box(pos, box)
print(dump(box))
	local pos1 = vector.new(box[1], box[2], box[3])
	local pos2 = vector.new(box[4], box[5], box[6])
	local min, max = vector.sort(pos1, pos2)
print(dump(min))
print(dump(max))
print(dump(pos))
	return vector.in_area(pos, min, max)
end

local function is_inside_block(player_name)
	local p_obj = core.get_player_by_name(player_name)
	if not p_obj then return false end
	
	local pos = p_obj:get_pos()
	if not pos then return false end
	local pos_center = vector.round(pos)

	local c_boxes = core.get_node_boxes("collision_box", pos_center, nil)
	if not next(c_boxes) then return false end
	
	local deviation = vector.subtract(pos, pos_center)
	
	for _, box in ipairs(c_boxes) do
		if is_inside_box(deviation, box) then return true end
	end

	return false	
end

local name = "Boris"

print(is_inside_block(name))

Second attempt:

local function is_inside_box(pos, box)
	local pos1 = vector.new(box[1], box[2], box[3])
	local pos2 = vector.new(box[4], box[5], box[6])
	local min, max = vector.sort(pos1, pos2)
	local inside = ((pos.x >= pos1.x) and (pos.x <= pos2.x) and
	(pos.y >= pos1.y) and (pos.y <= pos2.y) and
	(pos.z >= pos1.z) and (pos.z <= pos2.z))
		print("2"..dump(inside))
	return inside
	--return vector.in_area(pos, min, max)
end

local function is_inside_block(p_obj)
	--local p_obj = core.get_player_by_name(player_name)
	if not p_obj then return false end

	local pos = p_obj:get_pos()
	if not pos then return false end
	local pos_center = vector.round(pos)
	
	local node = core.get_node_or_nil(pos_center)
	if ((not node) or (not node.name)) then return false end
	local node_name = node.name
	local def = core.registered_nodes[node_name]
	--print(dump(node_name))
	--print(dump(def.walkable))
	if ((def.walkable == false) or (def.walkable == nil)) then return false end

	local c_boxes = core.get_node_boxes("collision_box", pos_center, nil)
	if not next(c_boxes) then return false end
	
	local deviation = vector.subtract(pos, pos_center)

	for _, box in ipairs(c_boxes) do
		if is_inside_box(deviation, box) then return true end
	end

	return false	
end

local function check_all()
	local p_pobjs = core.get_connected_players()

	for _,p_obj in ipairs(p_pobjs) do
			core.chat_send_all("meow")
		if is_inside_block(p_obj) then
			core.chat_send_all("wrong:"..p_obj:get_player_name())
		end
	end

end

local t1 = core.get_us_time()
--local iib = is_inside_block(name)
check_all()
local t2 = core.get_us_time()
--print("T="..dump(t2-t1)..", result: " .. dump(iib))
core.chat_send_all("T="..dump(t2-t1))
```lua local function is_inside_box(pos, box) print(dump(box)) local pos1 = vector.new(box[1], box[2], box[3]) local pos2 = vector.new(box[4], box[5], box[6]) local min, max = vector.sort(pos1, pos2) print(dump(min)) print(dump(max)) print(dump(pos)) return vector.in_area(pos, min, max) end local function is_inside_block(player_name) local p_obj = core.get_player_by_name(player_name) if not p_obj then return false end local pos = p_obj:get_pos() if not pos then return false end local pos_center = vector.round(pos) local c_boxes = core.get_node_boxes("collision_box", pos_center, nil) if not next(c_boxes) then return false end local deviation = vector.subtract(pos, pos_center) for _, box in ipairs(c_boxes) do if is_inside_box(deviation, box) then return true end end return false end local name = "Boris" print(is_inside_block(name)) ``` Second attempt: ```lua local function is_inside_box(pos, box) local pos1 = vector.new(box[1], box[2], box[3]) local pos2 = vector.new(box[4], box[5], box[6]) local min, max = vector.sort(pos1, pos2) local inside = ((pos.x >= pos1.x) and (pos.x <= pos2.x) and (pos.y >= pos1.y) and (pos.y <= pos2.y) and (pos.z >= pos1.z) and (pos.z <= pos2.z)) print("2"..dump(inside)) return inside --return vector.in_area(pos, min, max) end local function is_inside_block(p_obj) --local p_obj = core.get_player_by_name(player_name) if not p_obj then return false end local pos = p_obj:get_pos() if not pos then return false end local pos_center = vector.round(pos) local node = core.get_node_or_nil(pos_center) if ((not node) or (not node.name)) then return false end local node_name = node.name local def = core.registered_nodes[node_name] --print(dump(node_name)) --print(dump(def.walkable)) if ((def.walkable == false) or (def.walkable == nil)) then return false end local c_boxes = core.get_node_boxes("collision_box", pos_center, nil) if not next(c_boxes) then return false end local deviation = vector.subtract(pos, pos_center) for _, box in ipairs(c_boxes) do if is_inside_box(deviation, box) then return true end end return false end local function check_all() local p_pobjs = core.get_connected_players() for _,p_obj in ipairs(p_pobjs) do core.chat_send_all("meow") if is_inside_block(p_obj) then core.chat_send_all("wrong:"..p_obj:get_player_name()) end end end local t1 = core.get_us_time() --local iib = is_inside_block(name) check_all() local t2 = core.get_us_time() --print("T="..dump(t2-t1)..", result: " .. dump(iib)) core.chat_send_all("T="..dump(t2-t1)) ```

I can do one thing, I can program a mod that prevents building nodes over your head in a certain area

I can do one thing, I can program a mod that prevents building nodes over your head in a certain area
Member

Your head/position does not need to be inside the node to get the x-ray effect, only your viewing frustum:

screenshot_20241231_103203.png

My feet are between two air blocks here, with the camera position also in an air block, only frustum clipping.

You also don't need to build anything "above" you. It's possible to build below and "fall through". Or drop falling block on your head, or use a contraption:
screenshot_20241231_103225.png

(contraption here is more for visual effect, just jumping and placing 2 blocks below you as you land is very easy and quick)

For this configuration, both versions of code that Alias posted above say "false".

Your head/position does not need to be inside the node to get the x-ray effect, only your viewing frustum: ![screenshot_20241231_103203.png](/attachments/1f20d693-1b12-4c54-a1b5-276a9707db90) My feet are _between_ two air blocks here, with the camera position also in an air block, only frustum clipping. You also don't need to build anything "above" you. It's possible to build below and "fall through". Or drop falling block on your head, or use a contraption: ![screenshot_20241231_103225.png](/attachments/899708f3-37fa-452e-8944-6ab9d705185d) (contraption here is more for visual effect, just jumping and placing 2 blocks below you as you land is very easy and quick) For this configuration, both versions of code that Alias posted above say "false".
Member

My two cents:

  • There are mods that implement something similar to enable_build_where_you_stand for servers already: https://content.luanti.org/packages/LMD/disable_build_where_they_stand/
  • as whosit mentioned, there are tons of ways to get your head stuck in something. Building is just one of many...
  • we could make a globalstep to check if a player is stuck in something, but:
  • There is no need to have your head in a block to get x-ray: Stand next to a wall, press c to get into 3rd person view and move your mouse until you can see through parts of the wall. I don't think there is a way to detect players abusing that bug... image

IMO it's not much use to fight the "x-ray bc. the head is in a block" if it's that easy to x-ray without having the head stuck in a block...

My two cents: - There are mods that implement something similar to `enable_build_where_you_stand` for servers already: https://content.luanti.org/packages/LMD/disable_build_where_they_stand/ - as whosit mentioned, there are tons of ways to get your head stuck in something. Building is just one of many... - we could make a globalstep to check if a player is stuck in something, but: - **There is no need to have your head in a block to get x-ray**: Stand next to a wall, press `c` to get into 3rd person view and move your mouse until you can see through parts of the wall. I don't think there is a way to detect players abusing that bug... ![image](/attachments/4c7a4bf5-114f-408d-a695-9c4dd7656112) IMO it's not much use to fight the "x-ray bc. the head is in a block" if it's that easy to x-ray without having the head stuck in a block...
1.5 MiB
Sign in to join this conversation.
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#7928
No description provided.