Add Hades Revisited support. Fix attach to horse api and test it under Minetest game, Hades Revisited and MineClone 2.

This commit is contained in:
SFENCE 2022-08-16 05:46:20 +02:00
parent 8a34dce37c
commit 7d2ed80f98
3 changed files with 14 additions and 12 deletions

View file

@ -103,13 +103,19 @@ local function activate_nametag(self)
}) })
end end
local animate_player = {} local animate_player = nil
local player_attached = {}
if minetest.get_modpath("default") if minetest.get_modpath("default")
and minetest.get_modpath("player_api") then and minetest.get_modpath("player_api") then
animate_player = player_api.set_animation animate_player = player_api.set_animation
player_attached = player_api.player_attached
elseif minetest.get_modpath("mcl_player") then elseif minetest.get_modpath("mcl_player") then
animate_player = mcl_player.set_animation animate_player = mcl_player.set_animation
player_attached = mcl_player.player_attached
elseif minetest.get_modpath("hades_player") then
animate_player = hades_player.player_set_animation
player_attached = hades_player.player_attached
end end
----------------------- -----------------------
@ -522,19 +528,15 @@ function animalia.mount(self, player, params)
} }
}) })
player:set_eye_offset() player:set_eye_offset()
if minetest.get_modpath("player_api") then if animate_player then
animate_player(player, "stand", 30) animate_player(player, "stand", 30)
if player_api.player_attached then player_attached[player:get_player_name()] = false
player_api.player_attached[player:get_player_name()] = false
end
end end
self.rider = nil self.rider = nil
return return
end end
if player_api then player_attached[player:get_player_name()] = true
player_api.player_attached[player:get_player_name()] = true if animate_player then
end
if minetest.get_modpath("player_api") then
animate_player(player, "sit", 30) animate_player(player, "sit", 30)
end end
self.rider = player self.rider = player
@ -1270,4 +1272,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
animalia_libri_info[player_name] = nil animalia_libri_info[player_name] = nil
end end
end end
end) end)

View file

@ -52,7 +52,7 @@ for i = 1, #animalia.animals do
dofile(path.."/mobs/" .. name .. ".lua") dofile(path.."/mobs/" .. name .. ".lua")
end end
if minetest.settings:get_bool("spawn_mobs", true) then if minetest.settings:get_bool("spawn_mobs", true) and (minetest.get_modpath("hades_core")==nil) then
dofile(path.."/api/spawning.lua") dofile(path.."/api/spawning.lua")
end end

View file

@ -1,5 +1,5 @@
name = animalia name = animalia
depends = creatura depends = creatura
optional_depends = default, mcl_player optional_depends = default, mcl_player, hades_player
description = Adds unique and consistantly designed Animals description = Adds unique and consistantly designed Animals
title = Animalia title = Animalia