diff --git a/README.MD b/README.MD index 944467a..51a31ce 100644 --- a/README.MD +++ b/README.MD @@ -29,10 +29,12 @@ This is a small utility mod which adds some new animations to the default 3d_arm I have done my best to trigger the animations in the correct circumstances when viewing the player model in 3rd person. -I have only tested this against minetest versions 5.0 to 5.3 +I have only tested this against minetest versions 5.0 to 5.5 without 3d_armor and its required mods this mod does nothing. +Works with simple_skins - https://forum.minetest.net/viewtopic.php?f=11&t=9100 + Don't forget to disable **example_cape** before using in a game, although I didn't create a reciepe for it so you would need creative/give access to get one. ![swim animation](https://github.com/sirrobzeroone/3d_armor_flyswim/blob/main/swimming_animated.gif) diff --git a/i_functions.lua b/i_functions.lua index 62d30b0..a27b250 100644 --- a/i_functions.lua +++ b/i_functions.lua @@ -18,8 +18,14 @@ function node_fsable(pos,num,type) local draw_tl = {"liquid","flowingliquid"} local compare = draw_ta local node = minetest.get_node({x=pos.x,y=pos.y-(num-1),z=pos.z}) - local n_draw = minetest.registered_nodes[node.name].drawtype - + local n_draw + + if minetest.registered_nodes[node.name] then + n_draw = minetest.registered_nodes[node.name].drawtype + else + n_draw = "normal" + end + if type == "s" then compare = draw_tl end @@ -54,7 +60,14 @@ local compare = draw_ta local n_draw for k,v in pairs(nodes) do - n_draw = minetest.registered_nodes[v.name].drawtype + local n_draw + + if minetest.registered_nodes[v.name] then + n_draw = minetest.registered_nodes[v.name].drawtype + else + n_draw = "normal" + end + for k2,v2 in ipairs(compare) do if n_draw == v2 then table.insert(result,"t") diff --git a/init.lua b/init.lua index 96b4420..097da0a 100644 --- a/init.lua +++ b/init.lua @@ -244,15 +244,17 @@ minetest.register_globalstep(function() ----------------------------- -- Swim Cases -- ----------------------------- - elseif swim_anim == true and -- Swim animation setting must be true + elseif swim_anim == true and -- Swim animation setting must be true + not attached_to and -- If player attached to something dont do animation (controls.up or controls.down or controls.left or controls.right) and -- Must be moving in a direction (controls.LMB or controls.RMB) and -- Must be swinging - node_down_fsable(pos,2,"s") == true then -- Node player standing in and 1 below must be swimmable + node_down_fsable(pos,2,"s") == true then -- Node player standing in and 1 below must be swimmable player_api.set_animation(player,"swim_atk",ani_spd) -- Set to swimming attack animation offset = 90 -- Offset for Headanim elseif swim_anim == true and -- Swim animation setting must be true + not attached_to and -- If player attached to something dont do animation (controls.up or controls.down or controls.left or controls.right) and -- Must be moving in a direction node_down_fsable(pos,2,"s") == true then -- Node player standing in and 1 below must be swimmable @@ -260,7 +262,8 @@ minetest.register_globalstep(function() offset = 90 -- Offset for Headanim - elseif swim_sneak == true and -- Swim sneak setting must be true + elseif swim_sneak == true and -- Swim sneak setting must be true + not attached_to and -- If player attached to something dont do animation controls.sneak == true and node_down_fsable(pos,1,"s") == true then -- Node player standing in swimmable player_api.set_animation(player, "swim",ani_spd) -- Set to swimming animation diff --git a/mod.conf b/mod.conf index 1aea5ce..17da116 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,6 @@ name = 3d_armor_flyswim +description = Adds Flying, Swimming, Crouching and Climbing animations to base character model for 3d_armor depends = 3d_armor -description = Adds Flying and Swimming animatiosn to base character model for 3d_armor +optional_depends = simple_skins +author = Sirrobzeroone +title = Add Fly, Swim, Crouch and Climb animations \ No newline at end of file