diff --git a/api.lua b/api.lua index ae98c33..92804c2 100644 --- a/api.lua +++ b/api.lua @@ -18,7 +18,7 @@ end mobs = { mod = "redo", - version = "20241012", + version = "20241020", spawning_mobs = {}, translate = S, invis = minetest.global_exists("invisibility") and invisibility or {}, @@ -2600,6 +2600,8 @@ end -- deal damage and effects when mob punched +local dis_damage_kb = settings:get_bool("mobs_disable_damage_kb") + function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage) -- mob health check @@ -2826,7 +2828,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage) if self.knock_back and tflp >= punch_interval then local v = self.object:get_velocity() ; if not v then return true end - local kb = damage or 1 + local kb = dis_damage_kb and 1 or (damage or 1) local up = 2 -- if already in air then dont go up anymore when hit diff --git a/api.txt b/api.txt index 85ea0b6..456b60d 100644 --- a/api.txt +++ b/api.txt @@ -861,6 +861,8 @@ External Settings for "minetest.conf" nearby mobs to run a custom on_sound function. 'mobs_can_hear_node' Disabled by default, allows nearby nodes to hear and run a custom on_sound function. + 'mobs_disable_damage_kb' Knockback is calculated by hit damage or uses knockback value + from the weapon used, this setting lets you disable the former. Players can override the spawn chance for each mob registered by adding a line to their minetest.conf file with a new value, the lower the value the more each diff --git a/settingtypes.txt b/settingtypes.txt index c79446b..c4e33a2 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -66,6 +66,9 @@ mobs_can_hear (Enable Mob hearing) bool true # Node hearing, when enabled will allow nodes to hear nearby sounds mobs_can_hear_node (Enable Node hearing) bool false +# By default mobs are dealt knockback from damage, this lets you disable it +mobs_disable_damage_kb (Disable knockback from damage only) bool false + [Pathfinding] # Enable pathfinding (default Enabled) mob_pathfinding_enable (Enable pathfinding) bool true