Compare commits

..

98 Commits

Author SHA1 Message Date
tenplus1
8201c165e7 can now ride mobs redo mobs in mineclone2 2023-07-27 12:54:46 +01:00
tenplus1
07dce8208b harden is_player checks 2023-07-26 17:43:40 +01:00
tenplus1
e2ee5c62c7 tidy compat 2023-07-26 14:15:03 +01:00
tenplus1
f31cf75b24 better MineClone2 compatibility for api, items and crafts 2023-07-26 13:43:06 +01:00
tenplus1
3106c4c859 change mobs_swing.ogg to mono 2023-07-20 12:25:27 +01:00
tenplus1
dcc702848f can now add nodes to 'runaway_from' table 2023-07-15 08:58:18 +01:00
tenplus1
cc0798b617 add check to see what hit mob, player or entity for immune_to 2023-07-02 17:17:14 +01:00
tenplus1
e32d87c70d add damage_per_second nil check 2023-06-13 07:58:17 +01:00
tenplus1
cf18cd43de on_breed spawns child a little higher 2023-06-09 08:32:59 +01:00
tenplus1
70b562c371 remove htimer, tweak update_tag() 2023-06-07 08:21:34 +01:00
tenplus1
5f80d7a031 add mtobjid mod to optional dependencies, stop mob count going below 0 2023-06-06 08:49:45 +01:00
tenplus1
cc71ea4e95 tweak child textures when growing 2023-05-27 19:29:01 +01:00
tenplus1
b42f7c63c8 added check to be sure creatura mod enabled 2023-05-26 16:27:01 +01:00
tenplus1
05f0550876 monsters will always attack creatura mobs, anything else will defend it's owner if attacked. 2023-05-26 16:17:58 +01:00
tenplus1
194c9f7847 added 'mobs_attack_creatura' setting for monsters to attack Creatura mob mobs 2023-05-26 14:04:50 +01:00
tenplus1
267ee57837 fix jumping when on need to 2023-05-24 07:22:36 +01:00
tenplus1
992d6319de updated readme 2023-05-19 08:53:23 +01:00
tenplus1
b16eefa0ec add 'mob_node_timer_interval' and 'mob_main_timer_interval' settings to handle function timings 2023-05-19 08:46:37 +01:00
tenplus1
29bc2f27f2 have separate get_nodes function for nodes around mob, update api.txt 2023-05-18 11:19:28 +01:00
tenplus1
1e3d26937e tweak do_jump for better blockage checks 2023-05-18 08:53:08 +01:00
tenplus1
ce53afcfdb when attacking dont call unecessary functions every step 2023-05-17 11:36:55 +01:00
tenplus1
14a3dc83e5 if max_light_damage is 16 then use natural light value to damage mob 2023-05-14 10:44:12 +01:00
tenplus1
9c72f0559d update api.txt 2023-05-02 08:38:54 +01:00
tenplus1
9a5d4278ff if min/max light set to 15, only kill mob with natural light 2023-05-02 08:35:12 +01:00
tenplus1
f5ccec9b60 better way to reset pause_timer with "stand" order 2023-04-27 10:21:31 +01:00
tenplus1
6af671997b pause timer reset 2023-04-26 09:53:07 +01:00
tenplus1
eb6bc6e349 mobs ordered to "stand", fix knockback 2023-04-26 09:46:57 +01:00
tenplus1
ce9c30949c fix group attack anim reset, tidy code 2023-04-26 09:16:38 +01:00
tenplus1
6cce24f04e simplify yaw clamping 2023-04-25 12:54:54 +01:00
tenplus1
4bdd8eaa5f 2nd attempt at clamping yaw to stop spinny mobs 2023-04-23 16:34:35 +01:00
tenplus1
36a26d2d21 code tidy 2023-04-03 11:53:05 +01:00
tenplus1
6b9331064c add staticdata clean function, update api.txt 2023-04-03 08:08:37 +01:00
tenplus1
407b2e7b56 reset parent movement after baby born 2023-03-31 14:14:43 +01:00
tenplus1
5e67163d09 fix flying mobs sinking into water 2023-03-28 14:11:30 +01:00
tenplus1
81f99931fc fix nil check for on_spawn 2023-03-28 07:57:31 +01:00
tenplus1
d290062a33 fix friendly fire bug and add provide moveresult information to do_custom 2023-03-27 10:48:05 +01:00
tenplus1
cd4fb6f2a6 add friendly_fire mob setting for arrows (thx eschan145) 2023-03-26 08:31:40 +01:00
tenplus1
3bd2ee8129 code tidy, updated readme (thx eschan145) 2023-03-25 08:47:31 +00:00
tenplus1
076b9480b7 fix type and update readme 2023-03-17 10:30:26 +00:00
tenplus1
7e585b0bdc add check for 'injured' animation 2023-03-13 11:52:59 +00:00
tenplus1
0c2ddab172 fix env timer issue 2023-03-13 11:24:52 +00:00
tenplus1
f4aae8894f add mob_hit_effect switch so mob highlights when punched 2023-03-13 10:55:25 +00:00
tenplus1
c8e8401ac5 add mob_height_fix setting so it can be disabled. 2023-03-12 11:35:21 +00:00
tenplus1
733672127c add animation nil check 2023-03-10 08:09:15 +00:00
tenplus1
59fe1dd976 add return true to on punch 2023-03-04 07:21:54 +00:00
tenplus1
d7ba911181 turn/animate mob on knockback, code tidy 2023-03-03 11:56:49 +00:00
tenplus1
924a545788 update pathfinding defaults to add settings (thx Bla) 2023-02-27 18:13:32 +00:00
tenplus1
92b1a253f0 update api.txt 2023-02-17 09:33:44 +00:00
tenplus1
ba988d514c remove duplicate on_die info (thx Bastrabun) 2023-02-12 10:27:43 +00:00
tenplus1
61b544d493 better water avoidance and escape 2023-02-08 11:59:40 +00:00
tenplus1
bbcdc4b67d fix variable error (thx Niklp) 2023-01-19 17:46:07 +00:00
tenplus1
bbd7a08591 clean aliased mob staticdata 2022-12-22 13:19:24 +00:00
tenplus1
86b6a1a950 check staticdata for egg capture 2022-12-13 12:33:11 +00:00
tenplus1
54cb8f487e remove yaw clamping, causes mob jitters 2022-11-28 13:36:28 +00:00
tenplus1
a88222a744 update license.txt 2022-11-28 09:09:56 +00:00
tenplus1
d64c0aafeb update license.txt 2022-11-26 08:52:09 +00:00
tenplus1
4e963e6b90 update punch sound to cc0 version 2022-11-25 18:47:15 +00:00
tenplus1
d49c0727f1 replace meatblock textures with own, add raw meatblock 2022-11-24 13:22:09 +00:00
tenplus1
5c9e057ad1 add ability to read 'looting_level' from tool definition and meta for extra drops 2022-11-15 10:39:59 +00:00
tenplus1
b0df8145bd update settingtypes.txt 2022-10-31 15:14:52 +00:00
tenplus1
66c1cbe21e add ignore to .luacheckrc 2022-10-31 15:10:32 +00:00
tenplus1
232d1f2df1 update .luacheckrc 2022-10-31 15:08:12 +00:00
tenplus1
d4145ddd3d tidy some luacheckrc warnings 2022-10-31 15:05:34 +00:00
tenplus1
edf846c34c add .uacheckrc file (thanks Niklp) 2022-10-31 14:31:51 +00:00
tenplus1
33beec64dc fix peaceful player check 2022-10-27 16:57:53 +01:00
tenplus1
088bdc5350 localise math.deg 2022-10-21 12:14:11 +01:00
tenplus1
c003c2e72b fix smooth rotation jitters 2022-10-21 11:56:54 +01:00
tenplus1
1450b25ca4 mobs_class made global (be careful anyone changing this) 2022-10-15 08:50:27 +01:00
tenplus1
b74e75ef8b code tidy and default sounds fix 2022-10-07 10:29:23 +01:00
tenplus1
8e3a85546c api.txt updated with mapgen_dirt entry 2022-10-01 07:17:07 +01:00
tenplus1
561903d075 revert node position (git gui test) 2022-09-30 08:32:50 +01:00
tenplus1
bf7ff7ab5f fix node position 2022-09-30 08:31:30 +01:00
tenplus1
431d3844a6 tidy code 2022-09-29 14:15:21 +01:00
tenplus1
b4a8ce71c6 add damage_radius and texture to mobs:boom() 2022-09-22 08:04:58 +01:00
tenplus1
2935d1ee5d have mobs jump slightly when grown to avoid being caught in floor 2022-09-18 11:17:58 +01:00
tenplus1
5bc547b333 tweak mod following to work better 2022-09-06 11:32:50 +01:00
tenplus1
bad1be5c5a check pos/def for nil value in add_mob function 2022-09-03 16:13:41 +01:00
tenplus1
83f0b901a4 add self.messages field 2022-08-04 08:21:59 +01:00
tenplus1
e4ac59609a add mob protection to infotext 2022-07-31 10:20:32 +01:00
tenplus1
7ac8506dda add fallback node for is_node_dangerous 2022-07-29 18:52:28 +01:00
tenplus1
90df44aeaf comment unused vars 2022-07-22 14:12:30 +01:00
tenplus1
25ab9591e4 add 'can_leap' setting to mob def, update api.txt 2022-07-12 08:37:38 +01:00
tenplus1
8e6fa64f2d fix premature mob death and drops 2022-07-07 17:09:34 +01:00
tenplus1
ce7c4c1449 adjust mob count when using /clear_mobs 2022-07-04 11:00:52 +01:00
tenplus1
08dcdf382a add /clear_mobs command 2022-07-04 10:43:28 +01:00
tenplus1
d2a4150dcb extend mob reach when on top of player to fix issue 2022-06-28 08:08:35 +01:00
tenplus1
ca34cc2274 fix api typo (thanks bastrabun :) 2022-05-21 08:04:38 +01:00
tenplus1
168014b86f tidy api 2022-05-14 11:21:36 +01:00
tenplus1
6f8b6fe3f5 select proper animation for flying mobs 2022-05-01 08:15:25 +01:00
tenplus1
dd16d63e8e revert hover 2022-04-30 14:35:59 +01:00
tenplus1
7bb5e2b382 add "hover" animation 2022-04-30 12:26:36 +01:00
tenplus1
7b429df9e9 tweak riding functions 2022-04-21 08:28:35 +01:00
tenplus1
0e72f0ca81 tweak mobs.drive() speed (thanks auouymous) 2022-04-18 08:31:25 +01:00
tenplus1
fb42be6b28 nil checks 2022-03-14 08:29:25 +00:00
tenplus1
f54c3da9d7 add nil check 2022-03-13 16:30:20 +00:00
tenplus1
65e369e5fc add 0.4.x compatibility when riding mod 2022-03-01 09:04:38 +00:00
tenplus1
9f74408792 remove owner infotext if no owner present 2022-02-05 12:25:01 +00:00
tenplus1
18c7f0a422 update translation checks (thanks mckaygerhard) 2022-01-20 08:54:08 +00:00
23 changed files with 1484 additions and 905 deletions

26
.luacheckrc Normal file
View File

@ -0,0 +1,26 @@
unused_args = false
read_globals = {
"minetest",
"lucky_block",
"intllib",
"vector",
"table",
"invisibility",
"cmi",
"toolranks",
"pathfinder",
"tnt",
"ItemStack"
}
globals = {
"mobs",
"player_api",
"default"
}
ignore = {
"431", -- Shadowing an upvalue
"432", -- Shadowing an upvalue argument
}

1452
api.lua

File diff suppressed because it is too large Load Diff

78
api.txt
View File

@ -6,6 +6,17 @@ Welcome to the world of mobs in minetest and hopefully an easy guide to defining
your own mobs and having them appear in your worlds.
Quick Note
----------
Since the mobs redo api checks for nodes around the mob to function, it relies on a
default node incase anything goes wrong, so in the default game this is default:dirt
but for any custom game please make sure the following line is registered with your
preferred dirt node of choice:
minetest.register_alias("mapgen_dirt", "mymod:my_dirt_node")
Registering Mobs
----------------
@ -42,6 +53,8 @@ functions needed for the mob to work properly which contains the following:
randomly turn while walking or standing.
'jump' when true allows your mob to jump updwards.
'jump_height' holds the height your mob can jump, 0 to disable jumping.
'can_leap' when true obstacles like fences or pits wont stop a mob
from trying to jump out.
'stepheight' height of a block that your mob can easily walk up onto,
defaults to 1.1.
'fly' when true allows your mob to fly around instead of walking.
@ -58,6 +71,7 @@ functions needed for the mob to work properly which contains the following:
mob when melee attacking.
'damage_group' group in which damage is dealt, dedaults to "fleshy".
'damage_texture_modifier' applies texture modifier on hit e.g "^[brighten"
or default when enabled is "^[colorize:#c9900070".
'knock_back' when true has mobs falling backwards when hit, the greater
the damage the more they move back.
'fear_height' is how high a cliff or edge has to be before the mob stops
@ -76,6 +90,7 @@ functions needed for the mob to work properly which contains the following:
level is between the min and max values below
'light_damage_min' minimum light value when mob is affected (default: 14)
'light_damage_max' maximum light value when mob is affected (default: 15)
When set to 16 then only natural light will kill mob.
'suffocation' when > 0 mobs will suffocate inside solid blocks and will be
hurt by the value given every second (0 to disable).
'floats' when set to 1 mob will float in water, 0 has them sink.
@ -136,8 +151,11 @@ functions needed for the mob to work properly which contains the following:
arrow/fireball appears on mob.
'specific_attack' has a table of entity names that mob can also attack
e.g. {"player", "mobs_animal:chicken"}.
'runaway_from' contains a table with mob names to run away from, add
"player" to list to runaway from player also.
'friendly_fire` when set to false, mobs will not be able to harm other
mobs of the same type with friendly fire arrows.
Defaults to true.
'runaway_from' contains a table with mob names or nodesto run away
from, add "player" to list to runaway from player also.
'ignore_invisibility' When true mob will still be able to see and attack
player even if invisible (invisibility mod only).
'blood_amount' contains the number of blood droplets to appear when
@ -223,6 +241,9 @@ functions needed for the mob to work properly which contains the following:
'fly_start' when a mob is flying.
'fly_end'
'fly_speed'
'jump_start' when a mob is jumping
'jump_end'
'jump_speed'
'punch_start' when a mob melee attacks.
'punch_end'
'punch_speed'
@ -232,6 +253,9 @@ functions needed for the mob to work properly which contains the following:
'shoot_start' shooting animation.
'shoot_end'
'shoot_speed'
'injured_start' when hit or damaged > 1 hp (if not set then 'walk' is used)
'injured_end'
'injured_speed'
'die_start' death animation
'die_end'
'die_speed'
@ -285,11 +309,9 @@ Custom Definition Functions
Along with the above mob registry settings we can also use custom functions to
enhance mob functionality and have them do many interesting things:
'on_die' a function that is called when the mob is killed the
parameters are (self, pos)
'on_rightclick' its same as in minetest.register_entity()
'on_blast' is called when an explosion happens near mob when using TNT
functions, parameters are (object, damage) and returns
functions, parameters are (damage) and returns
(do_damage, do_knockback, drops)
'on_spawn' is a custom function that runs on mob spawn with 'self' as
variable, return true at end of function to run only once.
@ -330,6 +352,8 @@ for each mob.
'self.child_texture' contains mob child texture when growing up
'self.base_texture' contains current skin texture which was randomly
selected from textures list
'self.texture_mods' contains a list of textures to overlay above the mobs
base texture (used for horse saddle)
'self.gotten' this is used for obtaining milk from cow and wool from
sheep
'self.horny' when animal fed enough it is set to true and animal can
@ -343,6 +367,10 @@ for each mob.
'self.order' set to "follow" or "stand" so that npc will follow owner
or stand it's ground
'self.nametag' contains the name of the mob which it can show above
'self.pause_timer' used to stop mob thinking when punched so that knockback
can take effect.
'self.disable_falling' currently used on spider mob when climbing walls, stops
the mob from experiencing gravity when true.
'self.state' Current mob state.
"stand": no movement (except turning around)
"walk": walk or move around aimlessly
@ -351,6 +379,12 @@ for each mob.
"flop": bounce around aimlessly
(for swimming mobs that have stranded)
"die": during death
'self.standing_on' Node name mob is standing on.
'self.standing_in' Node name mob is standing inside.
'self.looking_at' Node name in front of mob.
'self.looking_above'Node name in front/above mob.
'self.facing_fence' True if mob facing node containing "wall", "fence", "gate"
in it's name.
Adding Mobs in World
@ -415,7 +449,7 @@ the mobs:spawn, so it is recommended to use the above instead.
mobs:register_spawn(name, nodes, max_light, min_light, chance,
active_object_count, max_height, day_toggle)
mobs:spawn_specfic(name, nodes, neighbors, min_light, max_light, interval,
mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
A simpler way to handle mob spawns has been added with the mobs:spawn(def)
@ -521,10 +555,12 @@ Explosion Function
mobs:explosion(pos, radius) -- DEPRECATED!!! use mobs:boom() instead
mobs:boom(self, pos, radius)
mobs:boom(self, pos, radius, damage_radius, texture)
'self' mob entity
'pos' centre position of explosion
'radius' radius of explosion (typically set to 3)
'damage_radius' radius of damage around explosion
'texture' particle texture during explosion, defaults to "tnt_smoke.png"
This function generates an explosion which removes nodes in a specific radius
and damages any entity caught inside the blast radius. Protection will limit
@ -697,14 +733,29 @@ This function returns true if the node name given is harmful to the mob (mob_obj
it is mainly used when a mob is near a node it has to avoid.
Looting Level
-------------
If a tool is used with 'looting_level' defined under tool_capabilities then mobs can drop
extra items per level up to a maximum of 3 levels. 'looting_level' can also be read from
the tools own meta to override the default.
External Settings for "minetest.conf"
------------------------------------
'mob_node_timer_interval' How often mobs get nodes around them (0.25 is default)
for every 1/4 second.
'mob_main_timer_interval' How often mobs run main functions (1.0 is default) for
every one second.
'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
damage_texture_modifier is used to highlight mob.
'mobs_spawn_protected' if set to false then mobs will not spawn in protected
areas (default is true)
'mobs_spawn_monster_protected' if set to false then monsters will not spawn in
@ -715,8 +766,6 @@ External Settings for "minetest.conf"
spawn number e.g. mobs_animal:cow = 1000,5
'mob_difficulty' sets difficulty level (health and hit damage
multiplied by this number), defaults to 1.0.
'mob_show_health' if false then punching mob will not show health status
(true by default)
'mob_chance_multiplier' multiplies chance of all mobs spawning and can be set
to 0.5 to have mobs spawn more or 2.0 to spawn less.
e.g. 1 in 7000 * 0.5 = 1 in 3500 so better odds of
@ -733,6 +782,17 @@ External Settings for "minetest.conf"
mob for obstructions before spawning, otherwise it
defaults to checking the height of the mob only.
'mob_smooth_rotate' Enables smooth rotation when mobs turn by default.
'mob_height_fix' Enabled by default, increases smaller mob heights so they wont
glitch through certain nodes.
'mob_pathfinding_enable' Enable pathfinding.
'mob_pathfinder_enable' Use pathfinder mod if available.
'mob_pathfinding_stuck_timeout' How long before stuck mobs start searching. (default 3.0)
'mob_pathfinding_stuck_path_timeout' How long will mob follow path before giving up. (default 5.0)
'mob_pathfinding_algorithm' Which pathfinding algorithm to use Dijkstra (default), A*_noprefetch (AStar_noprefetch) or A* (AStar)
(A* names differ cause Minetest doesn´t allow "*" in settings)
'mob_pathfinding_searchdistance' max search distance from search positions (default 16)
'mob_pathfinding_max_jump' max jump height for pathfinding (default 4)
'mob_pathfinding_max_drop' max drop height for pathfinding (default 6)
Players can override the spawn chance for each mob registered by adding a line
to their minetest.conf file with a new value, the lower the value the more each

View File

@ -1,5 +1,24 @@
local S = mobs.intllib
local mc2 = minetest.get_modpath("mcl_core")
-- recipe items
local items = {
paper = mc2 and "mcl_core:paper" or "default:paper",
dye_black = mc2 and "mcl_dye:black" or "dye:black",
string = mc2 and "mcl_mobitems:string" or "farming:string",
stick = mc2 and "mcl_core:stick" or "default:stick",
diamond = mc2 and "mcl_core:diamond" or "default:diamond",
steel_ingot = mc2 and "mcl_core:iron_ingot" or "default:steel_ingot",
gold_block = mc2 and "mcl_core:goldblock" or "default:goldblock",
diamond_block = mc2 and "mcl_core:diamondblock" or "default:diamondblock",
stone = mc2 and "mcl_core:stone" or "default:stone",
mese_crystal = mc2 and "mcl_core:gold_ingot" or "default:mese_crystal",
wood = mc2 and "mcl_core:wood" or "default:wood",
fence_wood = mc2 and "group:fence_wood" or "default:fence_wood",
meat_raw = mc2 and "mcl_mobitems:beef" or "group:food_meat_raw",
meat_cooked = mc2 and "mcl_mobitems:cooked_beef" or "group:food_meat",
}
-- name tag
minetest.register_craftitem("mobs:nametag", {
@ -8,12 +27,12 @@ minetest.register_craftitem("mobs:nametag", {
groups = {flammable = 2, nametag = 1}
})
if minetest.get_modpath("dye") and minetest.get_modpath("farming") then
minetest.register_craft({
output = "mobs:nametag",
recipe = {{"default:paper", "dye:black", "farming:string"}}
})
end
minetest.register_craft({
output = "mobs:nametag",
recipe = {
{ items.paper, items.dye_black, items.string }
}
})
-- leather
minetest.register_craftitem("mobs:leather", {
@ -52,16 +71,14 @@ minetest.register_tool("mobs:lasso", {
groups = {flammable = 2}
})
if minetest.get_modpath("farming") then
minetest.register_craft({
output = "mobs:lasso",
recipe = {
{"farming:string", "", "farming:string"},
{"", "default:diamond", ""},
{"farming:string", "", "farming:string"}
}
})
end
minetest.register_craft({
output = "mobs:lasso",
recipe = {
{ items.string, "", items.string},
{ "", items.diamond, "" },
{ items.string, "", items.string }
}
})
minetest.register_alias("mobs:magic_lasso", "mobs:lasso")
@ -72,16 +89,14 @@ minetest.register_tool("mobs:net", {
groups = {flammable = 2}
})
if minetest.get_modpath("farming") then
minetest.register_craft({
output = "mobs:net",
recipe = {
{"group:stick", "", "group:stick"},
{"group:stick", "", "group:stick"},
{"farming:string", "group:stick", "farming:string"}
}
})
end
minetest.register_craft({
output = "mobs:net",
recipe = {
{ items.stick, "", items.stick },
{ items.stick, "", items.stick },
{ items.string, items.stick, items.string }
}
})
-- shears (right click to shear animal)
minetest.register_tool("mobs:shears", {
@ -93,8 +108,8 @@ minetest.register_tool("mobs:shears", {
minetest.register_craft({
output = "mobs:shears",
recipe = {
{"", "default:steel_ingot", ""},
{"", "group:stick", "default:steel_ingot"}
{ "", items.steel_ingot, "" },
{ "", items.stick, items.steel_ingot }
}
})
@ -108,9 +123,9 @@ minetest.register_craftitem("mobs:protector", {
minetest.register_craft({
output = "mobs:protector",
recipe = {
{"default:stone", "default:stone", "default:stone"},
{"default:stone", "default:goldblock", "default:stone"},
{"default:stone", "default:stone", "default:stone"}
{ items.stone, items.stone, items.stone },
{ items.stone, items.gold_block, items.stone },
{ items.stone, items.stone, items.stone }
}
})
@ -124,9 +139,9 @@ minetest.register_craftitem("mobs:protector2", {
minetest.register_craft({
output = "mobs:protector2",
recipe = {
{"mobs:protector", "default:mese_crystal", "mobs:protector"},
{"default:mese_crystal", "default:diamondblock", "default:mese_crystal"},
{"mobs:protector", "default:mese_crystal", "mobs:protector"}
{ "mobs:protector", items.mese_crystal, "mobs:protector" },
{ items.mese_crystal, items.diamond_block, items.mese_crystal },
{ "mobs:protector", items.mese_crystal, "mobs:protector" }
}
})
@ -141,14 +156,16 @@ minetest.register_craft({
output = "mobs:saddle",
recipe = {
{"mobs:leather", "mobs:leather", "mobs:leather"},
{"mobs:leather", "default:steel_ingot", "mobs:leather"},
{"mobs:leather", "default:steel_ingot", "mobs:leather"}
{"mobs:leather", items.steel_ingot, "mobs:leather"},
{"mobs:leather", items.steel_ingot, "mobs:leather"}
}
})
-- make sure we can register fences
if minetest.get_modpath("default") and default.register_fence then
local mod_def = minetest.get_modpath("default")
if mod_def and default.register_fence then
-- mob fence (looks like normal fence but collision is 2 high)
default.register_fence("mobs:fence_wood", {
@ -156,7 +173,7 @@ default.register_fence("mobs:fence_wood", {
texture = "default_wood.png",
material = "default:fence_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
sounds = mod_def and default.node_sound_wood_defaults(),
collision_box = {
type = "fixed",
fixed = {
@ -174,7 +191,7 @@ minetest.register_node("mobs:fence_top", {
paramtype = "light",
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
sounds = mod_def and default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
@ -193,7 +210,7 @@ minetest.register_craft({
output = "mobs:fence_top 12",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"", "default:fence_wood", ""}
{"", items.fence_wood, ""}
}
})
@ -244,6 +261,7 @@ minetest.register_craft({
-- this tool spawns same mob and adds owner, protected, nametag info
-- then removes original entity, this is used for fixing any issues.
-- also holding sneak while punching mob lets you change texture name.
local tex_obj
@ -353,23 +371,49 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end)
-- Meat Block (thanks to painterlypack.net for allowing me to use these textures)
-- Meat Block
minetest.register_node("mobs:meatblock", {
description = S("Meat Block"),
tiles = {"mobs_meat_top.png", "mobs_meat_bottom.png", "mobs_meat_side.png"},
paramtype2 = "facedir",
groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default and default.node_sound_leaves_defaults(),
sounds = mod_def and default.node_sound_leaves_defaults(),
on_place = minetest.rotate_node,
on_use = minetest.item_eat(20)
})
minetest.register_craft({
output = "mobs:meatblock",
-- type = "shapeless",
recipe = {
{"group:food_meat", "group:food_meat", "group:food_meat"},
{"group:food_meat", "group:food_meat", "group:food_meat"},
{"group:food_meat", "group:food_meat", "group:food_meat"}
{ items.meat_cooked, items.meat_cooked, items.meat_cooked },
{ items.meat_cooked, items.meat_cooked, items.meat_cooked },
{ items.meat_cooked, items.meat_cooked, items.meat_cooked }
}
})
-- Meat Block (raw)
minetest.register_node("mobs:meatblock_raw", {
description = S("Raw Meat Block"),
tiles = {"mobs_meat_raw_top.png", "mobs_meat_raw_bottom.png", "mobs_meat_raw_side.png"},
paramtype2 = "facedir",
groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = mod_def and default.node_sound_leaves_defaults(),
on_place = minetest.rotate_node,
on_use = minetest.item_eat(20)
})
minetest.register_craft({
output = "mobs:meatblock_raw",
recipe = {
{ items.meat_raw, items.meat_raw, items.meat_raw },
{ items.meat_raw, items.meat_raw, items.meat_raw },
{ items.meat_raw, items.meat_raw, items.meat_raw }
}
})
minetest.register_craft({
type = "cooking",
output = "mobs:meatblock",
recipe = "mobs:meatblock_raw",
cooktime = 30
})

View File

@ -8,3 +8,5 @@ lucky_block?
cmi?
toolranks?
pathfinder?
player_api?
mtobjid?

View File

@ -7,6 +7,7 @@ minetest.register_privilege("peaceful_player", {
give_to_singleplayer = false
})
-- Mob API
dofile(path .. "/api.lua")

View File

@ -1,3 +0,0 @@
-- Support for the old multi-load method
return dofile(minetest.get_modpath("intllib").."/init.lua")

View File

@ -19,3 +19,19 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Textures under CC0 license by TenPlus1
ShadowNinja (CC BY-SA 3.0):
tnt_smoke.png
mobs_swing.ogg by qubodup (CC0)
- http://freesound.org/people/qubodup/sounds/60012/
mobs_spell.ogg by littlerobotsoundfactory (CC0)
- http://freesound.org/people/LittleRobotSoundFactory/sounds/270396/
mobs_punch.ogg by Merrick079 (CC0)
- https://freesound.org/people/Merrick079/sounds/566436/

View File

@ -1,4 +1,4 @@
name = mobs
depends =
optional_depends = default, tnt, dye, farming, invisibility, intllib, lucky_block, cmi, toolranks, pathfinder
optional_depends = default, tnt, dye, farming, invisibility, intllib, lucky_block, cmi, toolranks, pathfinder, player_api, mtobjid
description = Adds a mob api for mods to add animals or monsters etc.

128
mount.lua
View File

@ -1,14 +1,30 @@
-- lib_mount by Blert2112 (edited by TenPlus1)
--[[ one of these is needed (for now) to ride mobs, otherwise no riding for you
if not minetest.get_modpath("default")
or not minetest.get_modpath("player_api") then
function mobs.attach() end
function mobs.detach() end
function mobs.fly() end
function mobs.drive() end
return
end
]]
local is_50 = minetest.get_modpath("player_api") -- 5.x compatibility
local is_mc2 = minetest.get_modpath("mcl_mobs") -- MineClone2 compatibility
local abs, cos, floor, sin, sqrt, pi =
math.abs, math.cos, math.floor, math.sin, math.sqrt, math.pi
------------------------------------------------------------------------------
--
-- Helper functions
--
local node_ok = function(pos, fallback)
fallback = fallback or mobs.fallback_node
local node = minetest.get_node_or_nil(pos)
@ -46,6 +62,7 @@ end
local function get_sign(i)
i = i or 0
if i == 0 then
@ -57,6 +74,7 @@ end
local function get_velocity(v, yaw, y)
local x = -sin(yaw) * v
local z = cos(yaw) * v
@ -71,7 +89,7 @@ end
local function force_detach(player)
local attached_to = player:get_attach()
local attached_to = player and player:get_attach()
if not attached_to then
return
@ -79,25 +97,35 @@ local function force_detach(player)
local entity = attached_to:get_luaentity()
if entity and entity.driver
and entity.driver == player then
if entity and entity.driver and entity.driver == player then
entity.driver = nil
end
player:set_detach()
player_api.player_attached[player:get_player_name()] = false
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player_api.set_animation(player, "stand", 30)
player:set_properties({visual_size = {x = 1, y = 1}})
local name = player:get_player_name()
if is_50 then
player_api.player_attached[name] = false
player_api.set_animation(player, "stand", 30)
elseif is_mc2 then
mcl_player.player_attached[player:get_player_name()] = false
mcl_player.player_set_animation(player, "stand", 30)
else
default.player_attached[name] = false
default.player_set_animation(player, "stand", 30)
end
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_properties({visual_size = {x = 1, y = 1}})
end
-------------------------------------------------------------------------------
minetest.register_on_leaveplayer(function(player)
force_detach(player)
end)
minetest.register_on_shutdown(function()
local players = minetest.get_connected_players()
@ -107,12 +135,12 @@ minetest.register_on_shutdown(function()
end
end)
minetest.register_on_dieplayer(function(player)
force_detach(player)
return true
end)
-------------------------------------------------------------------------------
-- Just for correct detaching
local function find_free_pos(pos)
@ -137,8 +165,7 @@ local function find_free_pos(pos)
local def = minetest.registered_nodes[node.name]
if def and not def.walkable and
def.liquidtype == "none" then
if def and not def.walkable and def.liquidtype == "none" then
return npos
end
end
@ -147,7 +174,15 @@ local function find_free_pos(pos)
return pos
end
-------------------------------------------------------------------------------
-- are we a real player ?
local function is_player(player)
if player and type(player) == "userdata" and minetest.is_player(player) then
return true
end
end
function mobs.attach(entity, player)
@ -169,8 +204,15 @@ function mobs.attach(entity, player)
force_detach(player)
if is_50 then
player_api.player_attached[player:get_player_name()] = true
elseif is_mc2 then
mcl_player.player_attached[player:get_player_name()] = true
else
default.player_attached[player:get_player_name()] = true
end
player:set_attach(entity.object, "", attach_at, entity.player_rotation)
player_api.player_attached[player:get_player_name()] = true
player:set_eye_offset(eye_offset, {x = 0, y = 0, z = 0})
player:set_properties({
@ -182,8 +224,15 @@ function mobs.attach(entity, player)
minetest.after(0.2, function()
if player and player:is_player() then
player_api.set_animation(player, "sit", 30)
if is_player(player) then
if is_50 then
player_api.set_animation(player, "sit", 30)
elseif is_mc2 then
mcl_player.player_set_animation(player, "sit_mount" , 30)
else
default.player_set_animation(player, "sit", 30)
end
end
end)
@ -192,6 +241,7 @@ end
function mobs.detach(player)
force_detach(player)
minetest.after(0.1, function()
@ -227,19 +277,17 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
local ctrl = entity.driver:get_player_control()
-- move forwards
if ctrl.up then
if ctrl.up then -- move forwards
entity.v = entity.v + entity.accel / 10
entity.v = entity.v + entity.accel * dtime
-- move backwards
elseif ctrl.down then
elseif ctrl.down then -- move backwards
if entity.max_speed_reverse == 0 and entity.v == 0 then
return
end
entity.v = entity.v - entity.accel / 10
entity.v = entity.v - entity.accel * dtime
end
-- mob rotation
@ -262,8 +310,8 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
entity.object:set_yaw(horz - entity.rotate)
if can_fly then
-- fly up
if ctrl.jump then
if ctrl.jump then -- fly up
velo.y = velo.y + 1
@ -271,13 +319,12 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
elseif velo.y > 0 then
velo.y = velo.y - 0.1
velo.y = velo.y - dtime
if velo.y < 0 then velo.y = 0 end
end
-- fly down
if ctrl.sneak then
if ctrl.sneak then -- fly down
velo.y = velo.y - 1
@ -285,13 +332,12 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
elseif velo.y < 0 then
velo.y = velo.y + 0.1
velo.y = velo.y + dtime
if velo.y > 0 then velo.y = 0 end
end
else
-- jump
if ctrl.jump then
if ctrl.jump then -- jump
if velo.y == 0 then
velo.y = velo.y + entity.jump_height
@ -330,14 +376,10 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
end
-- enforce speed limit forward and reverse
local max_spd = entity.max_speed_reverse
if get_sign(entity.v) >= 0 then
max_spd = entity.max_speed_forward
end
if abs(entity.v) > max_spd then
entity.v = entity.v - get_sign(entity.v)
if entity.v > entity.max_speed_forward then
entity.v = entity.max_speed_forward
elseif entity.v < -entity.max_speed_reverse then
entity.v = -entity.max_speed_reverse
end
-- Set position, velocity and acceleration
@ -345,7 +387,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
if not p then return end
local new_acce = {x = 0, y = -9.81, z = 0}
local new_acce = {x = 0, y = entity.fall_speed, z = 0}
p.y = p.y - 0.5
@ -428,13 +470,12 @@ end
function mobs.fly(entity, _, speed, shoots, arrow, moving_anim, stand_anim)
local ctrl = entity.driver:get_player_control() ; if not ctrl then return end
local velo = entity.object:get_velocity()
local velo = entity.object:get_velocity() ; if not velo then return end
local dir = entity.driver:get_look_dir()
local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands
if not ctrl or not velo then return end
local yaw = entity.driver:get_look_horizontal() + 1.57
if ctrl.up then
entity.object:set_velocity({
x = dir.x * speed,
y = dir.y * speed + 2,
@ -470,6 +511,7 @@ if not ctrl or not velo then return end
ent.switch = 1 -- for mob specific arrows
ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding
local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6}
yaw = entity.driver:get_look_horizontal()

485
readme.MD
View File

@ -1,93 +1,412 @@
# MOBS REDO for MINETEST
MOBS REDO for MINETEST
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.
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, and npcs.
https://forum.minetest.net/viewtopic.php?f=11&t=9917
## Crafts
Crafts:
- **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.
- 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)
**Lucky Blocks**: 12
Lucky Blocks: 9
## Changelog
### Version 1.57
* Added 'injured' animation when mob hurt
* Fixed yaw clamping to stop spinning mobs
* Added 'mob_node_timer_interval' and 'mob_main_timer_interval' settings
* 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
* Nodes can be added to 'runaway_from' table
* Better Mineclone2 compatibility with api, items and recipes
### 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
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.
- 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
* 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

View File

@ -1,3 +1,12 @@
# 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
# How often mobs run main functions (default is 1.00, 1 second)
mob_main_timer_interval (Mob Node Timer Interval) float 1.00
# If false then mobs no longer spawn in world without spawner or spawn egg
mobs_spawn (Spawn Mobs) bool true
@ -7,6 +16,9 @@ only_peaceful_mobs (Only spawn peaceful Mobs) bool false
# If enabled then punching mobs no longer shows blood effects
mobs_disable_blood (Disable Mob blood) bool false
# If enabled the mobs will be highlighted when hit
mob_hit_effect (Highlight Mob when Hit) bool false
# If disabled then Mobs no longer destroy world blocks
mobs_griefing (Griefing Mobs) bool true
@ -22,9 +34,6 @@ remove_far_mobs (Remove far Mobs) bool true
# Sets Mob difficulty level by multiplying punch damage
mob_difficulty (Mob difficulty) float 1.0
# If disabled health status no longer appears above Mob when punched
mob_show_health (Show Mob health) bool true
# Contains a value used to multiply Mob spawn values
mob_chance_multiplier (Mob chance multiplier) float 1.0
@ -45,3 +54,28 @@ enable_peaceful_player (Mobs do not attack peaceful player without reason) bool
# Enable mobs smooth rotation
mob_smooth_rotate (Smooth rotation for mobs) bool true
# Fix Mob Height if too low so they cannot escape through specific nodes
mob_height_fix (Fix Mob Height) bool true
[Pathfinding]
# Enable pathfinding (default Enabled)
mob_pathfinding_enable (Enable pathfinding) bool true
# Use pathfinder mod if available (default Enabled)
mob_pathfinder_enable (Use pathfinder mod if available) bool true
# How long before stuck mobs starts searching (default 3.0)
mob_pathfinding_stuck_timeout (How long before stuck mobs start searching) float 3.0
# How long will mob follow path before giving up (default 5.0)
mob_pathfinding_stuck_path_timeout (How long will mob follow path before giving up) float 5.0
# Which pathfinding algorithm to use
# - Dijkstra (default)
# - A*_noprefetch (AStar_noprefetch)
# - A* (AStar)
# (A* names differ cause Minetest doesn´t allow "*" in settings)
mob_pathfinding_algorithm (pathfinding algorithm) enum Dijkstra Dijkstra,AStar_noprefetch,AStar
# max search distance from search positions (default 16)
mob_pathfinding_searchdistance (path search distance) int 16
# max jump height for pathfinding (default 4)
mob_pathfinding_max_jump (path max jump height) int 4
# max drop height for pathfinding (default 6)
mob_pathfinding_max_drop (path max drop height) int 6

Binary file not shown.

View File

@ -1,7 +0,0 @@
Creative Commons sounds from Freesound.org
mobs_swing.ogg by qubodup
- http://freesound.org/people/qubodup/sounds/60012/
mobs_spell.ogg by littlerobotsoundfactory
- http://freesound.org/people/LittleRobotSoundFactory/sounds/270396/

BIN
sounds/mobs_punch.ogg Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,17 @@
local S = mobs.intllib
-- mob spawner
-- are we a real player ?
local function is_player(player)
if player and type(player) == "userdata" and minetest.is_player(player) then
return true
end
end
-- mob spawner
local spawner_default = "mobs_animal:pumba 10 15 0 0 0"
minetest.register_node("mobs:spawner", {
@ -148,7 +157,7 @@ minetest.register_abm({
for _, oir in pairs(objsp) do
if oir:is_player() then
if is_player(oir) then
in_range = 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 748 B