added 'mobs_attack_creatura' setting for monsters to attack Creatura mob mobs

This commit is contained in:
tenplus1 2023-05-26 14:04:50 +01:00
parent 267ee57837
commit 194c9f7847
4 changed files with 23 additions and 3 deletions

21
api.lua
View File

@ -25,7 +25,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20230524",
version = "20230526",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -128,6 +128,9 @@ end
-- calculate aoc range for mob count
local aoc_range = tonumber(settings:get("active_block_range")) * 16
-- can we attack Creatura mobs ?
local creatura = settings:get_bool("mobs_attack_creatura") == true
-- default nodes
local node_ice = "default:ice"
local node_snowblock = "default:snowblock"
@ -175,7 +178,7 @@ mobs.mob_class = {
floats = 1, -- floats in water by default
replace_offset = 0,
timer = 0,
env_damage_timer = 0, -- only used when state = "attack"
env_damage_timer = 0,
tamed = false,
pause_timer = 0,
horny = false,
@ -1951,7 +1954,19 @@ function mob_class:general_attack()
--print("- pla", n)
end
-- or are we a mob?
-- are we a creatura mob?
elseif creatura and ent and ent._cmi_is_mob ~= true
and ent.hitbox and ent.stand_node then
if self.name == ent.name
or self.type ~= "monster"
or (self.specific_attack
and not check_for(ent.name, self.specific_attack)) then
objs[n] = nil
-- print("- creatura", n, self.name, ent.name)
end
-- or are we a mob? -- ent.hitbox is a creatura mob identifier
elseif ent and ent._cmi_is_mob then
-- remove mobs not to attack

View File

@ -751,6 +751,7 @@ External Settings for "minetest.conf"
'enable_damage' if true monsters will attack players (default is true)
'only_peaceful_mobs' if true only animals will spawn in game (default is
false)
'mobs_attack_creatura' When True mobs redo mobs will attack Creatura mod mobs.
'mobs_disable_blood' if false blood effects appear when mob is hit (default
is false)
'mob_hit_effect' False by default, when True and mobs are hit then

View File

@ -32,6 +32,7 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
* Added ability for mobs to die only in natural daylight
* Refactored do_jump and added get_nodes function
* Many bug fixes and tweaks to improve performance
* Added 'mobs_attack_creatura' setting so that monsters can attack Creatura mobs
### Version 1.56

View File

@ -1,3 +1,6 @@
# Enable setting so that Mobs Redo mobs can attack Creatura mobs
mobs_attack_creatura (Attack Creatura Mobs) bool false
# How often mobs get nodes around them (default is 0.25, 1/4 second)
mob_node_timer_interval (Mob Node Timer Interval) float 0.25