1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-07-22 01:50:29 +02:00

Compare commits

...

16 Commits

7 changed files with 389 additions and 262 deletions

589
api.lua

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,9 @@ functions needed for the mob to work properly which contains the following:
punches when nearby.
'group_attack' when true has same mob type grouping together to attack
offender.
'group_helper' string containing mob name that attacks alongside
current mob when group attacking.
mob is attacking in groups.
'attack_type' tells the api what a mob does when attacking the player
or another mob:
'dogfight' is a melee attack when player is within mob reach.
@ -182,6 +185,8 @@ functions needed for the mob to work properly which contains the following:
'child_texture' holds the texture table for when baby mobs are used.
'gotten_texture' holds the texture table for when self.gotten value is
true, used for milking cows or shearing sheep.
'texture_mods' holds a string which overlays a texture on top of the
mob texture e.g. "^saddle.png"
'mesh' holds the name of the external object used for mob model
e.g. "mobs_cow.b3d"
'gotten_mesh" holds the name of the external object used for when
@ -286,7 +291,8 @@ enhance mob functionality and have them do many interesting things:
time_from_last_punch, tool_capabilities, direction), return
false to stop punch damage and knockback from taking place.
'custom_attack' when set this function is called instead of the normal mob
melee attack, parameters are (self, to_attack).
melee attack, parameters are (self, to_attack) and if true
is returned normal attack function continued.
'on_die' a function that is called when mob is killed (self, pos)
'do_custom' a custom function that is called every tick while mob is
active and which has access to all of the self.* variables
@ -633,6 +639,7 @@ External Settings for "minetest.conf"
pathfinding level 2, replace functions or mobs:boom
function.
'mob_nospawn_range' Minimum range a mob can spawn near player (def: 12)
'mob_active_limit' Number of active mobs in game, 0 for unlimited
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

@ -302,8 +302,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
and fields.name
and fields.name ~= "" then
local name = player:get_player_name()
-- does mob still exist?
if not tex_obj
or not tex_obj:get_luaentity() then
@ -318,8 +316,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
-- limit name entered to 64 characters long
if string.len(fields.name) > 64 then
fields.name = string.sub(fields.name, 1, 64)
if fields.name:len() > 64 then
fields.name = fields.name:sub(1, 64)
end
-- update texture

View File

@ -8,19 +8,19 @@ msgstr ""
"Project-Id-Version: Italian locale file for the Mobs Redo module\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-02 16:48+0200\n"
"PO-Revision-Date: 2017-08-18 12:18+0100\n"
"Last-Translator: H4mlet <h4mlet@riseup.net>\n"
"PO-Revision-Date: 2020-05-11 13:33+0200\n"
"Last-Translator: Hamlet <hamlatgitlab@riseup.net>\n"
"Language-Team: \n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.10\n"
"X-Generator: Poedit 2.2.1\n"
#: api.lua
msgid "** Peaceful Mode Active - No Monsters Will Spawn"
msgstr ""
msgstr "** Modalità pacifica attiva - non comparirà nessun mostro"
#: api.lua
msgid "Mob has been protected!"
@ -28,23 +28,23 @@ msgstr "Il mob è stato protetto!"
#: api.lua
msgid "@1 (Tamed)"
msgstr "@1 (Addomesticat*)"
msgstr "@1 (Addomesticato)"
#: api.lua
msgid "Not tamed!"
msgstr "Non addomesticat*!"
msgstr "Non addomesticato!"
#: api.lua
msgid "@1 is owner!"
msgstr "Proprietari* @1!"
msgstr "Il padrone è @1!"
#: api.lua
msgid "Missed!"
msgstr "Mancat*!"
msgstr "Mancato!"
#: api.lua
msgid "Already protected!"
msgstr "Già protett*!"
msgstr "Già protetto!"
#: api.lua
msgid "@1 at full health (@2)"
@ -52,7 +52,7 @@ msgstr "@1 in piena salute (@2)"
#: api.lua
msgid "@1 has been tamed!"
msgstr "@1 è stat* addomesticat*!"
msgstr "@1 è stato addomesticato!"
#: api.lua
msgid "Enter name:"
@ -60,7 +60,7 @@ msgstr "Inserire il nome:"
#: api.lua
msgid "Rename"
msgstr "Rinominare"
msgstr "Rinomina"
#: crafts.lua
msgid "Name Tag"
@ -100,7 +100,7 @@ msgstr "Sella"
#: crafts.lua
msgid "Mob Fence"
msgstr ""
msgstr "Recinzione per mob"
#: spawner.lua
msgid "Mob Spawner"
@ -128,4 +128,4 @@ msgid ""
"distance[1-20] y_offset[-10 to 10]”"
msgstr ""
"Sintassi: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 per "
"disabilitare] distance[1-20] y_offset[-10 to 10]”"
"disabilitare] distance[1-20] y_offset[-10 fino a 10]”"

View File

@ -23,6 +23,8 @@ Lucky Blocks: 9
Changelog:
- 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
- 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

View File

@ -28,5 +28,8 @@ mob_chance_multiplier (Mob chance multiplier) float 1.0
# When false Mob no longer drop items when killed
mobs_drop_items (Mob drops) bool true
#....Sets minimum distance around player that mobs cannot spawn
# Sets minimum distance around player that mobs cannot spawn
mob_nospawn_range (Mob no-spawn range) float 12.0
# Sets maximum number of active mobs in game (0 for unlimited)
mob_active_limit (Mob Active Limit) float 0

View File

@ -19,7 +19,8 @@ minetest.register_node("mobs:spawner", {
-- text entry formspec
meta:set_string("formspec",
"field[text;" .. S("Mob MinLight MaxLight Amount PlayerDist") .. ";${command}]")
"field[text;" .. S("Mob MinLight MaxLight Amount PlayerDist")
.. ";${command}]")
meta:set_string("infotext", S("Spawner Not Active (enter settings)"))
meta:set_string("command", spawner_default)
end,
@ -115,10 +116,10 @@ minetest.register_abm({
-- check objects inside 9x9 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 9)
local count = 0
local ent = nil
local ent
-- count mob objects of same type in area
for k, obj in ipairs(objs) do
for _, obj in ipairs(objs) do
ent = obj:get_luaentity()
@ -136,9 +137,9 @@ minetest.register_abm({
if pla > 0 then
local in_range = 0
local objs = minetest.get_objects_inside_radius(pos, pla)
local objsp = minetest.get_objects_inside_radius(pos, pla)
for _,oir in pairs(objs) do
for _, oir in pairs(objsp) do
if oir:is_player() then
@ -157,8 +158,7 @@ minetest.register_abm({
-- find air blocks within 5 nodes of spawner
local air = minetest.find_nodes_in_area(
{x = pos.x - 5, y = pos.y + yof, z = pos.z - 5},
{x = pos.x + 5, y = pos.y + yof, z = pos.z + 5},
{"air"})
{x = pos.x + 5, y = pos.y + yof, z = pos.z + 5}, {"air"})
-- spawn in random air block
if air and #air > 0 then