Can now sit down if clicking on side
This commit is contained in:
parent
2e745748eb
commit
1ad835bd53
@ -3,11 +3,11 @@ local mod_player_api = minetest.get_modpath("player_api") ~= nil
|
|||||||
local sitting = {}
|
local sitting = {}
|
||||||
local seats_occupied = {}
|
local seats_occupied = {}
|
||||||
|
|
||||||
local function top_face(pointed_thing)
|
local function bottom_face(pointed_thing)
|
||||||
if not pointed_thing then
|
if not pointed_thing then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return pointed_thing.above.y > pointed_thing.under.y
|
return pointed_thing.above.y < pointed_thing.under.y
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stand_up(player_name)
|
local function stand_up(player_name)
|
||||||
@ -43,8 +43,8 @@ function xdecor.sit(pos, node, clicker, pointed_thing)
|
|||||||
if not mod_player_api then
|
if not mod_player_api then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Must click on top face to sit down
|
-- Can't sit down if bottom face was pointed at
|
||||||
if not top_face(pointed_thing) then
|
if bottom_face(pointed_thing) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local player_name = clicker:get_player_name()
|
local player_name = clicker:get_player_name()
|
||||||
|
Loading…
Reference in New Issue
Block a user