aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-03-04 10:09:35 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-03-05 09:45:58 +0100
commit2fd31f525e28f88ef84179be4735da5115a0a0ee (patch)
tree3ee4a7aa91e8fd1c074bfdf90b948478eddc73e1 /src/script/common
parent0d94a5e581d8338cb02af8a250623617f1cb6b7d (diff)
downloadminetest-wield_animation.tar.xz
Different animations for different actionswield_animation
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_content.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 585e664fd..df8efb189 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -63,9 +63,17 @@ void read_item_definition(lua_State* L, int index,
getstringfield(L, index, "inventory_overlay", def.inventory_overlay);
getstringfield(L, index, "wield_image", def.wield_image);
getstringfield(L, index, "wield_overlay", def.wield_overlay);
- getstringfield(L, index, "wield_animation", def.wield_animation);
getstringfield(L, index, "palette", def.palette_image);
+ lua_getfield(L, index, "wield_animations");
+ if (lua_istable(L, -1)) {
+ getstringfield(L, -1, "base", def.wield_animation_base);
+ getstringfield(L, -1, "dig", def.wield_animation_dig);
+ getstringfield(L, -1, "place", def.wield_animation_place);
+ getstringfield(L, -1, "activate", def.wield_animation_activate);
+ }
+ lua_pop(L, 1);
+
// Read item color.
lua_getfield(L, index, "color");
read_color(L, -1, &def.color);