Add setting to enable legacy selectionbox

This commit is contained in:
Wuzzy 2023-12-27 18:41:42 +01:00
parent 2d13976dd7
commit 4fa1b4635d
2 changed files with 18 additions and 1 deletions

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("flying_carpet")
local legacy_selectionbox = minetest.settings:get_bool("flying_carpet_legacy_selectionbox", false)
--
-- Helper functions
--
@ -95,11 +97,18 @@ local update_velocities = function(velocities, new_value)
return velocities
end
local collisionbox = {-1,-0.02,-1, 1,0.02,1}
if legacy_selectionbox then
selectionbox = collisionbox
else
selectionbox = {-1,-0.03,-0.69, 1,0.03,0.69,rotate=true}
end
local carpet = {
initial_properties = {
physical = true,
collide_with_objects = false,
collisionbox = {-1,-0.02,-1, 1,0.02,1},
collisionbox = collisionbox,
selectionbox = selectionbox,
visual = "mesh",
mesh = "flying_carpet_model.obj",
textures = {"flying_carpet_surface.png"},

8
settingtypes.txt Normal file
View File

@ -0,0 +1,8 @@
# If enabled, the flying carpet uses an outdated non-rotated
# square-shaped selection box.
# If disabled, the flying carpet has a selection box that matches
# its shape and rotation perfectly.
# Rotating selection boxes are supported since Minetest 5.7.0.
# If your Minetest version is older, enable this setting.
# If not, disable this setting.
flying_carpet_legacy_selectionbox (Use legacy selection box) bool false