mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
improved mcl compatibility
This commit is contained in:
parent
f058f30be2
commit
3a5244c721
4 changed files with 18 additions and 14 deletions
3
init.lua
3
init.lua
|
@ -20,6 +20,9 @@ airutils.colors ={
|
||||||
yellow='#ffe400',
|
yellow='#ffe400',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
airutils.is_minetest = minetest.get_modpath("player_api")
|
||||||
|
airutils.is_mcl = minetest.get_modpath("mcl_player")
|
||||||
|
|
||||||
airutils.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1,
|
airutils.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1,
|
||||||
['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10}
|
['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ airutils.modname = minetest.get_current_modname()
|
||||||
|
|
||||||
--function to format formspec for mineclone. In case of minetest, just returns an empty string
|
--function to format formspec for mineclone. In case of minetest, just returns an empty string
|
||||||
local function get_itemslot_bg(a, b, c, d)
|
local function get_itemslot_bg(a, b, c, d)
|
||||||
if not minetest.get_modpath("player_api") then
|
if airutils.is_mcl then
|
||||||
return mcl_formspec.get_itemslot_bg(a,b,c,d)
|
return mcl_formspec.get_itemslot_bg(a,b,c,d)
|
||||||
end
|
end
|
||||||
return ""
|
return ""
|
||||||
|
@ -12,7 +12,7 @@ end
|
||||||
local function get_formspec_by_size(self, size)
|
local function get_formspec_by_size(self, size)
|
||||||
local background = ""
|
local background = ""
|
||||||
local hotbar = ""
|
local hotbar = ""
|
||||||
local is_minetest_game = minetest.get_modpath("player_api") or false
|
local is_minetest_game = airutils.is_minetest or false
|
||||||
if is_minetest_game then
|
if is_minetest_game then
|
||||||
background = background .. default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
background = background .. default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||||
hotbar = default.get_hotbar_bg(0,4.85)
|
hotbar = default.get_hotbar_bg(0,4.85)
|
||||||
|
|
|
@ -654,6 +654,7 @@ function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
|
||||||
-- deal with painting or destroying
|
-- deal with painting or destroying
|
||||||
if itmstck then
|
if itmstck then
|
||||||
if airutils.set_param_paint(self, puncher, itmstck, 1) == false then
|
if airutils.set_param_paint(self, puncher, itmstck, 1) == false then
|
||||||
|
|
||||||
if not self.driver and toolcaps and toolcaps.damage_groups
|
if not self.driver and toolcaps and toolcaps.damage_groups
|
||||||
and toolcaps.groupcaps and toolcaps.groupcaps.choppy and item_name ~= airutils.fuel then
|
and toolcaps.groupcaps and toolcaps.groupcaps.choppy and item_name ~= airutils.fuel then
|
||||||
--airutils.hurt(self,toolcaps.damage_groups.fleshy - 1)
|
--airutils.hurt(self,toolcaps.damage_groups.fleshy - 1)
|
||||||
|
|
|
@ -56,10 +56,10 @@ function airutils.attach(self, player, instructor_mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 1, z = -30})
|
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 1, z = -30})
|
||||||
if minetest.get_modpath("player_api") then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = true
|
player_api.player_attached[name] = true
|
||||||
player_api.set_animation(player, "sit")
|
player_api.set_animation(player, "sit")
|
||||||
elseif minetest.get_modpath("mcl_player") then
|
elseif airutils.is_mcl then
|
||||||
airutils.sit(player)
|
airutils.sit(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -90,10 +90,10 @@ function airutils.dettachPlayer(self, player)
|
||||||
if player then
|
if player then
|
||||||
player:set_detach()
|
player:set_detach()
|
||||||
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})
|
||||||
if minetest.get_modpath("player_api") then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = nil
|
player_api.player_attached[name] = nil
|
||||||
player_api.set_animation(player, "stand")
|
player_api.set_animation(player, "stand")
|
||||||
elseif minetest.get_modpath("mcl_player") then
|
elseif airutils.is_mcl then
|
||||||
mcl_player.player_attached[name] = nil
|
mcl_player.player_attached[name] = nil
|
||||||
mcl_player.player_set_animation(player, "stand")
|
mcl_player.player_set_animation(player, "stand")
|
||||||
end
|
end
|
||||||
|
@ -124,10 +124,10 @@ local function attach_copilot(self, name, player, eye_y)
|
||||||
-- attach the driver
|
-- attach the driver
|
||||||
player:set_attach(self.co_pilot_seat_base, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
player:set_attach(self.co_pilot_seat_base, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||||
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 3, z = -30})
|
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 3, z = -30})
|
||||||
if minetest.get_modpath("player_api") then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = true
|
player_api.player_attached[name] = true
|
||||||
player_api.set_animation(player, "sit")
|
player_api.set_animation(player, "sit")
|
||||||
elseif minetest.get_modpath("mcl_player") then
|
elseif airutils.is_mcl then
|
||||||
mcl_player.player_attached[name] = true
|
mcl_player.player_attached[name] = true
|
||||||
airutils.sit(player)
|
airutils.sit(player)
|
||||||
end
|
end
|
||||||
|
@ -186,10 +186,10 @@ function airutils.attach_pax(self, player, is_copilot)
|
||||||
player:set_attach(self._passengers_base[i], "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
player:set_attach(self._passengers_base[i], "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||||
player:set_eye_offset({x = 0, y = eye_y, z = 0}, {x = 0, y = 3, z = -30})
|
player:set_eye_offset({x = 0, y = eye_y, z = 0}, {x = 0, y = 3, z = -30})
|
||||||
|
|
||||||
if minetest.get_modpath("player_api") then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = true
|
player_api.player_attached[name] = true
|
||||||
player_api.set_animation(player, "sit")
|
player_api.set_animation(player, "sit")
|
||||||
elseif minetest.get_modpath("mcl_player") then
|
elseif airutils.is_mcl then
|
||||||
mcl_player.player_attached[name] = true
|
mcl_player.player_attached[name] = true
|
||||||
airutils.sit(player)
|
airutils.sit(player)
|
||||||
end
|
end
|
||||||
|
@ -231,10 +231,10 @@ function airutils.dettach_pax(self, player)
|
||||||
if player then
|
if player then
|
||||||
player:set_detach()
|
player:set_detach()
|
||||||
|
|
||||||
if minetest.get_modpath("player_api") then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = nil
|
player_api.player_attached[name] = nil
|
||||||
player_api.set_animation(player, "stand")
|
player_api.set_animation(player, "stand")
|
||||||
elseif minetest.get_modpath("mcl_player") then
|
elseif airutils.is_mcl then
|
||||||
mcl_player.player_attached[name] = nil
|
mcl_player.player_attached[name] = nil
|
||||||
mcl_player.player_set_animation(player, "stand")
|
mcl_player.player_set_animation(player, "stand")
|
||||||
end
|
end
|
||||||
|
@ -914,10 +914,10 @@ local function do_attach(self, player, slot)
|
||||||
end
|
end
|
||||||
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 3, z = -30})
|
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 3, z = -30})
|
||||||
|
|
||||||
if minetest.get_modpath("player_api") then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = true
|
player_api.player_attached[name] = true
|
||||||
player_api.set_animation(player, "sit")
|
player_api.set_animation(player, "sit")
|
||||||
elseif minetest.get_modpath("mcl_player") then
|
elseif airutils.is_mcl then
|
||||||
mcl_player.player_attached[name] = true
|
mcl_player.player_attached[name] = true
|
||||||
airutils.sit(player)
|
airutils.sit(player)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue