1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-11-14 14:30:19 +01:00

code tidy, updated readme (thx eschan145)

This commit is contained in:
tenplus1 2023-03-25 08:47:31 +00:00
parent 076b9480b7
commit 3bd2ee8129
2 changed files with 455 additions and 229 deletions

214
api.lua
View File

@ -25,7 +25,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20230313",
version = "20230325",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -61,8 +61,7 @@ local settings = minetest.settings
-- creative check
local creative_cache = minetest.settings:get_bool("creative_mode")
function mobs.is_creative(name)
return creative_cache or minetest.check_player_privs(name,
{creative = true})
return creative_cache or minetest.check_player_privs(name, {creative = true})
end
-- Load settings
@ -92,7 +91,8 @@ local pathfinding_enable = settings:get_bool("mob_pathfinding_enable") or true
-- Use pathfinder mod if available
local pathfinder_enable = settings:get_bool("mob_pathfinder_enable") or true
-- how long before stuck mobs start searching
local pathfinding_stuck_timeout = tonumber(settings:get("mob_pathfinding_stuck_timeout")) or 3.0
local pathfinding_stuck_timeout = tonumber(
settings:get("mob_pathfinding_stuck_timeout")) or 3.0
-- 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
-- which algorithm to use, Dijkstra(default) or A*_noprefetch or A*
@ -106,7 +106,8 @@ elseif pathfinding_algorithm == "AStar" then
end
-- max search distance from search positions (default 16)
local pathfinding_searchdistance = tonumber(settings:get("mob_pathfinding_searchdistance") or 16)
local pathfinding_searchdistance = tonumber(
settings:get("mob_pathfinding_searchdistance") or 16)
-- max jump height (default 4)
local pathfinding_max_jump = tonumber(settings:get("mob_pathfinding_max_jump") or 4)
-- max drop height (default 6)
@ -340,8 +341,7 @@ function mob_class:set_velocity(v)
-- only slow mob trying to move while inside a viscous fluid that
-- they aren't meant to be in (fish in water, spiders in cobweb etc)
if v > 0 and visc and visc > 0
and not check_for(self.standing_in, self.fly_in) then
if v > 0 and visc and visc > 0 and not check_for(self.standing_in, self.fly_in) then
v = v / (visc + 1)
end
@ -499,9 +499,7 @@ local line_of_sight = function(self, pos1, pos2, stepsize)
-- NaN checks
if d == 0
or npos1.x ~= npos1.x
or npos1.y ~= npos1.y
or npos1.z ~= npos1.z then
or npos1.x ~= npos1.x or npos1.y ~= npos1.y or npos1.z ~= npos1.z then
return false
end
@ -709,8 +707,8 @@ local effect = function(pos, amount, texture, min_size, max_size,
})
end
function mobs:effect(pos, amount, texture, min_size, max_size,
radius, gravity, glow, fall)
function mobs:effect(
pos, amount, texture, min_size, max_size, radius, gravity, glow, fall)
effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, fall)
end
@ -1807,8 +1805,8 @@ function mob_class:smart_mobs(s, p, dist, dtime)
if pathfinder_mod and pathfinder_enable then
self.path.way = pathfinder.find_path(s, p1, self, dtime)
else
self.path.way = minetest.find_path(s, p1, pathfinding_searchdistance, jumpheight,
dropheight, pathfinding_algorithm)
self.path.way = minetest.find_path(s, p1, pathfinding_searchdistance,
jumpheight, dropheight, pathfinding_algorithm)
end
--[[
-- show path using particles
@ -2075,8 +2073,7 @@ function mob_class:do_runaway_from()
dist = get_distance(p, s)
-- choose closest player/mob to runaway from
if dist < min_dist
and self:line_of_sight(sp, p, 2) == true then
if dist < min_dist and self:line_of_sight(sp, p, 2) == true then
min_dist = dist
min_player = player
end
@ -2126,16 +2123,13 @@ function mob_class:follow_flop()
-- npc stop following player if not owner
if self.following
and self.owner
and self.owner ~= self.following:get_player_name() then
and self.owner and self.owner ~= self.following:get_player_name() then
self.following = nil
end
else
-- stop following player if not holding specific item or mob is horny
if self.following
and self.following:is_player()
and (self:follow_holding(self.following) == false
or self.horny) then
if self.following and self.following:is_player()
and (self:follow_holding(self.following) == false or self.horny) then
self.following = nil
end
@ -2148,11 +2142,8 @@ function mob_class:follow_flop()
local p
if self.following:is_player() then
p = self.following:get_pos()
elseif self.following.object then
p = self.following.object:get_pos()
end
@ -2219,17 +2210,14 @@ end
function mob_class:dogswitch(dtime)
-- switch mode not activated
if not self.dogshoot_switch
or not dtime then
if not self.dogshoot_switch or not dtime then
return 0
end
self.dogshoot_count = self.dogshoot_count + dtime
if (self.dogshoot_switch == 1
and self.dogshoot_count > self.dogshoot_count_max)
or (self.dogshoot_switch == 2
and self.dogshoot_count > self.dogshoot_count2_max) then
if (self.dogshoot_switch == 1 and self.dogshoot_count > self.dogshoot_count_max)
or (self.dogshoot_switch == 2 and self.dogshoot_count > self.dogshoot_count2_max) then
self.dogshoot_count = 0
@ -2349,8 +2337,7 @@ function mob_class:do_states(dtime)
self:set_yaw(yaw, 8)
-- for flying/swimming mobs randomly move up and down also
if self.fly_in
and not self.following then
if self.fly_in and not self.following then
self:attempt_flight_correction(true)
end
end
@ -2361,8 +2348,7 @@ function mob_class:do_states(dtime)
or random(100) <= self.stand_chance then
-- don't stand if mob flies and keep_flying set
if (self.fly and not self.keep_flying)
or not self.fly then
if (self.fly and not self.keep_flying) or not self.fly then
self:set_velocity(0)
self.state = "stand"
@ -2550,35 +2536,21 @@ function mob_class:do_states(dtime)
if me_y < p_y then
self.object:set_velocity({
x = v.x,
y = 1 * self.walk_velocity,
z = v.z
})
x = v.x, y = 1 * self.walk_velocity, z = v.z})
elseif me_y > p_y then
self.object:set_velocity({
x = v.x,
y = -1 * self.walk_velocity,
z = v.z
})
x = v.x, y = -1 * self.walk_velocity, z = v.z})
end
else
if me_y < p_y then
self.object:set_velocity({
x = v.x,
y = 0.01,
z = v.z
})
self.object:set_velocity({x = v.x, y = 0.01, z = v.z})
elseif me_y > p_y then
self.object:set_velocity({
x = v.x,
y = -0.01,
z = v.z
})
self.object:set_velocity({x = v.x, y = -0.01, z = v.z})
end
end
end
@ -2589,8 +2561,7 @@ function mob_class:do_states(dtime)
and self.attack_type ~= "dogshoot" then
-- no paths longer than 50
if #self.path.way > 50
or dist < self.reach then
if #self.path.way > 50 or dist < self.reach then
self.path.following = false
return
end
@ -2616,10 +2587,8 @@ function mob_class:do_states(dtime)
-- move towards enemy if beyond mob reach
if dist > (self.reach + (self.reach_ext or 0)) then
-- path finding by rnd
if self.pathfinding -- only if mob has pathfinding enabled
and pathfinding_enable then
-- path finding by rnd (only when enabled in setting and mob)
if self.pathfinding and pathfinding_enable then
self:smart_mobs(s, p, dist, dtime)
end
@ -2709,8 +2678,7 @@ function mob_class:do_states(dtime)
self:set_velocity(0)
if self.shoot_interval
and self.timer > self.shoot_interval
if self.shoot_interval and self.timer > self.shoot_interval
and random(100) <= 60 then
self.timer = 0
@ -2816,17 +2784,14 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
return true
end
-- custom punch function
if self.do_punch
and self:do_punch(hitter, tflp, tool_capabilities, dir) == false then
-- custom punch function (if false returned, do not continue and return true)
if self.do_punch and self:do_punch(hitter, tflp, tool_capabilities, dir) == false then
return true
end
-- error checking when mod profiling is enabled
if not tool_capabilities then
minetest.log("warning", "[mobs] Mod profiling enabled, damage not enabled")
return true
end
@ -2853,11 +2818,8 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
local ent = hitter and hitter:get_luaentity()
if ent and ent._is_arrow then
return true -- arrow entity
elseif not ent then
return true -- non entity
end
end
@ -2932,12 +2894,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
local wear = floor((punch_interval / 75) * 9000)
if mobs.is_creative(hitter:get_player_name()) then
if tr then
wear = 1
else
wear = 0
end
wear = tr and 1 or 0
end
if tr and weapon_def.original_description then
@ -3046,8 +3003,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
end
-- if skittish then run away
if self.runaway == true
and self.order ~= "stand" then
if self.runaway == true and self.order ~= "stand" then
local lp = hitter:get_pos()
@ -3088,7 +3044,6 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
and obj.state ~= "attack"
and obj.owner ~= name
and (obj.name == self.name or obj.name == self.group_helper) then
obj:do_attack(hitter)
end
@ -3140,8 +3095,7 @@ function mob_class:mob_staticdata()
end
if use_cmi then
self.serialized_cmi_components = cmi.serialize_components(
self._cmi_components)
self.serialized_cmi_components = cmi.serialize_components(self._cmi_components)
end
local tmp, t = {}
@ -3199,9 +3153,7 @@ function mob_class:mob_activate(staticdata, def, dtime)
t = type(stat)
if t ~= "function"
and t ~= "nil"
and t ~= "userdata" then
if t ~= "function" and t ~= "nil" and t ~= "userdata" then
self[_] = stat
end
end
@ -3303,10 +3255,8 @@ function mob_class:mob_activate(staticdata, def, dtime)
self.standing_in = "air"
self.standing_on = "air"
-- check existing nametag
if not self.nametag then
self.nametag = def.nametag
end
-- check for existing nametag
self.nametag = self.nametag or def.nametag
-- set anything changed above
self.object:set_properties(self)
@ -3323,10 +3273,8 @@ function mob_class:mob_activate(staticdata, def, dtime)
end
-- run on_spawn function if found
if self.on_spawn and not self.on_spawn_run then
if self.on_spawn(self) then
self.on_spawn_run = true -- if true, set flag to run once only
end
if self.on_spawn and not self.on_spawn_run and self.on_spawn(self) then
self.on_spawn_run = true -- if true, set flag to run once only
end
-- run after_activate
@ -3402,11 +3350,7 @@ function mob_class:on_step(dtime, moveresult)
self.node_timer = 0
local y_level = self.collisionbox[2]
if self.child then
y_level = self.collisionbox[2] * 0.5
end
local y_level = self.child and self.collisionbox[2] * 0.5 or self.collisionbox[2]
-- what is mob standing in?
self.standing_in = node_ok({
@ -3420,12 +3364,7 @@ function mob_class:on_step(dtime, moveresult)
-- if standing inside solid block then jump to escape
if minetest.registered_nodes[self.standing_in].walkable
and minetest.registered_nodes[self.standing_in].drawtype == "normal" then
self.object:set_velocity({
x = 0,
y = self.jump_height,
z = 0
})
self.object:set_velocity({x = 0, y = self.jump_height, z = 0 })
end
-- check and stop if standing at cliff and fear of heights
@ -3501,13 +3440,9 @@ function mob_class:on_step(dtime, moveresult)
return
end
-- run custom function (defined in mob lua file)
if self.do_custom then
-- when false skip going any further
if self:do_custom(dtime) == false then
return
end
-- run custom function (defined in mob lua file) - when false skip going any further
if self.do_custom and self:do_custom(dtime) == false then
return
end
-- attack timer
@ -3554,9 +3489,7 @@ function mob_class:on_blast(damage)
--print("-- blast damage", damage)
self.object:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage},
}, nil)
full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, nil)
-- return no damage, no knockback, no item drops, mob api handles all
return false, false, {}
@ -3820,8 +3753,7 @@ function mobs:add_mob(pos, def)
return
end
local aoc = mobs.spawning_mobs[def.name]
and mobs.spawning_mobs[def.name].aoc or 1
local aoc = mobs.spawning_mobs[def.name] and mobs.spawning_mobs[def.name].aoc or 1
if def.ignore_count ~= true and num_mob >= aoc then
--print("--- too many " .. def.name .. " in area", num_mob .. "/" .. aoc)
@ -3848,7 +3780,7 @@ function mobs:add_mob(pos, def)
textures = ent.child_texture[1]
end
-- and resize to half height
-- and resize to half height (multiplication is faster than division)
mob:set_properties({
textures = textures,
visual_size = {
@ -3935,8 +3867,8 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
mobs.spawning_mobs[name].aoc = aoc
local spawn_action = function(pos, node, active_object_count,
active_object_count_wider)
local spawn_action = function(
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
@ -3968,8 +3900,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
end
-- do not spawn if too many entities in area
if active_object_count_wider
and active_object_count_wider >= max_per_block then
if active_object_count_wider and active_object_count_wider >= max_per_block then
--print("--- too many entities in area", active_object_count_wider)
return
end
@ -4011,17 +3942,14 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
pos.y = pos.y + 1
-- are we spawning within height limits?
if pos.y > max_height
or pos.y < min_height then
if pos.y > max_height or pos.y < min_height then
--print("--- height limits not met", name, pos.y)
return
end
-- are light levels ok?
local light = minetest.get_node_light(pos)
if not light
or light > max_light
or light < min_light then
if not light or light > max_light or light < min_light then
--print("--- light limits not met", name, light)
return
end
@ -4101,9 +4029,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
spawn_action(pos, node)
end
})
else
minetest.register_abm({
label = name .. " spawning",
nodenames = nodes,
@ -4225,8 +4151,7 @@ function mobs:register_arrow(name, def)
self.lastpos = (self.lastpos or pos)
minetest.add_item(self.lastpos,
self.object:get_luaentity().name)
minetest.add_item(self.lastpos, self.object:get_luaentity().name)
end
self.object:remove() ; -- print("hit node")
@ -4237,8 +4162,7 @@ function mobs:register_arrow(name, def)
if self.hit_player or self.hit_mob or self.hit_object then
for _,player in pairs(
minetest.get_objects_inside_radius(pos, 1.0)) do
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do
if self.hit_player and player:is_player() then
@ -4259,7 +4183,7 @@ function mobs:register_arrow(name, def)
self:hit_mob(player)
self.object:remove() ; --print("hit mob")
self.object:remove() ; -- print("hit mob")
return
end
@ -4420,8 +4344,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
pointed_thing.under, under, placer, itemstack, pointed_thing)
end
if pos
and not minetest.is_protected(pos, placer:get_player_name()) then
if pos and not minetest.is_protected(pos, placer:get_player_name()) then
if not minetest.registered_entities[mob] then
return
@ -4444,8 +4367,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
if not ent then return end -- sanity check
-- don't set owner if monster or sneak pressed
if ent.type ~= "monster"
and not placer:get_player_control().sneak then
if ent.type ~= "monster" and not placer:get_player_control().sneak then
ent.owner = placer:get_player_name()
ent.tamed = true
end
@ -4502,12 +4424,10 @@ end
-- capture critter (thanks to blert2112 for idea)
function mobs:capture_mob(self, clicker, chance_hand, chance_net,
chance_lasso, force_take, replacewith)
function mobs:capture_mob(
self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
if not self
or not clicker:is_player()
or not clicker:get_inventory() then
if not self or not clicker:is_player() or not clicker:get_inventory() then
return false
end
@ -4644,8 +4564,7 @@ function mobs:protect(self, clicker)
local tool = clicker:get_wielded_item()
local tool_name = tool:get_name()
if tool_name ~= "mobs:protector"
and tool_name ~= "mobs:protector2" then
if tool_name ~= "mobs:protector" and tool_name ~= "mobs:protector2" then
return false
end
@ -4691,8 +4610,7 @@ local mob_sta = {}
function mobs:feed_tame(self, clicker, feed_count, breed, tame)
-- can eat/tame with item in hand
if self.follow
and self:follow_holding(clicker) then
if self.follow and self:follow_holding(clicker) then
-- if not in creative then take item
if not mobs.is_creative(clicker:get_player_name()) then
@ -4812,14 +4730,11 @@ end
minetest.register_on_player_receive_fields(function(player, formname, fields)
-- right-clicked with nametag and name entered?
if formname == "mobs_nametag"
and fields.name
and fields.name ~= "" then
if formname == "mobs_nametag" and fields.name and fields.name ~= "" then
local name = player:get_player_name()
if not mob_obj[name]
or not mob_obj[name].object then
if not mob_obj[name] or not mob_obj[name].object then
return
end
@ -4919,7 +4834,6 @@ minetest.register_chatcommand("clear_mobs", {
if player then
local pos = player:get_pos()
local objs = minetest.get_objects_inside_radius(pos, 28)
for _, obj in pairs(objs) do

470
readme.MD
View File

@ -1,88 +1,400 @@
# MOBS REDO for MINETEST
Built from PilzAdam's original Simple Mobs with additional mobs by KrupnoPavel, Zeg9, ExeterDad and AspireMint.
Built from PilzAdam's original Simple Mobs with additional mobs by KrupnoPavel,
Zeg9, ExeterDad and AspireMint.
This mod contains the API only for adding your own mobs into the world, so please use the additional modpacks to add animals, monsters etc.
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.
https://forum.minetest.net/viewtopic.php?f=11&t=9917
Crafts:
## Crafts
- Nametag (paper, black dye, string) can be used right-click on a tamed mob to give them a name.
- Nets can be used to right-click tamed mobs to pick them up and place inside inventory as a spawn egg.
- Magic Lasso is similar to nets but with a better chance of picking up larger mobs.
- Shears are used to right-click sheep and return 1-3 wool.
- Protection Rune lets you protect tamed mobs from harm by other players
- Mob Fence and Fence Top (to stop mobs escaping/glitching through fences)
- **Nametag**. Can be crafted by paper, black dye, and string. Can be used
to right-click on a tamed mob to give them a name.
- **Net**. Used to right-click tamed mobs to pick them up and place inside
inventory as a spawn egg.
- **Magic lasso**. Similar to nets but with a better chance of picking up
larger mobs.
- **Shears**. Used to right-click sheep and return 1-3 wool.
- **Protection Rune**. Protects tamed mobs from being harmed by other players.
- **Mob Fence and Fence Top**. Stops mobs escaping or glitching throughfences.
Lucky Blocks: 12
**Lucky Blocks**: 12
Changelog:
- 1.56 - Added arrow_override function to mob definition to tweak arrow entity settings, tamed monsters no longer despawn when outside loaded map area, 'looting_level' can be read from tool definition or tool meta to add extra drops when mob killed. Added injured animation and mob hit effect.
- 1.55 - Add 'peaceful_player' privelage and setting so mobs don't attack specific players (thanks sfence), add support for MarkBu's pathfinder mod, remove need for default mod
- 1.54 - Simplified animal breeding function, added editable settings (thanks Wuzzy), Child mobs now take 20 mins to grow up, reverted to simple mob spawning with setting to use area checks, on_flop added, air_damage added.
- 1.53 - Added 'on_map_load' settings to mobs:spawn so that mobs will only spawn when new areas of map are loaded.
- 1.52 - Added 'mob_active_limit' in settings to set number of mobs in game,
(default is 0 for unlimited), removed {immortal} from mob armor, fluid viscocity slows mobs
- 1.51 - Added some node checks for dangerous nodes, jumping and falling tweaks, spawn area check (thx for idea wuzzy), re-enabled mob suffocation, add 'mob_nospawn_range' setting
- 1.50 - Added new line_of_sight function that uses raycasting if mt5.0 is found, (thanks Astrobe), dont spawn mobs if world anchor nearby (technic or simple_anchor mods), chinese local added
- 1.49- Added mobs:force_capture(self, player) function, api functions now use metatables thanks to bell07
- 1.48- Add mobs:set_velocity(self, velocity) global function
- 1.47- Mob damage changes, min and max light level for damage added, ignition sources checked for lava damage
- 1.46- Mobs only drop rare items when killed by player (drops.min = 0 makes them rare), code tweak, pathfinding no longer sees through walkable nodes
- 1.45- Added Fence Top to add on top of any fence to stop mobs escaping, new line_of_sight tweaked by Astrobe
- 1.44- Added ToolRanks support for swords when attacking mobs
- 1.43- Better 0.4.16 compatibility, added general attack function and settings
- 1.42- Added "all" option to immune_to table, tidied floating mobs to be less intensive
- 1.41- Mob pathfinding has been updated thanks to Elkien3
- 1.40- Updated to use newer functions, requires Minetest 0.4.16+ to work.
- 1.39- Added 'on_breed', 'on_grown' and 'do_punch' custom functions per mob
- 1.38- Better entity checking, nametag setting and on_spawn function added to mob registry, tweaked light damage
- 1.37- Added support for Raymoo's CMI (common mob interface) mod: https://forum.minetest.net/viewtopic.php?f=9&t=15448
- 1.36- Death check added, if mob dies in fire/lava/with lava pick then drops are cooked
- 1.35- Added owner_loyal flag for owned mobs to attack player enemies, also fixed group_attack
- 1.34- Added function to fly mob using directional movement (thanks D00Med for flying code)
- 1.33- Added functions to mount ride mobs (mobs.attach, mobs.detach, mobs.drive) many thanks to Blert2112
- 1.32- Added new spawn check to count specific mobs AND new minetest.conf setting to chance spawn chance and numbers, added ability to protect tamed mobs
- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder.
- 1.30- Added support for invisibility mod (mobs cant attack what they cant see), tweaked and tidied code
- 1.29- Split original Mobs Redo into a modpack to make it easier to disable mob sets (animal, monster, npc) or simply use the Api itself for your own mod
- 1.28- New damage system added with ability for mob to be immune to weapons or healed by them :)
- 1.27- Added new sheep, lava flan and spawn egg textures. New Lava Pick tool smelts what you dig. New atan checking function.
- 1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) also, beehive produces honey now :)
- 1.25- Mobs no longer spawn within 12 blocks of player or despawn within same range, spawners now have player detection, Code tidy and tweak.
- 1.24- Added feature where certain animals run away when punched (runaway = true in mob definition)
- 1.23- Added mob spawner block for admin to setup spawners in-game (place and right click to enter settings)
- 1.22- Added ability to name tamed animals and npc using nametags, also npc will attack anyone who punches them apart from owner
- 1.21- Added some more error checking to reduce serialize.h error and added height checks for falling off cliffs (thanks cmdskp)
- 1.20- Error checking added to remove bad mobs, out of map limit mobs and stop serialize.h error
- 1.19- Chickens now drop egg items instead of placing the egg, also throwing eggs result in 1/8 chance of spawning chick
- 1.18- Added docile_by_day flag so that monsters will not attack automatically during daylight hours unless hit first
- 1.17- Added 'dogshoot' attack type, shoots when out of reach, melee attack when in reach, also api tweaks and self.reach added
- 1.16- Mobs follow multiple items now, Npc's can breed
- 1.15- Added Feeding/Taming/Breeding function, right-click to pick up any sheep with X mark on them and replace with new one to fix compatibility.
- 1.14- All .self variables saved in staticdata, Fixed self.health bug
- 1.13- Added capture function (thanks blert2112) chance of picking up mob with hand; net; magic lasso, replaced some .x models with newer .b3d one's
- 1.12- Added animal ownership so that players cannot steal your tamed animals
- 1.11- Added flying mobs (and swimming), fly=true and fly_in="air" or "deafult:water_source" for fishy
- 1,10- Footstep removed (use replace), explosion routine added for exploding mobs.
- 1.09- reworked breeding routine, added mob rotation value, added footstep feature, added jumping mobs with sounds feature, added magic lasso for picking up animals
- 1.08- Mob throwing attack has been rehauled so that they can damage one another, also drops and on_die function added
- 1.07- Npc's can now be set to follow player or stand by using self.order and self.owner variables
- beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop
- 1.06- Changed recovery times after breeding, and time taken to grow up (can be sped up by feeding baby animal)
- 1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus, also shears added to get wool from sheep and lastly Jordach/BSD's kitten
- 1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :)
- 1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc.
- 1.02- Sheared sheep are remembered and spawn shaven, Warthogs will attack when threatened, Api additions
- 1.01- Mobs that suffer fall damage or die in water/lava/sunlight will now drop items
- 1.0 - more work on Api so that certain mobs can float in water while some sink like a brick :)
- 0.9 - Spawn eggs added for all mobs (admin only, cannot be placed in protected areas)... Api tweaked
- 0.8 - Added sounds to monster mobs (thanks Cyberpangolin for the sfx) and also chicken sound
- 0.7 - mobs.protected switch added to api.lua, when set to 1 mobs no longer spawn in protected areas, also bug fixes
- 0.6 - Api now supports multi-textured mobs, e.g oerkki, dungeon master, rats and chickens have random skins when spawning (sheep fix TODO), also new Honey block
- 0.5 - Mobs now float in water, die from falling, and some code improvements
- 0.4 - Dungeon Masters and Mese Monsters have much better aim due to shoot_offset, also they can both shoot through nodes that aren't walkable (flowers, grass etc) plus new sheep sound :)
- 0.3 - Added LOTT's Spider mob, made Cobwebs, added KPavel's Bee with Honey and Beehives (made texture), Warthogs now have sound and can be tamed, taming of shaved sheep or milked cow with 8 wheat so it will not despawn, many bug fixes :)
- 0.2 - Cooking bucket of milk into cheese now returns empty bucket
- 0.1 - Initial Release
## Changelog
### Version 1.56
* Added `arrow_override` function to mob definition to tweak arrow entity settings
* Added injured animation and mob hit effect
* Tamed monsters no longer despawn when outside loaded map area
* `looting_level` can be read from tool definition or tool meta to add extra
drops when mob killed
### Version 1.55
* Added `peaceful_player` privilege and setting so mobs don't attack specific
players (thanks sfence)
* Added support for MarkBu's `pathfinder` mod, remove need for default mod
### Version 1.54
* **New support for swimming mobs**
- `on_flop` (for mobs not in water)
- `air_damage` added
* Added editable settings (thanks Wuzzy)
* Simplified animal breeding function
* Child mobs now take twenty minutes to grow up
* Reverted to simple mob spawning with setting to use area checks
### Version 1.53
* Added `on_map_load` settings to `mobs:spawn` so that mobs will only spawn
when new areas of map are loaded.
### Version 1.52
* Added `mob_active_limit` in settings to set number of mobs in game. The
default is 0, for unlimited mobs.
* Removed `{immortal}` from mob armor
* Fluid viscocity slows mobs (for example, water)
### Version 1.51
* Added node checks for dangerous nodes
* Add `mob_nospawn_range` setting
* Jumping and falling tweaks
* Spawn area check (thanks for idea wuzzy)
* Re-enabled mob suffocation
### Version 1.50
* Added new `line_of_sight` function that uses raycasting if Minetest 5.0 is
found, (thanks Astrobe)
* Added Chinese local
* Removed ability to spawn mobs if world anchor nearby (`technic` or
`simple_anchor` mods)
### Version 1.49
* Added `mobs:force_capture(self, player)` function
* API functions now use metatables thanks to bell07
### Version 1.48
* Added `mobs:set_velocity(self, velocity)` global function
### Version 1.47
* Added minimum and maximum light level for damage
* Mob damage changes
* Ignition sources checked for lava damage
### Version 1.46
* Mobs only drop rare items when killed by player. You can make change the
drops to rare items by using `drops.min = 0`
* Pathfinding no longer sees through walkable nodes
### Version 1.45
* Added fence top to add on top of any fence to stop mobs escaping
* New `line_of_sight` tweaked by `Astrobe`
### Version 1.44
* Added `ToolRanks` support for swords when attacking mobs
### Version 1.43
* Added general attack function and settings
* Better Minetest 0.4.16 compatibility
### Version 1.42
* Added `"all"` option to `immune_to` definition table
* Tidied floating mobs to be less intensive
### Version 1.41
* Mob pathfinding has been updated thanks to `Elkien3`
### Version 1.40
* Updated to use newer functions, requires Minetest 0.4.16+ to work
### Version 1.39
* **New custom functions**:
- `on_breed` (called when mobs have just been bred)
- `on_grown` (called when baby mobs have grown up)
- `do_punch` (called when the mob has been punched or damaged by another mob)
### Version 1.38
* Better entity checking
* Nametag setting
* `on_spawn` function added to mob registry
* Tweaked light damage
### Version 1.37
* Added support for `Raymoo`'s CMI (common mob interface) mod. See
https://forum.minetest.net/viewtopic.php?f=9&t=15448 for details
### Version 1.36
* Added death check. If the mob dies in fire/lava/with lava pick, then drops
are cooked
### Version 1.35
* Added `owner_loyal` flag for owned mobs to attack player enemies
* Fixed `group_attack`
### Version 1.34
* Added function to fly mob using directional movement (thanks D00Med for
flying code)
### Version 1.33
* Added functions to mount ride mobs:
- `mobs.attach`
- `mobs.detach`
- `mobs.drive`. Many thanks to `Blert2112`
### Version 1.32
* Added new spawn check to count specific mobs AND new `minetest.conf` setting
to chance spawn chance and numbers
* Added ability to protect tamed mobs
### Version 1.31
* Added `attack_animals` and `specific_attack` flags for custom monster
attacks
* Added 'mob_difficulty' .conf setting to make mobs harder
### Version 1.30
* Added support for `invisibility` mod
* Tweaked and tidied code
### Version 1.29
* Split original Mobs Redo into a modpack to make it easier to disable mob sets
(animal, monster, npc) or simply use the API itself for your own mod
### Version 1.28
* Added new damage system with ability for mob to be immune to weapons or
healed by them :)
### Version 1.27
* Added new sheep, lava flan and spawn egg textures
* New Lava Pick tool smelts what you dig
* New `atan` checking function
### Version 1.26
* Pathfinding feature added thanks to rnd
* When monsters attack they become scary smart in finding you :)
* Beehive produces honey now :)
### Version 1.25
* Mobs no longer spawn within 12 blocks of player or despawn within same
range
* Spawners now have player detection
* Tidy and tweak code
### Version 1.24
* Added feature where certain animals run away when punched
(`runaway = true` in mob definition)
### Version 1.23
* Added mob spawner block for admin to setup spawners in-game (place and
right-click to enter settings)
### Version 1.22
* Added ability to name tamed animals and NPCs using nametags
* NPCs will attack anyone who punches them apart from owner
### Version 1.21
* Added some more error checking to reduce `serialize.h` error and added height
checks for falling off cliffs (thanks `cmdskp`)
### Version 1.20
* Error checking added to remove bad mobs
* Out of map limit mobs and stop `serialize.h` error
### Version 1.19
* Chickens now drop egg items instead of placing the egg
* Throwing eggs result in ⅛ chance of spawning chick
### Version 1.18
* Added `docile_by_day` flag so that monsters will not attack automatically
during daylight hours unless hit first
### Version 1.17
* Added `dogshoot` attack type. Mobs now shoot when out of reach
* Melee attack when in reach, also API tweaks and `self.reach` added
### Version 1.16
* Mobs follow multiple items now
* NPCs can now breed
### Version 1.15
* Added feeding, taming, and breeding function
* Right-click to pick up any sheep with X mark on them and replace with new one
to fix compatibility.
### Version 1.14
* All variables saved in staticdata
* Fixed health bug
### Version 1.13
* Added capture function (thanks `blert2112`) chance of picking up mob with a
hand, a net, or a magic lasso
* Replaced some `.x` models with newer `.b3d` ones
### Version 1.12
* Added animal ownership so that players cannot steal your tamed animals
### Version 1.11
* Added flying and swimming mobs
* `fly=true` and `fly_in="air"` or `"default:water_source"` for fishy
### Version 1.10
* Added explosion routine for exploding mob
* Footstep removed (use replace)
### Version 1.09
* Added mob rotation value
* Added footstep feature
* Added jumping mobs with sounds feature
* Aadded magic lasso for picking up animals
* Reworked breeding routine
### Version 1.08
* Added drops that appear when mob is killed
* New custom function: `on_die` function
* Mob throwing attack has been rehauled so that they can damage one another,
### Version 1.07
* NPCs can now be set to follow player or stand by using `order` and `owner`
variables
* BETA: Npc mob added. They kill monsters (maybe as guards) and attack players
when punched by them. Right-clicking them with food will heal them, and
giving them gold lump will make them drop a random item.
### Version 1.06
* Changed recovery times after breeding. Time taken to grow up can be sped up
by feeding the baby animal.
### Version 1.05
* Added `ExeterDad`'s bunniess which can be picked up and tamed with four carrots from `farming_redo` or `farming_plus`
* Added shears to get wool from sheep
* Added Jordach/BSD's kitten
### Version 1.04
* Added mating for sheep, cows and hogs
* Added feature to feed animals to make horny and hope for a baby which is half
size, they will grow up quick though :)
### Version 1.03
* Added mob drop/replace feature so that chickens can drop eggs and cow/sheep
can eat grass/wheat etc.
### Version 1.02
* Sheared sheep are remembered and spawn shaven
* Warthogs will attack when threatened
* API additions
### Version 1.01
* Mobs that suffer fall damage or die in water/lava/sunlight will now drop
items
### Version 1.0
* More work on API so that certain mobs can float in water while some sink like
a brick :)
### Version 0.9
* Spawn eggs added for all mobs (admin only, cannot be placed in protected
areas)
* Tweaked API
### Version 0.8
* Added sounds to monster mobs (thanks `Cyberpangolin` for the `sfx`)
* Added chicken sound
### Version 0.7
* `mobs.protected` switch added to `api.lua`. When set to 1 mobs no longer
spawn in protected areas
* Minor bugfixes
### Version 0.6
* API now supports multi-textured mobs, e.g oerkki, dungeon master, rats and
chickens have random skins when spawning (sheep fix TODO)
* Added new Honey block
### Version 0.5
* Mobs now float in water, die from falling
* Minor code improvements
### Version 0.4
* Added new sheep sound :)
* Dungeon Masters and Mese Monsters have much better aim due to `shoot_offset`
* They can both shoot through nodes that aren't walkable (flowers, grass, etc.)
### Version 0.3
* Added `LOTT`'s Spider mob
* Added Cobwebs
* Added KPavel's Bee with Honey and Beehives (made texture)
* Warthogs now have sound and can be tamed
* Taming of shaved sheep or milked cow with 8 wheat so it will not despawn
* Multiple bug fixes :)
### Version 0.2
* Cooking bucket of milk into cheese now returns empty bucket
### Version 0.1
* Initial Release