Initial Upload
parent
46161b3fb4
commit
98b5aa1f3f
|
@ -0,0 +1,8 @@
|
|||
[mod] 3d_armor_flyswim
|
||||
=======================
|
||||
Licence code LGPL v2.1
|
||||
Cape Textures - CC0
|
||||
Blender Model/B3Ds as per base MTG - CC BY-SA 3.0
|
||||
"3d_armor_trans.png" CC-BY-SA 3.0
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
_, __, _, __, _, _ _, __,
|
||||
~_) | \ / \ |_) |\/| / \ |_)
|
||||
_) |_/ |~| | \ | | \ / | \
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
__, _, , _ _ _, _ _, _, _ _ _ _, _ _, _ _ _, _ _,
|
||||
|_ | \ | | |\ | / _ (_ | | | |\/| |\/| | |\ | / _
|
||||
| |_, \| | | \| \ / , ) |/\| | | | | | | | \| \ /
|
||||
~ ~ ~ ) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
~'
|
||||
|
||||
---------------------------
|
||||
## Information
|
||||
---------------------------
|
||||
This is a small utility mod which adds some new animations to the default 3d_armor animations, the new animations are:
|
||||
|
||||
| | Start | End | FPS |
|
||||
|---------|-------|-----|-----|
|
||||
|Swim | 246 | 279 | 30 |
|
||||
|Swim Atk | 285 | 318 | 30 |
|
||||
|Fly | 325 | 334 | 30 |
|
||||
|Fly Atk | 340 | 349 | 30 |
|
||||
|Fall | 355 | 364 | 30 |
|
||||
|Fall Atk | 365 | 374 | 30 |
|
||||
|
||||
|
||||
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 version 5.3 however it should work with any 5.X version assuming 3d_armor makes no radical changes,
|
||||
without 3d_armor this mod does nothing.
|
||||
|
||||
Don't forget to delete "i_example_cape.lua" before using in a game, although I didn't create a reciepe for it so you would need creative/give access to get one.
|
||||
|
||||
![auroch render](https://github.com/sirrobzeroone/Animal_Models/blob/main/Auroch%20(Cow%20Ancestor)/Auroch_family_picture.png)
|
||||
|
||||
---------------------------
|
||||
## Why are Capes Included?
|
||||
---------------------------
|
||||
I found it best to keep capes included in this mod with the option to enable or disable. This is because capes needs the new b3d player model so they
|
||||
are displayed as part of armor instead of part of the player. However as I didn't want to force anyone into using capes as armor items I created a second
|
||||
optional player model which keeps capes with the player textures.
|
||||
|
||||
The above would create a circular dependancy if capes was it's own mod. Capes would have a dependency on Fly/Swim but Fly/Swim needs to know if Capes mod
|
||||
is present so as to load the correct b3d player model.
|
||||
|
||||
Given the above I have kept capes inside this mod with an option to enable/disable it under Settings>>All Settings>>Mods>>3d_armor_flyswim by default capes are set to Enabled/true
|
||||
|
||||
Capes provide minimal additional armor, about half as much as wooden boots by default.
|
||||
|
||||
---------------------------
|
||||
## What nodes are set as Flyable/Swimmable?
|
||||
---------------------------
|
||||
###Flyable
|
||||
"air"
|
||||
"default:cloud"
|
||||
|
||||
### Swimmable
|
||||
"default:water_source"
|
||||
"default:water_flowing"
|
||||
"default:river_water_source"
|
||||
"default:river_water_flowing"
|
||||
"default:lava_source"
|
||||
"default:lava_flowing"
|
||||
|
||||
Given the way the checks are done there is no need to remove these names if they don't exist in your game/world, simply make sure to add the
|
||||
flyable and swimmable blocks for your game/world.
|
||||
|
||||
---------------------------
|
||||
## How to add more Flyable/Swimmable Node Types?
|
||||
---------------------------
|
||||
To add additional nodes that are swimmable or flyable either add there names directly to "i_nodes_fly_swim.lua"
|
||||
or if I've written them correctly you should be able to use these directly in your mod:
|
||||
|
||||
### For flyable
|
||||
armor_sf.add_flyable("modname:nodename")
|
||||
|
||||
eg armor_sf.add_flyable("gases:hydrogen")
|
||||
|
||||
### For Swimmable
|
||||
armor_sf.add_swimmable("modname:nodename")
|
||||
|
||||
eg armor_sf.add_swimmable("color_water:green_water")
|
|
@ -0,0 +1 @@
|
|||
Addition of Fly and Swimming animations to 3d_armour base character model, used when swimming and flyinf or falling avaliable for other mods to make use of.
|
|
@ -0,0 +1,22 @@
|
|||
-------------------------------------------
|
||||
-- Example Cape --
|
||||
-------------------------------------------
|
||||
armor:register_armor("3d_armor_flyswim:demo_cape", {
|
||||
description = "Someones Cape",
|
||||
inventory_image = "3d_armor_flyswim_demo_cape_inv.png",
|
||||
groups = {armor_capes=1, physics_speed=.5, armor_use=1000},
|
||||
armor_groups = {fleshy=5},
|
||||
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||
on_equip = function(player)
|
||||
local privs = minetest.get_player_privs(player:get_player_name())
|
||||
privs.fly = true
|
||||
minetest.chat_send_player(player:get_player_name(),tostring(privs.fly))
|
||||
minetest.set_player_privs(player:get_player_name(), privs)
|
||||
end,
|
||||
|
||||
on_unequip = function(player)
|
||||
local privs = minetest.get_player_privs(player:get_player_name())
|
||||
privs.fly = nil
|
||||
minetest.set_player_privs(player:get_player_name(), privs)
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,46 @@
|
|||
------------------------------------------------------------------
|
||||
-- ___________ __ .__ --
|
||||
-- \_ _____/_ __ ____ _____/ |_|__| ____ ____ ______ --
|
||||
-- | __)| | \/ \_/ ___\ __\ |/ _ \ / \ / ___/ --
|
||||
-- | \ | | / | \ \___| | | ( <_> ) | \\___ \ --
|
||||
-- \___ / |____/|___| /\___ >__| |__|\____/|___| /____ > --
|
||||
-- \/ \/ \/ \/ \/ --
|
||||
------------------------------------------------------------------
|
||||
|
||||
armor_sf={}
|
||||
----------------------------
|
||||
-- add swimmable block --
|
||||
----------------------------
|
||||
armor_sf.add_swimmable = function(name)
|
||||
table.insert(swimmable, name)
|
||||
end
|
||||
|
||||
----------------------------
|
||||
-- add flyable block --
|
||||
----------------------------
|
||||
armor_sf.add_flyable = function(name)
|
||||
table.insert(flyable, name)
|
||||
end
|
||||
|
||||
----------------------------
|
||||
-- Check node fly/swim --
|
||||
----------------------------
|
||||
function node_fsable(n_name,type)
|
||||
local compare = flyable
|
||||
if type == "s" then
|
||||
compare = swimmable
|
||||
end
|
||||
|
||||
for k,v in ipairs(compare) do
|
||||
if n_name == v then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
--------------------------------
|
||||
-- Initial swimmable blocks --
|
||||
--------------------------------
|
||||
swimmable = {"default:water_source",
|
||||
"default:water_flowing",
|
||||
"default:river_water_source",
|
||||
"default:river_water_flowing",
|
||||
"default:lava_source",
|
||||
"default:lava_flowing"
|
||||
}
|
||||
|
||||
--------------------------------
|
||||
-- Initial flyable blocks --
|
||||
--------------------------------
|
||||
flyable = {"air",
|
||||
"default:cloud"
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
--------------------------------------------------------------------------------------
|
||||
-- ________ .___ _____ --
|
||||
-- \_____ \ __| _/ / _ \_______ _____ ___________ --
|
||||
-- _(__ < / __ | / /_\ \_ __ \/ \ / _ \_ __ \ --
|
||||
-- / \/ /_/ | / | \ | \/ Y Y ( <_> ) | \/ --
|
||||
-- /______ /\____ | \____|__ /__| |__|_| /\____/|__| --
|
||||
-- \/ \/ \/ \/ --
|
||||
-- ___________.__ .___ _________ .__ --
|
||||
-- \_ _____/| | ___.__. _____ ____ __| _/ / _____/_ _ _|__| _____ --
|
||||
-- | __) | |< | | \__ \ / \ / __ | \_____ \\ \/ \/ / |/ \ --
|
||||
-- | \ | |_\___ | / __ \| | \/ /_/ | / \\ /| | Y Y \ --
|
||||
-- \___ / |____/ ____| (____ /___| /\____ | /_______ / \/\_/ |__|__|_| / --
|
||||
-- \/ \/ \/ \/ \/ \/ \/ --
|
||||
-- --
|
||||
-- Also makes Capes a 3d Armor, armor item --
|
||||
--------------------------------------------------------------------------------------
|
||||
-- by Sirrobzeroone --
|
||||
-- Licence code LGPL v2.1 --
|
||||
-- Cape Textures - CC0 --
|
||||
-- Blender Model/B3Ds as per base MTG - CC BY-SA 3.0 --
|
||||
-- except "3d_armor_trans.png" CC-BY-SA 3.0 --
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
----------------------------
|
||||
-- Settings --
|
||||
----------------------------
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local add_capes = minetest.setting_getbool("capes_add_to_3darmor")
|
||||
|
||||
if add_capes == nil then -- To cover mod.conf/settings update issue
|
||||
add_capes = true
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- Adding new armor item for Capes --
|
||||
-------------------------------------
|
||||
if add_capes == true then
|
||||
if minetest.global_exists("armor") and armor.elements then
|
||||
table.insert(armor.elements, "capes")
|
||||
local mult = armor.config.level_multiplier or 1
|
||||
armor.config.level_multiplier = mult * 0.2
|
||||
end
|
||||
end
|
||||
|
||||
----------------------------
|
||||
-- Initiate files --
|
||||
----------------------------
|
||||
dofile(modpath .. "/i_nodes_fly_swim.lua") -- Initial swimmable/flyable nodes
|
||||
dofile(modpath .. "/i_functions.lua") -- Functions
|
||||
|
||||
if add_capes == true then
|
||||
dofile(modpath .. "/i_example_cape.lua") -- Example Cape
|
||||
end
|
||||
-------------------------------------
|
||||
-- Set Player model to use --
|
||||
-------------------------------------
|
||||
local player_mod = "3d_armor_character_sfc.b3d" -- Swim, Fly and Capes
|
||||
|
||||
if add_capes ~= true then
|
||||
player_mod = "3d_armor_character_sf.b3d" -- Swim Fly
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- Player model with Swim/Fly/Capes --
|
||||
--------------------------------------
|
||||
|
||||
default.player_register_model(player_mod, {
|
||||
animation_speed = 30,
|
||||
textures = {
|
||||
armor.default_skin..".png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png",
|
||||
},
|
||||
animations = {
|
||||
stand = {x=0, y=79},
|
||||
lay = {x=162, y=166},
|
||||
walk = {x=168, y=187},
|
||||
mine = {x=189, y=198},
|
||||
walk_mine = {x=200, y=219},
|
||||
sit = {x=81, y=160},
|
||||
swim = {x=246,y=279},
|
||||
swim_atk = {x=285, y=318},
|
||||
fly = {x=325, y=334},
|
||||
fly_atk = {x=340, y=349},
|
||||
fall = {x=355, y=364},
|
||||
fall_atk = {x=365, y=374},
|
||||
},
|
||||
})
|
||||
|
||||
----------------------------------------
|
||||
-- Setting model on join and clearing --
|
||||
-- local_animations --
|
||||
----------------------------------------
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player_api.set_model(player,player_mod)
|
||||
player_api.player_attached[player:get_player_name()] = false
|
||||
player:set_local_animation({},{},{},{},30)
|
||||
|
||||
end)
|
||||
|
||||
------------------------------------------------
|
||||
-- Global step to check if we player meets --
|
||||
-- Conditions for Swimming or Flying(falling) --
|
||||
------------------------------------------------
|
||||
minetest.register_globalstep(function()
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local controls = player:get_player_control() -- Get button presses
|
||||
local ani_spd = 30 -- Default animation speed
|
||||
local name = player:get_player_name()
|
||||
local attached_to = player:get_attach() -- If the players attached to something we need to know
|
||||
local privs = minetest.get_player_privs(player:get_player_name())-- Privs crude attempt to differentiate potenital flying from falling
|
||||
local pos = player:get_pos()
|
||||
local node = minetest.get_node(pos) -- Node player is in (lower legs)
|
||||
local node_b = minetest.get_node({x=pos.x,y=pos.y -1,z=pos.z}) -- Node below players feet
|
||||
local node_bb = minetest.get_node({x=pos.x,y=pos.y -2,z=pos.z}) -- Next node down
|
||||
local node_bbb = minetest.get_node({x=pos.x,y=pos.y -3,z=pos.z}) -- Next node down (falling starts later)
|
||||
local node_bbbb = minetest.get_node({x=pos.x,y=pos.y -4,z=pos.z})-- Next node down (falling starts later)
|
||||
|
||||
if (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_fsable(node.name,"s") == true and -- Node player standing in must be swimmable
|
||||
node_fsable(node_b.name,"s") == true then -- Node below must be swimmable
|
||||
player_api.set_animation(player,"swim_atk",ani_spd) -- Set to swimming attack animation
|
||||
|
||||
elseif (controls.up or controls.down or
|
||||
controls.left or controls.right) and -- Must be moving in a direction
|
||||
node_fsable(node.name,"s") == true and -- Node player standing in must be swimmable
|
||||
node_fsable(node_b.name,"s") == true then -- Node below must be swimmable
|
||||
player_api.set_animation(player, "swim",ani_spd) -- Set to swimming animation
|
||||
|
||||
elseif not attached_to and privs.fly == true then -- If player attached to something dont do flying animation
|
||||
if(controls.up or controls.down or -- must also have fly privs or we should definitly be falling.
|
||||
controls.left or controls.right) and -- Must be moving in a direction
|
||||
(controls.LMB or controls.RMB) and -- Must be swinging
|
||||
node_fsable(node.name,"a") == true and -- Node player is standing in must be flyable
|
||||
node_fsable(node_b.name,"a") == true and -- node below must be flyable
|
||||
node_fsable(node_bb.name,"a") == true then -- node 2 down must be flyable
|
||||
player_api.set_animation(player, "fly_atk",ani_spd) -- Show fly attack animation
|
||||
|
||||
elseif(controls.up or controls.down or
|
||||
controls.left or controls.right) and -- Must be moving in a direction
|
||||
node_fsable(node.name,"a") == true and -- Node player is standing in must be flyable
|
||||
node_fsable(node_b.name,"a") == true and -- node below must be flyable
|
||||
node_fsable(node_bb.name,"a") == true then -- node 2 down must be flyable
|
||||
player_api.set_animation(player, "fly",ani_spd) -- Show fly animation or swan dive if falling
|
||||
end
|
||||
|
||||
elseif not attached_to then -- If player attached to something dont do falling animation
|
||||
if(controls.LMB or controls.RMB) and -- Must be swinging
|
||||
node_fsable(node.name,"a") == true and -- Node player is standing in must be flyable/fallable
|
||||
node_fsable(node_b.name,"a") == true and -- node below must be flyable/fallable
|
||||
node_fsable(node_bb.name,"a") == true and -- node 2 down must be flyable/fallable
|
||||
node_fsable(node_bbb.name,"a") == true and -- node 3 down must be flyable/fallable
|
||||
node_fsable(node_bbbb.name,"a") == true then -- node 4 down must be flyable/fallable
|
||||
player_api.set_animation(player, "fall_atk",ani_spd) -- falling and flailing around
|
||||
|
||||
elseif node_fsable(node.name,"a") == true and -- Node player is standing in must be flyable/fallable
|
||||
node_fsable(node_b.name,"a") == true and -- node below must be flyable/fallable
|
||||
node_fsable(node_bb.name,"a") == true and -- node 2 down must be flyable/fallable
|
||||
node_fsable(node_bbb.name,"a") == true and -- node 3 down must be flyable/fallable
|
||||
node_fsable(node_bbbb.name,"a") == true then -- node 4 down must be flyable/fallable
|
||||
player_api.set_animation(player, "fall",ani_spd) -- falling
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
name = 3d_armor_flyswim
|
||||
depends = 3d_armor
|
||||
description = Adds Flying and Swimming animatiosn to base character model for 3d_armor
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 308 KiB |
|
@ -0,0 +1,3 @@
|
|||
# Make capes part of 3d Armor when enabled
|
||||
capes_add_to_3darmor (Add Capes to 3d Armor) bool true
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 533 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 274 B |
Binary file not shown.
Loading…
Reference in New Issue