diff options
author | Niklp <89982526+Niklp09@users.noreply.github.com> | 2023-07-24 09:59:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 09:59:26 +0200 |
commit | 1440f35fa62fd2c01b4844261290c88e42d2430f (patch) | |
tree | e42db53056e5d6f1c4fd562a924934081ae787c4 /display_api/display.lua | |
parent | e0e03058362e038d07d4063c4fbd6999ad27109c (diff) | |
download | display_modpack_no_craft-1440f35fa62fd2c01b4844261290c88e42d2430f.tar.gz display_modpack_no_craft-1440f35fa62fd2c01b4844261290c88e42d2430f.zip |
Add luacheck, update translations, replace ABMs, bug fixes (#1)
* luacheck, mt 5 translation, german translation, maintenance
* fix luacheck warnings
* Fix digital clock nodebox and texture
* Fix luacheck usage
* Add comment why fonts are not split into several lines
Diffstat (limited to 'display_api/display.lua')
-rw-r--r-- | display_api/display.lua | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/display_api/display.lua b/display_api/display.lua index fa7c854..2baef11 100644 --- a/display_api/display.lua +++ b/display_api/display.lua @@ -65,9 +65,7 @@ local function compute_values(r) for _ = 1, r.x do d, w, h = rx(d), rx(w), rx(h) end for _ = 1, r.y do d, w, h = ry(d), ry(w), ry(h) end - return { - rotation=r, depth=d, width=w, height=h, - restricted=(r.x==0 and r.z==0) } + return {rotation=r, depth=d, width=w, height=h} end for i, r in pairs(facedir_rotations) do @@ -78,25 +76,6 @@ for i, r in pairs(wallmounted_rotations) do wallmounted_values[i] = compute_values(r) end --- Detect rotation restriction -local rotation_restricted = nil -minetest.register_entity('display_api:dummy_entity', { - collisionbox = { 0, 0, 0, 0, 0, 0 }, - visual = "upright_sprite", - textures = {} }) - -function display_api.is_rotation_restricted() - if rotation_restricted == nil then - local objref = minetest.add_entity( - {x=0, y=0, z=0}, 'display_api:dummy_entity') - if objref then - rotation_restricted = objref.set_rotation == nil - objref:remove() - end - end - return rotation_restricted -end - -- Clip position property to maximum entity position local function clip_pos_prop(posprop) @@ -243,16 +222,6 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2) z = pointed_thing.under.z - pointed_thing.above.z, } - local rotation_restriction = display_api.is_rotation_restricted() - - if rotation_restriction then - -- If item is not placed on a wall, use the player's view direction instead - if dir.x == 0 and dir.z == 0 then - dir = placer:get_look_dir() - end - dir.y = 0 - end - local param2 = 0 if ndef then if ndef.paramtype2 == "wallmounted" or @@ -261,7 +230,7 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2) elseif ndef.paramtype2 == "facedir" or ndef.paramtype2 == "colorfacedir" then - param2 = minetest.dir_to_facedir(dir, not rotation_restriction) + param2 = minetest.dir_to_facedir(dir, true) end end return minetest.item_place(itemstack, placer, pointed_thing, @@ -291,13 +260,9 @@ function display_api.on_rotate(pos, node, user, _, new_param2) return end - if ov.restricted or not display_api.is_rotation_restricted() then - minetest.swap_node(pos, node) - display_api.update_entities(pos) - return true - else - return false - end + minetest.swap_node(pos, node) + display_api.update_entities(pos) + return true end --- Creates display entity with some fields and the on_activate callback |