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

Version MFF.

This commit is contained in:
sys4-fr
2018-09-08 01:45:44 +02:00
parent 4921956b60
commit 904780573c
269 changed files with 106655 additions and 260 deletions

16
spawner.lua Normal file → Executable file
View File

@ -1,6 +1,6 @@
-- mob spawner
local spawner_default = "mobs:pumba 10 15 0 0"
local spawner_default = "mobs:pig 10 15 0 0"
minetest.register_node("mobs:spawner", {
tiles = {"mob_spawner.png"},
@ -25,6 +25,8 @@ minetest.register_node("mobs:spawner", {
if minetest.is_protected(pos, placer:get_player_name()) then
return
end
-- local meta = minetest.get_meta(pos)
end,
on_receive_fields = function(pos, formname, fields, sender)
@ -46,22 +48,19 @@ minetest.register_node("mobs:spawner", {
local mlig = tonumber(comm[2]) -- min light
local xlig = tonumber(comm[3]) -- max light
local num = tonumber(comm[4]) -- total mobs in area
local pla = tonumber(comm[5]) -- player distance (0 to disable)
local yof = tonumber(comm[6]) -- Y offset to spawn mob
local pla = tonumber(comm[5])-- player distance (0 to disable)
if mob and mob ~= "" and mobs.spawning_mobs[mob] == true
and num and num >= 0 and num <= 10
and mlig and mlig >= 0 and mlig <= 15
and xlig and xlig >= 0 and xlig <= 15
and pla and pla >=0 and pla <= 20
and yof > -10 and yof < 10 then
and pla and pla >=0 and pla <= 20 then
meta:set_string("command", fields.text)
meta:set_string("infotext", "Spawner Active (" .. mob .. ")")
else
minetest.chat_send_player(name, "Mob Spawner settings failed!")
minetest.chat_send_player(name, "> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10]")
end
end,
})
@ -88,7 +87,6 @@ minetest.register_abm({
local xlig = tonumber(comm[3])
local num = tonumber(comm[4])
local pla = tonumber(comm[5]) or 0
local yof = tonumber(comm[6]) or 0
-- if amount is 0 then do nothing
if num == 0 then
@ -137,8 +135,8 @@ 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},
{x = pos.x - 5, y = pos.y, z = pos.z - 5},
{x = pos.x + 5, y = pos.y, z = pos.z + 5},
{"air"})
-- spawn in random air block