Merge branch 'master' of yunohost.local:minetest-mods/playeranim into nalc-1.2-dev

This commit is contained in:
Sys Quatre 2019-12-22 14:40:00 +01:00
commit e293ee8ece
4 changed files with 16 additions and 51 deletions

View File

@ -12,15 +12,8 @@ Created by [Rui](https://github.com/Rui-Minetest), this document was written by
### Version of player model
Player models supported by this mod:
- `MTG_4_Jun_2017` (minetest_game after 4 Jun 2017, 0.4.16)
- `MTG_4_Nov_2017` (minetest_game after 4 Nov 2017, 0.5.0)
As there is no automatic way to determine which version is used, this must be configured with advanced settings menu, or by manually editing `playeranim.model_version` entry in minetest.conf.
The default value is `MTG_4_Jun_2017`.
Symptoms of having configured the incorrect player model:
- In rest, arms are raised up, and are either detached from the body, or are too close to the body
- Cape (if visible) points upward
- minetest_game after 4 Jun 2017, Minetest 0.4.16
- minetest_game after 4 Nov 2017, Minetest 0.5.0-dev
### The delay of sideways body rotation

View File

@ -1,3 +1,8 @@
if not minetest.settings then
error("Mod playeranim requires Minetest 0.4.16 or newer")
end
local ANIMATION_SPEED = tonumber(minetest.settings:get("playeranim.animation_speed")) or 2.4
local ANIMATION_SPEED_SNEAK = tonumber(minetest.settings:get("playeranim.animation_speed_sneak")) or 0.8
local BODY_ROTATION_DELAY = math.max(math.floor(tonumber(minetest.settings:get("playeranim.body_rotation_delay")) or 7), 1)
@ -9,7 +14,8 @@ local BONE_POSITION, BONE_ROTATION = (function()
return dofile(modpath .. "/model.lua")
end)()
local get_animation = minetest.global_exists("player_api") and player_api.get_animation or default.player_get_animation
local get_animation = minetest.global_exists("player_api")
and player_api.get_animation or default.player_get_animation
if not get_animation then
error("player_api.get_animation or default.player_get_animation is not found")
end

View File

@ -7,22 +7,8 @@ local RARM = "Arm_Right"
local LLEG = "Leg_Left"
local RLEG = "Leg_Right"
-- Version of player model
local DEFAULT_PLAYER_MODEL_VERSION = "MTG_4_Jun_2017"
local VALID_PLAYER_MODEL_VERSIONS = {
MTG_4_Jun_2017 = true,
MTG_4_Nov_2017 = true,
}
local LEGACY_PLAYER_MODEL_VERSIONS = {
default_character_v1 = true,
default_character_v2 = true,
default_character_v3 = true,
}
local BONE_POSITIONS = {
MTG_4_Jun_2017 = {
MTG_0_4_x = {
[BODY] = {x = 0, y = -3.5, z = 0},
[HEAD] = {x = 0, y = 6.5, z = 0},
[CAPE] = {x = 0, y = 6.5, z = 1.2},
@ -34,7 +20,7 @@ local BONE_POSITIONS = {
body_sit = {x = 0, y = -5.5, z = 0},
body_lay = {x = 0, y = -5.5, z = 0},
},
MTG_4_Nov_2017 = {
MTG_5_0_x = {
[BODY] = {x = 0, y = 6.25, z = 0},
[HEAD] = {x = 0, y = 6.5, z = 0},
[CAPE] = {x = 0, y = 6.5, z = 1.2},
@ -49,7 +35,7 @@ local BONE_POSITIONS = {
}
local BONE_ROTATIONS = {
MTG_4_Jun_2017 = {
MTG_0_4_x = {
[BODY] = {x = 0, y = 0, z = 0},
[HEAD] = {x = 0, y = 0, z = 0},
[CAPE] = {x = 0, y = 0, z = 0},
@ -61,7 +47,7 @@ local BONE_ROTATIONS = {
body_sit = {x = 0, y = 0, z = 0},
body_lay = {x = 270, y = 0, z = 0},
},
MTG_4_Nov_2017 = {
MTG_5_0_x = {
[BODY] = {x = 0, y = 0, z = 0},
[HEAD] = {x = 0, y = 0, z = 0},
[CAPE] = {x = 0, y = 0, z = 0},
@ -75,23 +61,10 @@ local BONE_ROTATIONS = {
},
}
local PLAYER_MODEL_VERSION = (function()
local version = minetest.settings:get("playeranim.model_version")
if version == nil or version == "" then
version = DEFAULT_PLAYER_MODEL_VERSION
end
local model = minetest.global_exists("player_api") and "MTG_5_0_x" or "MTG_0_4_x"
if LEGACY_PLAYER_MODEL_VERSIONS[version] then
error("The model version '" .. version .. "' is no longer suppported")
elseif not VALID_PLAYER_MODEL_VERSIONS[version] then
error("Invalid value for playeranim.model_version in minetest.conf: " .. version)
end
return version
end)()
local BONE_POSITION = BONE_POSITIONS[PLAYER_MODEL_VERSION]
local BONE_ROTATION = BONE_ROTATIONS[PLAYER_MODEL_VERSION]
local BONE_POSITION = BONE_POSITIONS[model]
local BONE_ROTATION = BONE_ROTATIONS[model]
if not BONE_POSITION or not BONE_ROTATION then
error("Internal error: invalid player_model_version: " .. PLAYER_MODEL_VERSION)
end

View File

@ -1,10 +1,3 @@
# Version of player model.
#
# Player models supported by this mod:
# . -- `MTG_4_Jun_2017` (minetest_game after 4 Jun 2017, 0.4.16)
# . -- `MTG_4_Nov_2017` (minetest_game after 4 Nov 2017, 0.5.0)
playeranim.model_version (Version of player model) enum MTG_4_Jun_2017 MTG_4_Jun_2017,MTG_4_Nov_2017
# The number of frame delay of sideways body rotation. (between 1 and 20).
playeranim.body_rotation_delay (The delay of sideways body rotation) int 7 1 20