Skip to content

Commit

Permalink
Fixes #6 and #3
Browse files Browse the repository at this point in the history
Fixes for Issues #3 and #6
  • Loading branch information
sirrobzeroone committed Aug 3, 2022
1 parent f682854 commit 946406a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 16 additions & 3 deletions i_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
9 changes: 6 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,26 @@ 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
player_api.set_animation(player, "swim",ani_spd) -- Set to swimming animation
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
Expand Down
5 changes: 4 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 946406a

Please sign in to comment.