dont relly on the legacy layer of default mod, detect if player api is present
* this mod was using the legacy.lua extension of default mod, with this patch we can avout the player_api or use it if present
This commit is contained in:
parent
2255cdd34b
commit
6f9c15bedb
21
api.lua
21
api.lua
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
--from lib_mount (required by new functions)
|
--from lib_mount (required by new functions)
|
||||||
|
|
||||||
|
local p_api = minetest.get_modpath("player_api")
|
||||||
local mobs_redo = false
|
local mobs_redo = false
|
||||||
if mobs.mod and mobs.mod == "redo" then
|
if mobs.mod and mobs.mod == "redo" then
|
||||||
mobs_redo = true
|
mobs_redo = true
|
||||||
@ -43,7 +43,8 @@ local function force_detach(player)
|
|||||||
end
|
end
|
||||||
player:set_detach()
|
player:set_detach()
|
||||||
end
|
end
|
||||||
default.player_attached[player:get_player_name()] = false
|
if p_api then player_api.player_attached[player:get_player_name()] = false
|
||||||
|
else default.player_attached[player:get_player_name()] = false end
|
||||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,9 +57,12 @@ function mobs_doomed.object_attach(entity, player, attach_at, eye_offset)
|
|||||||
player:set_properties({visual_size = {x=1, y=1}})
|
player:set_properties({visual_size = {x=1, y=1}})
|
||||||
|
|
||||||
player:set_eye_offset(eye_offset, {x=0, y=0, z=0})
|
player:set_eye_offset(eye_offset, {x=0, y=0, z=0})
|
||||||
default.player_attached[player:get_player_name()] = true
|
if p_api then player_api.player_attached[player:get_player_name()] = true
|
||||||
|
else default.player_attached[player:get_player_name()] = true end
|
||||||
|
|
||||||
minetest.after(0.2, function()
|
minetest.after(0.2, function()
|
||||||
default.player_set_animation(player, "sit" , 30)
|
if p_api then player_api.set_animation(player, "sit" , 30)
|
||||||
|
else default.player_set_animation(player, "sit" , 30) end
|
||||||
end)
|
end)
|
||||||
--entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
--entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||||
entity.object:set_yaw(player:get_look_horizontal() - (math.pi/2))
|
entity.object:set_yaw(player:get_look_horizontal() - (math.pi/2))
|
||||||
@ -67,8 +71,13 @@ end
|
|||||||
function mobs_doomed.object_detach(entity, player, offset)
|
function mobs_doomed.object_detach(entity, player, offset)
|
||||||
entity.driver = nil
|
entity.driver = nil
|
||||||
player:set_detach()
|
player:set_detach()
|
||||||
default.player_attached[player:get_player_name()] = false
|
if p_api then
|
||||||
default.player_set_animation(player, "stand" , 30)
|
player_api.player_attached[player:get_player_name()] = false
|
||||||
|
player_api.set_animation(player, "stand" , 30)
|
||||||
|
else
|
||||||
|
default.player_attached[player:get_player_name()] = false
|
||||||
|
default.player_set_animation(player, "stand" , 30)
|
||||||
|
end
|
||||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
||||||
|
@ -6,3 +6,4 @@ bones?
|
|||||||
ethereal?
|
ethereal?
|
||||||
caverealms?
|
caverealms?
|
||||||
mobs_animal?
|
mobs_animal?
|
||||||
|
player_api?
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = mobs_doomed
|
name = mobs_doomed
|
||||||
depends = default, mobs, wool, farming
|
depends = default, mobs, wool, farming
|
||||||
optional_depends = bones, ethereal, caverealms, mobs_animal
|
optional_depends = bones, ethereal, caverealms, mobs_animal, player_api
|
||||||
description = MOBS for more monsters like dragons, orcs, ogres, elephans, etc
|
description = MOBS for more monsters like dragons, orcs, ogres, elephans, etc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user