v 20220614 - update boats mod, fix player api detection
* property detect the player api respect engine game version
This commit is contained in:
parent
07a1de54a0
commit
b8ae1c4ccd
@ -9,7 +9,7 @@ For information check [../README.md](../README.md)
|
|||||||
| ------------------ | --------------------------------------------------- | -------- | --- |
|
| ------------------ | --------------------------------------------------- | -------- | --- |
|
||||||
| api | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | [api](../game_api.md) |
|
| api | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | [api](../game_api.md) |
|
||||||
| beds | https://codeberg.org/minenux/minetest-mod-beds | https://codeberg.org/minenux/minetest-mod-beds/commit/a1aac5940c88106b901c00409d7dac942720dd5b | [beds/README.md](beds/README.md) |
|
| beds | https://codeberg.org/minenux/minetest-mod-beds | https://codeberg.org/minenux/minetest-mod-beds/commit/a1aac5940c88106b901c00409d7dac942720dd5b | [beds/README.md](beds/README.md) |
|
||||||
| boats | https://codeberg.org/minenux/minetest-mod-boats | https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f | [boats/README.md](boats/README.md) |
|
| boats | https://codeberg.org/minenux/minetest-mod-boats | https://codeberg.org/minenux/minetest-mod-boats/commit/e412ae84db3c443618b117fb35ae69e3c9bbae10 | [boats/README.md](boats/README.md) |
|
||||||
| bucket | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) |
|
| bucket | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) |
|
||||||
| butterflies | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) |
|
| butterflies | https://codeberg.org/minenux/minetest-mod-bucket.git | https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5 | [bucket/README.md](bucket/README.md) |
|
||||||
| bones | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | |
|
| bones | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | |
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
-- boats/init.lua
|
-- boats/init.lua
|
||||||
|
|
||||||
|
local is_pa = minetest.get_modpath("player_api")
|
||||||
|
|
||||||
-- translation support and 5.x version check
|
-- translation support and 5.x version check
|
||||||
local S, is_50, is_53
|
local S, is_50, is_53
|
||||||
if minetest.get_translator ~= nil then
|
if minetest.get_translator ~= nil then
|
||||||
S = minetest.get_translator("boats") -- 5.x translation function
|
S = minetest.get_translator("boats") -- 5.x translation function
|
||||||
is_50 = true
|
|
||||||
is_53 = false
|
|
||||||
else
|
else
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
dofile(minetest.get_modpath("intllib") .. "/init.lua")
|
dofile(minetest.get_modpath("intllib") .. "/init.lua")
|
||||||
@ -25,7 +25,8 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- check for minetest 5.x compatibility
|
-- check for minetest 5.x compatibility
|
||||||
is_53 = minetest.has_feature("direct_velocity_on_players") or minetest.has_feature("is_creative_enabled") or false
|
is_50 = has_feature("httpfetch_binary_data")
|
||||||
|
is_53 = minetest.has_feature("direct_velocity_on_players") or minetest.has_feature("is_creative_enabled") of false
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Helper functions
|
-- Helper functions
|
||||||
@ -94,7 +95,7 @@ function boat.on_rightclick(self, clicker)
|
|||||||
if self.driver and name == self.driver then
|
if self.driver and name == self.driver then
|
||||||
-- Cleanup happens in boat.on_detach_child
|
-- Cleanup happens in boat.on_detach_child
|
||||||
clicker:set_detach()
|
clicker:set_detach()
|
||||||
if is_50 then
|
if is_pa then
|
||||||
player_api.set_animation(clicker, "stand", 30)
|
player_api.set_animation(clicker, "stand", 30)
|
||||||
else
|
else
|
||||||
default.player_set_animation(clicker, "stand", 30)
|
default.player_set_animation(clicker, "stand", 30)
|
||||||
@ -109,14 +110,14 @@ function boat.on_rightclick(self, clicker)
|
|||||||
{x = 0.5, y = 1, z = -3}, {x = 0, y = 0, z = 0})
|
{x = 0.5, y = 1, z = -3}, {x = 0, y = 0, z = 0})
|
||||||
|
|
||||||
self.driver = name
|
self.driver = name
|
||||||
if is_50 then
|
if is_pa then
|
||||||
player_api.player_attached[name] = true
|
player_api.player_attached[name] = true
|
||||||
else
|
else
|
||||||
default.player_attached[name] = true
|
default.player_attached[name] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.after(0.2, function()
|
minetest.after(0.2, function()
|
||||||
if is_50 then
|
if is_pa then
|
||||||
player_api.set_animation(clicker, "sit", 30)
|
player_api.set_animation(clicker, "sit", 30)
|
||||||
else
|
else
|
||||||
default.player_set_animation(clicker, "sit", 30)
|
default.player_set_animation(clicker, "sit", 30)
|
||||||
@ -130,7 +131,7 @@ end
|
|||||||
-- If driver leaves server while driving boat
|
-- If driver leaves server while driving boat
|
||||||
function boat.on_detach_child(self, child)
|
function boat.on_detach_child(self, child)
|
||||||
if child and child:get_player_name() == self.driver then
|
if child and child:get_player_name() == self.driver then
|
||||||
if is_50 then
|
if is_pa then
|
||||||
player_api.player_attached[child:get_player_name()] = false
|
player_api.player_attached[child:get_player_name()] = false
|
||||||
else
|
else
|
||||||
default.player_attached[child:get_player_name()] = false
|
default.player_attached[child:get_player_name()] = false
|
||||||
@ -164,7 +165,7 @@ function boat.on_punch(self, puncher)
|
|||||||
if self.driver and name == self.driver then
|
if self.driver and name == self.driver then
|
||||||
self.driver = nil
|
self.driver = nil
|
||||||
puncher:set_detach()
|
puncher:set_detach()
|
||||||
if is_50 then
|
if is_pa then
|
||||||
player_api.player_attached[name] = false
|
player_api.player_attached[name] = false
|
||||||
else
|
else
|
||||||
default.player_attached[name] = false
|
default.player_attached[name] = false
|
||||||
@ -309,7 +310,7 @@ function boat.on_step(self, dtime)
|
|||||||
local driver_objref = minetest.get_player_by_name(self.driver)
|
local driver_objref = minetest.get_player_by_name(self.driver)
|
||||||
default.player_attached[self.driver] = false
|
default.player_attached[self.driver] = false
|
||||||
driver_objref:set_detach()
|
driver_objref:set_detach()
|
||||||
if is_50 then
|
if is_pa then
|
||||||
player_api.set_animation(driver_objref, "stand" , 30)
|
player_api.set_animation(driver_objref, "stand" , 30)
|
||||||
else
|
else
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user