Make player_api optional
This commit is contained in:
parent
7e89dbf45e
commit
b2772c956a
@ -1,4 +1,5 @@
|
|||||||
local mod_playerphysics = minetest.get_modpath("playerphysics") ~= nil
|
local mod_playerphysics = minetest.get_modpath("playerphysics") ~= nil
|
||||||
|
local mod_player_api = minetest.get_modpath("player_api") ~= nil
|
||||||
|
|
||||||
local function top_face(pointed_thing)
|
local function top_face(pointed_thing)
|
||||||
if not pointed_thing then return end
|
if not pointed_thing then return end
|
||||||
@ -6,6 +7,7 @@ local function top_face(pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function xdecor.sit(pos, node, clicker, pointed_thing)
|
function xdecor.sit(pos, node, clicker, pointed_thing)
|
||||||
|
if not mod_player_api then return end
|
||||||
if not top_face(pointed_thing) then return end
|
if not top_face(pointed_thing) then return end
|
||||||
local player_name = clicker:get_player_name()
|
local player_name = clicker:get_player_name()
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 0.1)
|
local objs = minetest.get_objects_inside_radius(pos, 0.1)
|
||||||
@ -58,6 +60,9 @@ function xdecor.sit(pos, node, clicker, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function xdecor.sit_dig(pos, digger)
|
function xdecor.sit_dig(pos, digger)
|
||||||
|
if not mod_player_api then
|
||||||
|
return true
|
||||||
|
end
|
||||||
for _, player in pairs(minetest.get_objects_inside_radius(pos, 0.1)) do
|
for _, player in pairs(minetest.get_objects_inside_radius(pos, 0.1)) do
|
||||||
if player:is_player() and
|
if player:is_player() and
|
||||||
player_api.player_attached[player:get_player_name()] then
|
player_api.player_attached[player:get_player_name()] then
|
||||||
|
4
mod.conf
4
mod.conf
@ -1,5 +1,5 @@
|
|||||||
name = xdecor
|
name = xdecor
|
||||||
description = A decoration mod meant to be simple and well-featured (libre version).
|
description = A decoration mod meant to be simple and well-featured (libre version).
|
||||||
depends = default, player_api, bucket, doors, farming, stairs, xpanes
|
depends = default, bucket, doors, farming, stairs, xpanes
|
||||||
optional_depends = playerphysics, fire, oresplus, moreblocks, mesecons
|
optional_depends = playerphysics, player_api, fire, oresplus, moreblocks, mesecons
|
||||||
min_minetest_version = 5.1.0
|
min_minetest_version = 5.1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user