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 VoxelArea() constructor #12886

Merged
merged 1 commit into from
Oct 22, 2022

Conversation

TurkeyMcMac
Copy link
Contributor

VoxelArea objects can now be created with VoxelArea(MinEdge, MaxEdge). This VoxelArea constructor format is more consistent with VoxelManip. It also lets you create an area like so:

local area = VoxelArea(vm:get_emerged_area())

To do

This PR is Ready for Review.

How to test

You can use this command:

minetest.register_chatcommand("voxelarea_constructor", {
	func = function(name, param)
		local player = minetest.get_player_by_name(name)
		local pos = player and player:get_pos()
		if not pos then return false, "No player" end
		local vm = VoxelManip(pos, pos)
		local va = VoxelArea(vm:get_emerged_area())
		return true, tostring(va.MinEdge) .. "\t" .. tostring(va.MaxEdge) .. "\t" .. va:getVolume()
	end,
})

You can also test mods that use the old constructor to make sure they still work.

@TurkeyMcMac TurkeyMcMac added @ Script API Feature ✨ PRs that add or enhance a feature labels Oct 21, 2022
Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems helpful.

@TurkeyMcMac TurkeyMcMac merged commit 8f1593e into minetest:master Oct 22, 2022
LoneWolfHT pushed a commit to LoneWolfHT/minetest that referenced this pull request Nov 1, 2022
nerzhul pushed a commit to nerzhul/minetest that referenced this pull request Nov 3, 2022
appgurueu pushed a commit to appgurueu/minetest that referenced this pull request May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants