mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-24 00:10:16 +01:00
add mob_hit_effect switch so mob highlights when punched
This commit is contained in:
parent
c8e8401ac5
commit
f4aae8894f
25
api.lua
25
api.lua
@ -25,7 +25,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20230312",
|
version = "20230313",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -70,6 +70,7 @@ local damage_enabled = settings:get_bool("enable_damage")
|
|||||||
local mobs_spawn = settings:get_bool("mobs_spawn") ~= false
|
local mobs_spawn = settings:get_bool("mobs_spawn") ~= false
|
||||||
local peaceful_only = settings:get_bool("only_peaceful_mobs")
|
local peaceful_only = settings:get_bool("only_peaceful_mobs")
|
||||||
local disable_blood = settings:get_bool("mobs_disable_blood")
|
local disable_blood = settings:get_bool("mobs_disable_blood")
|
||||||
|
local mob_hit_effect = settings:get_bool("mob_hit_effect")
|
||||||
local mobs_drop_items = settings:get_bool("mobs_drop_items") ~= false
|
local mobs_drop_items = settings:get_bool("mobs_drop_items") ~= false
|
||||||
local mobs_griefing = settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = settings:get_bool("mobs_griefing") ~= false
|
||||||
local spawn_protected = settings:get_bool("mobs_spawn_protected") ~= false
|
local spawn_protected = settings:get_bool("mobs_spawn_protected") ~= false
|
||||||
@ -123,8 +124,6 @@ end
|
|||||||
local aoc_range = tonumber(settings:get("active_block_range")) * 16
|
local aoc_range = tonumber(settings:get("active_block_range")) * 16
|
||||||
|
|
||||||
-- default nodes
|
-- default nodes
|
||||||
--local node_fire = "fire:basic_flame"
|
|
||||||
--local node_permanent_flame = "fire:permanent_flame"
|
|
||||||
local node_ice = "default:ice"
|
local node_ice = "default:ice"
|
||||||
local node_snowblock = "default:snowblock"
|
local node_snowblock = "default:snowblock"
|
||||||
local node_snow = "default:snow"
|
local node_snow = "default:snow"
|
||||||
@ -2979,6 +2978,24 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
effect(pos, amount, blood, 1, 2, 1.75, nil, nil, true)
|
effect(pos, amount, blood, 1, 2, 1.75, nil, nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- add healthy afterglow when hit (can cause lag with larger textures)
|
||||||
|
if mob_hit_effect then
|
||||||
|
|
||||||
|
self.old_texture_mods = self.texture_mods
|
||||||
|
|
||||||
|
self.object:set_texture_mod(self.texture_mods .. self.damage_texture_modifier)
|
||||||
|
|
||||||
|
minetest.after(0.3, function()
|
||||||
|
|
||||||
|
if self and self.object and self.object:get_pos() then
|
||||||
|
|
||||||
|
self.texture_mods = self.old_texture_mods
|
||||||
|
self.old_texture_mods = nil
|
||||||
|
self.object:set_texture_mod(self.texture_mods)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
-- do damage
|
-- do damage
|
||||||
self.health = self.health - floor(damage)
|
self.health = self.health - floor(damage)
|
||||||
|
|
||||||
@ -3594,7 +3611,7 @@ minetest.register_entity(name, setmetatable({
|
|||||||
run_velocity = def.run_velocity,
|
run_velocity = def.run_velocity,
|
||||||
damage = max(0, (def.damage or 0) * difficulty),
|
damage = max(0, (def.damage or 0) * difficulty),
|
||||||
damage_group = def.damage_group,
|
damage_group = def.damage_group,
|
||||||
damage_texture_modifier = def.damage_texture_modifier,
|
damage_texture_modifier = def.damage_texture_modifier or "^[colorize:#c9900070",
|
||||||
light_damage = def.light_damage,
|
light_damage = def.light_damage,
|
||||||
light_damage_min = def.light_damage_min,
|
light_damage_min = def.light_damage_min,
|
||||||
light_damage_max = def.light_damage_max,
|
light_damage_max = def.light_damage_max,
|
||||||
|
3
api.txt
3
api.txt
@ -71,6 +71,7 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
mob when melee attacking.
|
mob when melee attacking.
|
||||||
'damage_group' group in which damage is dealt, dedaults to "fleshy".
|
'damage_group' group in which damage is dealt, dedaults to "fleshy".
|
||||||
'damage_texture_modifier' applies texture modifier on hit e.g "^[brighten"
|
'damage_texture_modifier' applies texture modifier on hit e.g "^[brighten"
|
||||||
|
or default when enabled is "^[colorize:#c9900070".
|
||||||
'knock_back' when true has mobs falling backwards when hit, the greater
|
'knock_back' when true has mobs falling backwards when hit, the greater
|
||||||
the damage the more they move back.
|
the damage the more they move back.
|
||||||
'fear_height' is how high a cliff or edge has to be before the mob stops
|
'fear_height' is how high a cliff or edge has to be before the mob stops
|
||||||
@ -729,6 +730,8 @@ External Settings for "minetest.conf"
|
|||||||
false)
|
false)
|
||||||
'mobs_disable_blood' if false blood effects appear when mob is hit (default
|
'mobs_disable_blood' if false blood effects appear when mob is hit (default
|
||||||
is false)
|
is false)
|
||||||
|
'mob_hit_effect' False by default, when True and mobs are hit then
|
||||||
|
damage_texture_modifier is used to highlight mob.
|
||||||
'mobs_spawn_protected' if set to false then mobs will not spawn in protected
|
'mobs_spawn_protected' if set to false then mobs will not spawn in protected
|
||||||
areas (default is true)
|
areas (default is true)
|
||||||
'mobs_spawn_monster_protected' if set to false then monsters will not spawn in
|
'mobs_spawn_monster_protected' if set to false then monsters will not spawn in
|
||||||
|
@ -7,6 +7,9 @@ only_peaceful_mobs (Only spawn peaceful Mobs) bool false
|
|||||||
# If enabled then punching mobs no longer shows blood effects
|
# If enabled then punching mobs no longer shows blood effects
|
||||||
mobs_disable_blood (Disable Mob blood) bool false
|
mobs_disable_blood (Disable Mob blood) bool false
|
||||||
|
|
||||||
|
# If enabled the mobs will be highlighted when hit
|
||||||
|
mob_hit_effect (Highlight Mob when Hit) bool false
|
||||||
|
|
||||||
# If disabled then Mobs no longer destroy world blocks
|
# If disabled then Mobs no longer destroy world blocks
|
||||||
mobs_griefing (Griefing Mobs) bool true
|
mobs_griefing (Griefing Mobs) bool true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user