1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-22 08:00:18 +01:00

niklp suggestion

This commit is contained in:
wsor4035 2024-10-30 22:56:27 -04:00
parent c90e1d404a
commit 39761fc9c1

View File

@ -94,6 +94,39 @@ minetest.register_entity("homedecor_seating:seat", {
end,
})
--we only care about 4 rotations, but just in case someone worldedits, etc - do something other than crash
--radians are stupid, using degrees and then converting
local p2r = {
0*math.pi/180,
0*math.pi/180, --correct
180*math.pi/180, --correct
90*math.pi/180, --correct
270*math.pi/180, --correct
0*math.pi/180,
0*math.pi/180,
0*math.pi/180,
}
p2r[0] = p2r[1]
local p2r_sofa = {
0*math.pi/180,
90*math.pi/180, --correct
270*math.pi/180, --correct
180*math.pi/180, --correct
0*math.pi/180, --correct
0*math.pi/180,
0*math.pi/180,
0*math.pi/180,
}
p2r_sofa[0] = p2r_sofa[1]
local p2r_facedir = {
[0] = 180*math.pi/180,
[1] = 90*math.pi/180,
[2] = 0*math.pi/180,
[3] = 270*math.pi/180,
}
function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
if not clicker:is_player() then
return itemstack
@ -145,39 +178,6 @@ function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
--seat the player
clicker:set_pos(sit_pos)
--we only care about 4 rotations, but just in case someone worldedits, etc - do something other than crash
--radians are stupid, using degrees and then converting
local p2r = {
0*math.pi/180,
0*math.pi/180, --correct
180*math.pi/180, --correct
90*math.pi/180, --correct
270*math.pi/180, --correct
0*math.pi/180,
0*math.pi/180,
0*math.pi/180,
}
p2r[0] = p2r[1]
local p2r_sofa = {
0*math.pi/180,
90*math.pi/180, --correct
270*math.pi/180, --correct
180*math.pi/180, --correct
0*math.pi/180, --correct
0*math.pi/180,
0*math.pi/180,
0*math.pi/180,
}
p2r_sofa[0] = p2r_sofa[1]
local p2r_facedir = {
[0] = 180*math.pi/180,
[1] = 90*math.pi/180,
[2] = 0*math.pi/180,
[3] = 270*math.pi/180,
}
local entity = minetest.add_entity(sit_pos, "homedecor_seating:seat")
if not entity then return itemstack end --catch for when the entity fails to spawn just in case