Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block meta in a hacky way #8859

Closed
wants to merge 1 commit into from

Conversation

@DS-Minetest
Copy link
Contributor

commented Aug 25, 2019

  • Goal of the PR: Add meta per that is saved in a whole mapblock and is not bound to a node.
  • How does the PR work?
    At pos 0xffff in the node meta of a mapblock, a sort pseudo node meta, the block meta, is saved.
    Mods can access this meta with minetest.get_block_meta(blockpos).
  • Resolves #8605.
  • Usecases and co. can be discussed in #8605.

To do

This PR is a Work in Progress.

  • Implement block meta sending.

How to test

minetest.register_chatcommand("blar", {
	params = "",
	description = "",
	privs = {},
	func = function(name, param)
		local player = minetest.get_player_by_name(name)
		local pp = player:get_pos()
		local bp = vector.floor(vector.multiply(pp, 1 / 16))
		local meta = minetest.get_block_meta(bp)
		return true, "blar: "..meta:get_string("test")
	end,
})

minetest.register_chatcommand("blaw", {
	params = "",
	description = "",
	privs = {},
	func = function(name, param)
		local player = minetest.get_player_by_name(name)
		local pp = player:get_pos()
		local bp = vector.floor(vector.multiply(pp, 1 / 16))
		local meta = minetest.get_block_meta(bp)
		meta:set_string("test", param)
		return true, "blaw: "..param
	end,
})
@paramat

This comment has been minimized.

Copy link
Member

commented Aug 25, 2019

The 1st usecase in the issue was challenged by rubenwardy.
The 2nd usecase given was:

I'm pretty sure there are many more usecases.

=)
However, this seems potentially useful. Can anyone think of uses?

@DS-Minetest

This comment has been minimized.

Copy link
Contributor Author

commented Aug 25, 2019

I'll do this in a less hacky way, see https://github.com/DS-Minetest/minetest/tree/block_meta_1.

@DS-Minetest DS-Minetest referenced this pull request Aug 28, 2019
@DS-Minetest DS-Minetest changed the title Add block meta Add block meta (0) Aug 28, 2019
@DS-Minetest

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

New PR: #8870

@DS-Minetest DS-Minetest changed the title Add block meta (0) Add block meta in a hacky way Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.