diff --git a/.luacheckrc b/.luacheckrc index 88349af..6b769d6 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -18,6 +18,7 @@ read_globals = { -- deps "default", + "player_api", "minetest", "unified_inventory", "wardrobe", diff --git a/3d_armor/README.md b/3d_armor/README.md index 32fc07e..d36c9d4 100644 --- a/3d_armor/README.md +++ b/3d_armor/README.md @@ -254,7 +254,7 @@ The above allows armor to block/prevent new damage types but you also need to as ## Groups used by 3d_Armor 3d_armor has many default groups already registered, these are categorized under 4 main headings - **Elements:** armor_head, armor_torso, armor_legs, armor_feet - - **Attributes:** armor_heal, armor_fire, armor_water + - **Attributes:** armor_heal, armor_fire, armor_water, armor_feather - **Physics:** physics_jump, physics_speed, physics_gravity - **Durability:** armor_use, flammable @@ -334,6 +334,9 @@ The below Diamond chestplate has a 12% chance to completely block all damage (ar damage_groups = {cracky=2, snappy=1, choppy=1, level=3}, }) +#### Armor_feather +***"Armor_feather"*** will slow a player when falling. This only has one level or state, which is armor_feather=1 + ### Physics The physics attributes supported by 3d_armor are ***physics_jump, physics_speed and physics_gravity***. Although 3d_armor supports the use of this with no other mods it is recommended that the mod [player_monoids](https://forum.minetest.net/viewtopic.php?t=14895) is used to help with intermod compatability. diff --git a/3d_armor/api.lua b/3d_armor/api.lua index 112d208..d5a93d4 100644 --- a/3d_armor/api.lua +++ b/3d_armor/api.lua @@ -112,7 +112,7 @@ armor = { timer = 0, elements = {"head", "torso", "legs", "feet"}, physics = {"jump", "speed", "gravity"}, - attributes = {"heal", "fire", "water"}, + attributes = {"heal", "fire", "water", "feather"}, formspec = "image[2.5,0;2,4;armor_preview]".. default.gui_bg.. default.gui_bg_img.. @@ -183,6 +183,7 @@ armor.config = { water_protect = true, fire_protect = minetest.get_modpath("ethereal") ~= nil, fire_protect_torch = minetest.get_modpath("ethereal") ~= nil, + feather_fall = true, punch_damage = true, } diff --git a/3d_armor/init.lua b/3d_armor/init.lua index 4aac4bb..30dfc2b 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -299,7 +299,7 @@ end -- Armor Player Model -default.player_register_model("3d_armor_character.b3d", { +player_api.register_model("3d_armor_character.b3d", { animation_speed = 30, textures = { armor.default_skin..".png", @@ -440,6 +440,20 @@ end, true) minetest.register_globalstep(function(dtime) timer = timer + dtime + + if armor.config.feather_fall == true then + for _,player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() + if armor.def[name].feather > 0 then + local vel_y = player:get_velocity().y + if vel_y < 0 and vel_y < 3 then + vel_y = -(vel_y * 0.05) + player:add_velocity({x = 0, y = vel_y, z = 0}) + end + end + end + end + if timer <= armor.config.init_delay then return end diff --git a/3d_armor/mod.conf b/3d_armor/mod.conf index 9d2cc68..217c11b 100644 --- a/3d_armor/mod.conf +++ b/3d_armor/mod.conf @@ -1,4 +1,4 @@ name = 3d_armor -depends = default +depends = default, player_api optional_depends = player_monoids, armor_monoid, pova, fire, ethereal, bakedclay, moreores, nether description = Adds craftable armor that is visible to other players.