Move dependency to player_api

master
Wuzzy 2019-03-22 14:25:58 +01:00
parent d9aa94ba65
commit d3115a2314
2 changed files with 5 additions and 11 deletions

View File

@ -70,7 +70,7 @@ end
local mana_regen_cost = 1.5
local mod_model = minetest.get_modpath("default") ~= nil or minetest.get_modpath("playermodel")
local mod_model = minetest.get_modpath("player_api") ~= nil
local mod_mana = minetest.get_modpath("mana") ~= nil
local mod_craft = minetest.get_modpath("default") ~= nil and minetest.get_modpath("wool")
local mod_craft_mcl2 = minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_wool") and minetest.get_modpath("mesecons")
@ -137,8 +137,7 @@ function carpet:on_rightclick(clicker)
self.driver = nil
clicker:set_detach()
if mod_model then
default.player_attached[name] = false
default.player_set_animation(clicker, "stand", 30)
player_api.set_animation(clicker, "stand", 30)
end
if mod_mana and self.flying then
mana.setregen(clicker:get_player_name(), mana.getregen(clicker:get_player_name())+mana_regen_cost)
@ -149,10 +148,9 @@ function carpet:on_rightclick(clicker)
clicker:set_look_yaw(self.object:get_yaw()-math.pi/2)
clicker:set_attach(self.object, "", {x=-4,y=10.1,z=0}, {x=0,y=90,z=0})
if mod_model then
default.player_attached[name] = true
minetest.after(0.2, function(player)
if player and player:is_player() then
default.player_set_animation(player, "sit", 30)
player_api.set_animation(player, "sit", 30)
end
end, player)
end
@ -247,9 +245,6 @@ function carpet:on_punch(puncher, time_from_last_punch, tool_capabilities, direc
end
minetest.sound_play("flying_carpet_take", {pos=self.object:get_pos(), gain=0.3})
puncher:set_detach()
if mod_model then
default.player_attached[puncher:get_player_name()] = false
end
if self.sound_flight then
minetest.sound_stop(self.sound_flight)
self.sound_flight = nil
@ -627,8 +622,7 @@ function carpet:on_step(dtime)
if self.driver ~= nil then
self.driver:set_detach()
if mod_model then
default.player_attached[self.driver:get_player_name()] = false
default.player_set_animation(self.driver, "stand", 30)
player_api.set_animation(self.driver, "stand", 30)
end
if mod_mana then
mana.setregen(self.driver:get_player_name(), mana.getregen(self.driver:get_player_name())+mana_regen_cost)

View File

@ -1,3 +1,3 @@
name = flying_carpet
optional_depends = default, wool, mana, doc_items, doc_identifier
optional_depends = player_api, wool, mana, doc_items, doc_identifier
description = Quickly explore the vast terrain with the magical flying carpet. But only the skilled users can master its speed, the fools will crash and hurt themselves.