add self.attack_patience to add custom times, add self.attack nil check to pathfinding
* backport commit 9e27f45663cc0c0df0e329bfbcf92466cca2ce3c from upstream and fix previous commit of this version that for rare reason mixed only one line
This commit is contained in:
parent
7771da2e0a
commit
8ddc921789
12
api.lua
12
api.lua
@ -33,7 +33,7 @@ local use_mc2 = minetest.get_modpath("mcl_core")
|
||||
-- Global
|
||||
mobs = {
|
||||
mod = "redo",
|
||||
version = "20231105",
|
||||
version = "20231106",
|
||||
translate = S, intllib = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||
node_ice = "default:ice",
|
||||
@ -183,6 +183,7 @@ mobs.mob_class = {
|
||||
walk_chance = 50,
|
||||
stand_chance = 30,
|
||||
attack_chance = 5,
|
||||
attack_patience = 11
|
||||
passive = false,
|
||||
blood_amount = 5,
|
||||
blood_texture = "mobs_blood.png",
|
||||
@ -1859,7 +1860,9 @@ function mob_class:smart_mobs(s, p, dist, dtime)
|
||||
s.y = sground.y + 1
|
||||
end
|
||||
|
||||
local p1 = self.attack:get_pos()
|
||||
local p1 = self.attack and self.attack:get_pos()
|
||||
|
||||
if not p1 then return end
|
||||
|
||||
p1.x = floor(p1.x + 0.5)
|
||||
p1.y = floor(p1.y + 0.5)
|
||||
@ -3782,6 +3785,7 @@ minetest.register_entity(name, setmetatable({
|
||||
walk_chance = def.walk_chance,
|
||||
stand_chance = def.stand_chance,
|
||||
attack_chance = def.attack_chance,
|
||||
attack_patience = def.attack_patience,
|
||||
passive = def.passive,
|
||||
knock_back = def.knock_back,
|
||||
blood_amount = def.blood_amount,
|
||||
@ -4085,7 +4089,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
||||
pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
-- use instead of abm's chance setting when using lbm
|
||||
if map_load and random(max(1, (chance * mob_chance_multiplier))) > 1 then
|
||||
if map_load and random(max(1, (chance * mob_chance_multiplier/10))) > 1 then
|
||||
return
|
||||
end
|
||||
|
||||
@ -4257,7 +4261,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
||||
nodenames = nodes,
|
||||
neighbors = neighbors,
|
||||
interval = interval,
|
||||
chance = max(1, (chance * mob_chance_multiplier)),
|
||||
chance = max(1, (chance * (mob_chance_multiplier/10))),
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
2
api.txt
2
api.txt
@ -104,6 +104,8 @@ functions needed for the mob to work properly which contains the following:
|
||||
hours and only attacking player at night or when
|
||||
provoked.
|
||||
'attack_chance' 0 to 100 chance the mob will attack (default is 5).
|
||||
'attack_patience' Time in seconds before mob gives up attacking if
|
||||
player isn't seen (Defaults to 11).
|
||||
'attack_monsters' when true mob will attack monsters.
|
||||
'attack_animals' when true mob will attack animals.
|
||||
'attack_npcs' when true mob will attack npcs within range.
|
||||
|
Loading…
x
Reference in New Issue
Block a user