commit 41f60c96a0c0242d3f2a4d352cbb47306c85d1fc Author: Wuzzy Date: Sat Dec 19 21:56:22 2020 +0100 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d3892d --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Disable Fall Damage [`no_fall_damage`] +Version: 1.0.0 + +This mod disables fall damage completely. + +## Technical notes +This mod only works if no other mod overwrites the +`fall_damage_add_percent` group (unlikely). + +## License +This mod is licenced under the MIT License. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..9fb6d2d --- /dev/null +++ b/init.lua @@ -0,0 +1,14 @@ +-- Removing fall damage is done by overwriting the group +-- fall_damage_add_percent of all nodes. ]] +function remove_fall_damage() + for itemstring, def in pairs(minetest.registered_nodes) do + local groups = def.groups and table.copy(def.groups) + if groups then + groups.fall_damage_add_percent = -100 + -- Let's hack the node! + minetest.override_item(itemstring, { groups = groups }) + end + end +end + +minetest.register_on_mods_loaded(remove_fall_damage) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..ab41312 --- /dev/null +++ b/mod.conf @@ -0,0 +1,2 @@ +name = no_fall_damage +description = Disables fall damage.