can now add nodes to 'runaway_from' table
This commit is contained in:
parent
cc0798b617
commit
dcc702848f
17
api.lua
17
api.lua
@ -25,7 +25,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20230702",
|
version = "20230715",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -2051,6 +2051,7 @@ function mob_class:do_runaway_from()
|
|||||||
local min_dist = self.view_range + 1
|
local min_dist = self.view_range + 1
|
||||||
local objs = minetest.get_objects_inside_radius(s, self.view_range)
|
local objs = minetest.get_objects_inside_radius(s, self.view_range)
|
||||||
|
|
||||||
|
-- loop through entities surrounding mob
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
|
|
||||||
if objs[n]:is_player() then
|
if objs[n]:is_player() then
|
||||||
@ -2102,6 +2103,20 @@ function mob_class:do_runaway_from()
|
|||||||
self.state = "runaway"
|
self.state = "runaway"
|
||||||
self.runaway_timer = 3
|
self.runaway_timer = 3
|
||||||
self.following = nil
|
self.following = nil
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check for nodes to runaway from
|
||||||
|
objs = minetest.find_node_near(s, self.view_range, self.runaway_from, true)
|
||||||
|
|
||||||
|
if objs then
|
||||||
|
|
||||||
|
yaw_to_pos(self, objs, 3)
|
||||||
|
|
||||||
|
self.state = "runaway"
|
||||||
|
self.runaway_timer = 3
|
||||||
|
self.following = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
4
api.txt
4
api.txt
@ -154,8 +154,8 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
'friendly_fire` when set to false, mobs will not be able to harm other
|
'friendly_fire` when set to false, mobs will not be able to harm other
|
||||||
mobs of the same type with friendly fire arrows.
|
mobs of the same type with friendly fire arrows.
|
||||||
Defaults to true.
|
Defaults to true.
|
||||||
'runaway_from' contains a table with mob names to run away from, add
|
'runaway_from' contains a table with mob names or nodesto run away
|
||||||
"player" to list to runaway from player also.
|
from, add "player" to list to runaway from player also.
|
||||||
'ignore_invisibility' When true mob will still be able to see and attack
|
'ignore_invisibility' When true mob will still be able to see and attack
|
||||||
player even if invisible (invisibility mod only).
|
player even if invisible (invisibility mod only).
|
||||||
'blood_amount' contains the number of blood droplets to appear when
|
'blood_amount' contains the number of blood droplets to appear when
|
||||||
|
@ -33,6 +33,7 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
|
|||||||
* Refactored do_jump and added get_nodes function
|
* Refactored do_jump and added get_nodes function
|
||||||
* Many bug fixes and tweaks to improve performance
|
* Many bug fixes and tweaks to improve performance
|
||||||
* Added 'mobs_attack_creatura' setting so that monsters can attack Creatura mobs
|
* Added 'mobs_attack_creatura' setting so that monsters can attack Creatura mobs
|
||||||
|
* Nodes can be added to 'runaway_from' table
|
||||||
|
|
||||||
### Version 1.56
|
### Version 1.56
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user