Basic garbage
This commit is contained in:
parent
eb7a27babb
commit
270aee8158
@ -6,6 +6,10 @@ namespace playerModel {
|
||||
const setPlayerBoneAnimation = animationStation.setPlayerBoneAnimation;
|
||||
const setPlayerBoneAnimationSpeed = animationStation.setPlayerBoneAnimationSpeed;
|
||||
const create3d = vector.create3d;
|
||||
const Keys = _Keys;
|
||||
type Keys = _Keys;
|
||||
const isKeyDown = controls.isKeyDown;
|
||||
|
||||
/*
|
||||
character.b3d bone documentation, tree view.
|
||||
--------------------------------------------
|
||||
@ -20,7 +24,6 @@ namespace playerModel {
|
||||
|
||||
registerAnimation("character.b3d",
|
||||
"walk",
|
||||
|
||||
new Map([
|
||||
["Arm_Left", {
|
||||
start: {
|
||||
@ -74,6 +77,24 @@ namespace playerModel {
|
||||
])
|
||||
);
|
||||
|
||||
registerAnimation("character.b3d",
|
||||
"mine",
|
||||
new Map([
|
||||
["Arm_Right", {
|
||||
start: {
|
||||
translation: create3d(0, 0, 0),
|
||||
rotation: create3d((math.pi / 2) + (math.pi / 4), 0, 0),
|
||||
scale: create3d(0, 0, 0)
|
||||
},
|
||||
end: {
|
||||
translation: create3d(0, 0, 0),
|
||||
rotation: create3d((math.pi / 2) - (math.pi / 4), math.pi / 8, 0),
|
||||
scale: create3d(0, 0, 0)
|
||||
}
|
||||
}],
|
||||
])
|
||||
);
|
||||
|
||||
registerBones("character.b3d", new Set([
|
||||
"Body",
|
||||
"Head",
|
||||
@ -104,16 +125,36 @@ namespace playerModel {
|
||||
for (const player of minetest.get_connected_players()) {
|
||||
let vel = player.get_velocity();
|
||||
let speed = vector.length(vel);
|
||||
const name = player.get_player_name();
|
||||
// const name = player.get_player_name();
|
||||
|
||||
let diggingTrigger = false;
|
||||
|
||||
if (isKeyDown(player, Keys.dig)) {
|
||||
setPlayerBoneAnimation(player, "Arm_Left", "");
|
||||
setPlayerBoneAnimation(player, "Arm_Right", "mine");
|
||||
setPlayerBoneAnimationSpeed(player, "Arm_Right", 7);
|
||||
diggingTrigger = true;
|
||||
}
|
||||
|
||||
if (speed == 0) {
|
||||
setPlayerBoneAnimation(player, "Leg_Left", "");
|
||||
setPlayerBoneAnimation(player, "Leg_Right", "");
|
||||
if (!diggingTrigger) {
|
||||
setPlayerBoneAnimation(player, "Arm_Left", "");
|
||||
setPlayerBoneAnimation(player, "Arm_Right", "");
|
||||
}
|
||||
} else {
|
||||
setPlayerBoneAnimation(player, "Leg_Left", "walk");
|
||||
setPlayerBoneAnimation(player, "Leg_Right", "walk");
|
||||
setPlayerBoneAnimationSpeed(player, "Leg_Left", speed);
|
||||
setPlayerBoneAnimationSpeed(player, "Leg_Right", speed);
|
||||
if (!diggingTrigger) {
|
||||
setPlayerBoneAnimation(player, "Arm_Left", "walk");
|
||||
setPlayerBoneAnimation(player, "Arm_Right", "walk");
|
||||
setPlayerBoneAnimationSpeed(player, "Arm_Right", speed);
|
||||
setPlayerBoneAnimationSpeed(player, "Arm_Left", speed);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
name = player_model
|
||||
description = Forgotten lands player model library.
|
||||
depends = utility, types, anti_complain
|
||||
depends = utility, types, anti_complain, controls
|
||||
optional_depends =
|
Loading…
x
Reference in New Issue
Block a user