1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-01-09 01:10:20 +01:00

add 'mobs_disable_damage_kb' setting

This commit is contained in:
tenplus1 2024-10-20 09:19:52 +01:00
parent 79fb4f7ead
commit 430af1e91d
3 changed files with 9 additions and 2 deletions

View File

@ -18,7 +18,7 @@ end
mobs = { mobs = {
mod = "redo", mod = "redo",
version = "20241012", version = "20241020",
spawning_mobs = {}, spawning_mobs = {},
translate = S, translate = S,
invis = minetest.global_exists("invisibility") and invisibility or {}, invis = minetest.global_exists("invisibility") and invisibility or {},
@ -2600,6 +2600,8 @@ end
-- deal damage and effects when mob punched -- 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) function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
-- mob health check -- 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 if self.knock_back and tflp >= punch_interval then
local v = self.object:get_velocity() ; if not v then return true end 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 local up = 2
-- if already in air then dont go up anymore when hit -- if already in air then dont go up anymore when hit

View File

@ -861,6 +861,8 @@ External Settings for "minetest.conf"
nearby mobs to run a custom on_sound function. nearby mobs to run a custom on_sound function.
'mobs_can_hear_node' Disabled by default, allows nearby nodes to hear and run a 'mobs_can_hear_node' Disabled by default, allows nearby nodes to hear and run a
custom on_sound function. 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 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 to their minetest.conf file with a new value, the lower the value the more each

View File

@ -66,6 +66,9 @@ mobs_can_hear (Enable Mob hearing) bool true
# Node hearing, when enabled will allow nodes to hear nearby sounds # Node hearing, when enabled will allow nodes to hear nearby sounds
mobs_can_hear_node (Enable Node hearing) bool false 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] [Pathfinding]
# Enable pathfinding (default Enabled) # Enable pathfinding (default Enabled)
mob_pathfinding_enable (Enable pathfinding) bool true mob_pathfinding_enable (Enable pathfinding) bool true