Configuration
parent
3c66406bdc
commit
e44571d5ae
|
@ -0,0 +1,34 @@
|
|||
local angle = { type = "number", range = { -180, 180 } }
|
||||
local range = {
|
||||
type = "table",
|
||||
children = { angle, angle },
|
||||
func = function(range)
|
||||
if range[2] < range[1] then return "First range value is not <= second range value" end
|
||||
end
|
||||
}
|
||||
local model = {
|
||||
type = "table",
|
||||
children = {
|
||||
body = {
|
||||
type = "table",
|
||||
children = { turn_speed = { type = "number", range = { 0, 1e3 } } }
|
||||
},
|
||||
head = {
|
||||
type = "table",
|
||||
children = {
|
||||
pitch = range,
|
||||
yaw = range,
|
||||
yaw_restricted = range,
|
||||
yaw_restriction = angle
|
||||
}
|
||||
},
|
||||
arm_right = {
|
||||
type = "table",
|
||||
children = { radius = angle, speed = { type = "number", range = { 0, 1e4 } }, yaw = range }
|
||||
}
|
||||
}
|
||||
}
|
||||
conf = modlib.conf.import(minetest.get_current_modname(), {
|
||||
default = model,
|
||||
models = { type = "table", keys = { type = "string" }, values = model }
|
||||
})
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"body": { "turn_speed": 0.2 },
|
||||
"head": {
|
||||
"pitch": [ -60, 80 ],
|
||||
"yaw": [ -90, 90 ],
|
||||
"yaw_restricted": [ 0, 45 ],
|
||||
"yaw_restriction": 60
|
||||
},
|
||||
"arm_right": { "radius": 10, "speed": 1e3, "yaw": [ -30, 160 ] },
|
||||
"models": {}
|
||||
}
|
1
init.lua
1
init.lua
|
@ -3,5 +3,6 @@ local namespace = create_namespace()
|
|||
local quaternion = setmetatable({}, {__index = namespace})
|
||||
include_env(get_resource"quaternion.lua", quaternion)
|
||||
namespace.quaternion = quaternion
|
||||
extend"conf"
|
||||
extend"importer"
|
||||
extend"main"
|
8
main.lua
8
main.lua
|
@ -89,7 +89,7 @@ local function normalize_rotation(euler_rotation)
|
|||
return vector.apply(euler_rotation, function(x) return (x % 360) - 180 end)
|
||||
end
|
||||
|
||||
local conf = {
|
||||
--[[local conf = {
|
||||
body = {
|
||||
turn_speed = 1/5
|
||||
},
|
||||
|
@ -104,12 +104,14 @@ local conf = {
|
|||
speed = 1000,
|
||||
yaw = {-30, 160}
|
||||
}
|
||||
}
|
||||
}]]
|
||||
local function handle_player_animations(dtime, player)
|
||||
local modeldata = modeldata[player:get_properties().mesh]
|
||||
local mesh = player:get_properties().mesh
|
||||
local modeldata = modeldata[mesh]
|
||||
if not modeldata then
|
||||
return
|
||||
end
|
||||
local conf = conf.models[mesh] or conf
|
||||
local name = player:get_player_name()
|
||||
local range, frame_speed, frame_blend, frame_loop = player:get_animation()
|
||||
disable_animation(player)
|
||||
|
|
Loading…
Reference in New Issue