update information readme
This commit is contained in:
parent
d76d2d307a
commit
e4623dec52
80
api.lua
80
api.lua
@ -33,7 +33,7 @@ local use_mc2 = minetest.get_modpath("mcl_core")
|
|||||||
-- Global
|
-- Global
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20231022",
|
version = "20231105",
|
||||||
translate = S, intllib = S,
|
translate = S, intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||||
node_ice = "default:ice",
|
node_ice = "default:ice",
|
||||||
@ -114,7 +114,8 @@ local pathfinder_enable = settings:get_bool("mob_pathfinder_enable") or true
|
|||||||
local pathfinding_stuck_timeout = tonumber(
|
local pathfinding_stuck_timeout = tonumber(
|
||||||
settings:get("mob_pathfinding_stuck_timeout")) or 3.0
|
settings:get("mob_pathfinding_stuck_timeout")) or 3.0
|
||||||
-- how long will mob follow path before giving up
|
-- how long will mob follow path before giving up
|
||||||
local pathfinding_stuck_path_timeout = tonumber(settings:get("mob_pathfinding_stuck_path_timeout")) or 5.0
|
local pathfinding_stuck_path_timeout = tonumber(
|
||||||
|
settings:get("mob_pathfinding_stuck_path_timeout")) or 5.0
|
||||||
-- which algorithm to use, Dijkstra(default) or A*_noprefetch or A*
|
-- which algorithm to use, Dijkstra(default) or A*_noprefetch or A*
|
||||||
-- fix settings not allowing "*"
|
-- fix settings not allowing "*"
|
||||||
local pathfinding_algorithm = settings:get("mob_pathfinding_algorithm") or "Dijkstra"
|
local pathfinding_algorithm = settings:get("mob_pathfinding_algorithm") or "Dijkstra"
|
||||||
@ -228,21 +229,20 @@ local mob_class_meta = {__index = mob_class}
|
|||||||
-- play sound
|
-- play sound
|
||||||
function mob_class:mob_sound(sound)
|
function mob_class:mob_sound(sound)
|
||||||
|
|
||||||
if sound then
|
if not sound then return end
|
||||||
|
|
||||||
-- higher pitch for a child
|
-- higher pitch for a child
|
||||||
local pitch = self.child and 1.5 or 1.0
|
local pitch = self.child and 1.5 or 1.0
|
||||||
|
|
||||||
-- a little random pitch to be different
|
-- a little random pitch to be different
|
||||||
pitch = pitch + random(-10, 10) * 0.005
|
pitch = pitch + random(-10, 10) * 0.005
|
||||||
|
|
||||||
minetest.sound_play(sound, {
|
minetest.sound_play(sound, {
|
||||||
object = self.object,
|
object = self.object,
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
max_hear_distance = self.sounds.distance,
|
max_hear_distance = (self.sounds and self.sounds.distance) or 10,
|
||||||
pitch = pitch
|
pitch = pitch
|
||||||
}, true)
|
}, true)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2339,6 +2339,21 @@ function mob_class:dogswitch(dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- stop attack
|
||||||
|
function mob_class:stop_attack()
|
||||||
|
|
||||||
|
self.attack = nil
|
||||||
|
self.following = nil
|
||||||
|
self.v_start = false
|
||||||
|
self.timer = 0
|
||||||
|
self.blinktimer = 0
|
||||||
|
self.path.way = nil
|
||||||
|
self:set_velocity(0)
|
||||||
|
self.state = "stand"
|
||||||
|
self:set_animation("stand", true)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- execute current state (stand, walk, run, attacks)
|
-- execute current state (stand, walk, run, attacks)
|
||||||
function mob_class:do_states(dtime)
|
function mob_class:do_states(dtime)
|
||||||
|
|
||||||
@ -2517,19 +2532,28 @@ function mob_class:do_states(dtime)
|
|||||||
|
|
||||||
--print(" ** stop attacking **", self.name, self.health, dist, self.view_range)
|
--print(" ** stop attacking **", self.name, self.health, dist, self.view_range)
|
||||||
|
|
||||||
self.attack = nil
|
self:stop_attack()
|
||||||
self.following = nil
|
|
||||||
self.v_start = false
|
|
||||||
self.timer = 0
|
|
||||||
self.blinktimer = 0
|
|
||||||
self.path.way = nil
|
|
||||||
self:set_velocity(0)
|
|
||||||
self.state = "stand"
|
|
||||||
self:set_animation("stand", true)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- check enemy is in sight
|
||||||
|
local in_sight = self:line_of_sight(
|
||||||
|
{x = s.x, y = s.y + 0.5, z = s.z},
|
||||||
|
{x = p.x, y = p.y + 0.5, z = p.z})
|
||||||
|
|
||||||
|
-- stop attacking when enemy not seen for 11 seconds
|
||||||
|
if not in_sight then
|
||||||
|
|
||||||
|
self.target_time_lost = (self.target_time_lost or 0) + dtime
|
||||||
|
|
||||||
|
if self.target_time_lost > self.attack_patience then
|
||||||
|
self:stop_attack()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.target_time_lost = 0
|
||||||
|
end
|
||||||
|
|
||||||
if self.attack_type == "explode" then
|
if self.attack_type == "explode" then
|
||||||
|
|
||||||
yaw_to_pos(self, p)
|
yaw_to_pos(self, p)
|
||||||
@ -2544,7 +2568,7 @@ function mob_class:do_states(dtime)
|
|||||||
-- start timer when in reach and line of sight
|
-- start timer when in reach and line of sight
|
||||||
if not self.v_start
|
if not self.v_start
|
||||||
and dist <= self.reach
|
and dist <= self.reach
|
||||||
and self:line_of_sight(s, p, 2) then
|
and in_sight then
|
||||||
|
|
||||||
self.v_start = true
|
self.v_start = true
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
@ -2556,7 +2580,7 @@ function mob_class:do_states(dtime)
|
|||||||
-- stop timer if out of reach or direct line of sight
|
-- stop timer if out of reach or direct line of sight
|
||||||
elseif self.allow_fuse_reset
|
elseif self.allow_fuse_reset
|
||||||
and self.v_start
|
and self.v_start
|
||||||
and (dist > self.reach or not self:line_of_sight(s, p, 2)) then
|
and (dist > self.reach or not in_sight) then
|
||||||
|
|
||||||
--print("=== explosion timer stopped")
|
--print("=== explosion timer stopped")
|
||||||
|
|
||||||
@ -2590,10 +2614,8 @@ function mob_class:do_states(dtime)
|
|||||||
self.blinktimer = 0
|
self.blinktimer = 0
|
||||||
|
|
||||||
if self.blinkstatus then
|
if self.blinkstatus then
|
||||||
|
|
||||||
self.object:set_texture_mod(self.texture_mods)
|
self.object:set_texture_mod(self.texture_mods)
|
||||||
else
|
else
|
||||||
|
|
||||||
self.object:set_texture_mod(self.texture_mods .. "^[brighten")
|
self.object:set_texture_mod(self.texture_mods .. "^[brighten")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2606,10 +2628,9 @@ function mob_class:do_states(dtime)
|
|||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
-- dont damage anything if area protected or next to waterpathfinding_max_jump
|
-- dont damage anything if area protected or next to water
|
||||||
if minetest.find_node_near(pos, 1, {"group:water"})
|
if minetest.find_node_near(pos, 1, {"group:water"})
|
||||||
or minetest.is_protected(pos, "") then
|
or minetest.is_protected(pos, "") then
|
||||||
|
|
||||||
node_break_radius = 1
|
node_break_radius = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -4452,7 +4473,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- Register spawn eggs
|
-- Register spawn eggs
|
||||||
|
|
||||||
-- Note: This also introduces the “spawn_egg” group:
|
-- Note: This also introduces the “spawn_egg” group:
|
||||||
-- * spawn_egg=1: Spawn egg (generic mob, no metadata)
|
-- * spawn_egg=1: Spawn egg (generic mob, no metadata)
|
||||||
-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata)
|
-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata)
|
||||||
|
9
api.txt
9
api.txt
@ -387,6 +387,15 @@ for each mob.
|
|||||||
in it's name.
|
in it's name.
|
||||||
|
|
||||||
|
|
||||||
|
Internal Functions
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Each mob contains a set of functions that can be called for use internally or from
|
||||||
|
another mod entirely, replace mob_class with the mob entity variable:
|
||||||
|
|
||||||
|
mob_class:stop_attack() -- stops mob attacking
|
||||||
|
|
||||||
|
|
||||||
Adding Mobs in World
|
Adding Mobs in World
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ MOBS REDO for MINETEST
|
|||||||
This mod contains the API only for adding your own mobs into the world, so
|
This mod contains the API only for adding your own mobs into the world, so
|
||||||
please use the additional modpacks to add animals, monsters, and npcs.
|
please use the additional modpacks to add animals, monsters, and npcs.
|
||||||
|
|
||||||
https://forum.minetest.net/viewtopic.php?f=11&t=9917
|
https://codeberg.org/minenux/minetest-mod-mobs_redo
|
||||||
|
|
||||||
Information
|
Information
|
||||||
-----------
|
-----------
|
||||||
@ -12,6 +12,10 @@ Information
|
|||||||
Built from PilzAdam's original Simple Mobs with additional mobs by KrupnoPavel,
|
Built from PilzAdam's original Simple Mobs with additional mobs by KrupnoPavel,
|
||||||
Zeg9, ExeterDad and AspireMint.
|
Zeg9, ExeterDad and AspireMint.
|
||||||
|
|
||||||
|
This mod is special one already compatible with older engines.. with backported
|
||||||
|
patches to work both in multicraft, minetest, mineclone and finetest, becouse
|
||||||
|
the tenplus1 only works in last minetest, admins will not wants to constant upgrades!
|
||||||
|
|
||||||
## Crafts
|
## Crafts
|
||||||
|
|
||||||
- **Nametag**. Can be crafted by paper, black dye, and string. Can be used
|
- **Nametag**. Can be crafted by paper, black dye, and string. Can be used
|
||||||
|
Loading…
x
Reference in New Issue
Block a user