small fix for mobs spawners and added ores spawners
@ -1,6 +1,6 @@
|
|||||||
-- main tables
|
-- main tables
|
||||||
spawners = {}
|
spawners_mobs = {}
|
||||||
spawners.mob_tables = {}
|
spawners_mobs.mob_tables = {}
|
||||||
|
|
||||||
-- check if mods exists and build tables
|
-- check if mods exists and build tables
|
||||||
for k, mob_mod in ipairs(ENABLED_MODS) do
|
for k, mob_mod in ipairs(ENABLED_MODS) do
|
||||||
@ -13,8 +13,7 @@ for k, mob_mod in ipairs(ENABLED_MODS) do
|
|||||||
-- disabled extra check for mobs redo due to incompatibility with Lua 5.1, this method is available from Lua 5.2
|
-- disabled extra check for mobs redo due to incompatibility with Lua 5.1, this method is available from Lua 5.2
|
||||||
-- if mob_mod == "mobs" and not (mobs.mod == "redo") then goto continue end
|
-- if mob_mod == "mobs" and not (mobs.mod == "redo") then goto continue end
|
||||||
|
|
||||||
table.insert(spawners.mob_tables, {name=mob.name, mod_prefix=mob_mod, egg_name_custom=mob.egg_name_custom, dummy_size=mob.dummy_size, dummy_offset=mob.dummy_offset, dummy_mesh=mob.dummy_mesh, dummy_texture=mob.dummy_texture, night_only=mob.night_only, sound_custom=mob.sound_custom})
|
table.insert(spawners_mobs.mob_tables, {name=mob.name, mod_prefix=mob_mod, egg_name_custom=mob.egg_name_custom, dummy_size=mob.dummy_size, dummy_offset=mob.dummy_offset, dummy_mesh=mob.dummy_mesh, dummy_texture=mob.dummy_texture, night_only=mob.night_only, sound_custom=mob.sound_custom})
|
||||||
|
|
||||||
-- use custom egg or create a default egg
|
-- use custom egg or create a default egg
|
||||||
if mob.egg_name_custom ~= "" then
|
if mob.egg_name_custom ~= "" then
|
||||||
mob_egg = mob.egg_name_custom
|
mob_egg = mob.egg_name_custom
|
||||||
@ -40,7 +39,7 @@ for k, mob_mod in ipairs(ENABLED_MODS) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- start spawning mobs
|
-- start spawning mobs
|
||||||
function spawners.start_spawning(pos, how_many, mob_name, mod_prefix, sound_custom)
|
function spawners_mobs.start_spawning(pos, how_many, mob_name, mod_prefix, sound_custom)
|
||||||
if not (pos or how_many or mob_name) then return end
|
if not (pos or how_many or mob_name) then return end
|
||||||
|
|
||||||
local sound_name
|
local sound_name
|
||||||
@ -80,7 +79,7 @@ function spawners.start_spawning(pos, how_many, mob_name, mod_prefix, sound_cust
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawners.check_around_radius(pos)
|
function spawners_mobs.check_around_radius(pos)
|
||||||
local player_near = false
|
local player_near = false
|
||||||
local radius = 21
|
local radius = 21
|
||||||
|
|
||||||
@ -93,8 +92,8 @@ function spawners.check_around_radius(pos)
|
|||||||
return player_near
|
return player_near
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawners.check_node_status(pos, mob, night_only)
|
function spawners_mobs.check_node_status(pos, mob, night_only)
|
||||||
local player_near = spawners.check_around_radius(pos)
|
local player_near = spawners_mobs.check_around_radius(pos)
|
||||||
|
|
||||||
if player_near then
|
if player_near then
|
||||||
local random_pos = false
|
local random_pos = false
|
||||||
|
@ -2,4 +2,4 @@ default
|
|||||||
xpanes?
|
xpanes?
|
||||||
fire?
|
fire?
|
||||||
mobs?
|
mobs?
|
||||||
creatures?
|
creatures?
|
@ -15,4 +15,4 @@ if minetest.get_modpath("mobs") then
|
|||||||
dofile(minetest.get_modpath(MOD_NAME).."/nodes_additional.lua")
|
dofile(minetest.get_modpath(MOD_NAME).."/nodes_additional.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
print ("[Mod] Spawners Mobs 0.6 Loaded.")
|
print ("[Mod] Spawners Mobs 0.6 Loaded.")
|
||||||
|
@ -4,7 +4,7 @@ local max_obj_per_mapblock = tonumber(minetest.setting_get("max_objects_per_bloc
|
|||||||
-- * CREATE ALL SPAWNERS NODES *
|
-- * CREATE ALL SPAWNERS NODES *
|
||||||
--
|
--
|
||||||
|
|
||||||
function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom)
|
function spawners_mobs.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom)
|
||||||
|
|
||||||
--
|
--
|
||||||
-- DUMMY INSIDE THE SPAWNER
|
-- DUMMY INSIDE THE SPAWNER
|
||||||
@ -127,7 +127,7 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
groups = {cracky=1,level=2},
|
groups = {cracky=1,level=2},
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
local random_pos, waiting = spawners_mobs.check_node_status(pos, mob_name, night_only)
|
||||||
|
|
||||||
if random_pos then
|
if random_pos then
|
||||||
minetest.set_node(pos, {name="spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
minetest.set_node(pos, {name="spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
||||||
@ -180,7 +180,7 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
|
||||||
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
local random_pos, waiting = spawners_mobs.check_node_status(pos, mob_name, night_only)
|
||||||
|
|
||||||
-- minetest.log("action", "[Mod][Spawners] checking for: "..mob_name.." at "..minetest.pos_to_string(pos))
|
-- minetest.log("action", "[Mod][Spawners] checking for: "..mob_name.." at "..minetest.pos_to_string(pos))
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- enough place to spawn more mobs
|
-- enough place to spawn more mobs
|
||||||
spawners.start_spawning(random_pos, 1, "spawners_mobs:"..mob_name, mod_prefix, sound_custom)
|
spawners_mobs.start_spawning(random_pos, 1, "spawners_mobs:"..mob_name, mod_prefix, sound_custom)
|
||||||
|
|
||||||
elseif waiting then
|
elseif waiting then
|
||||||
-- waiting status
|
-- waiting status
|
||||||
@ -235,9 +235,9 @@ end
|
|||||||
-- CALL 'CREATE' FOR ALL SPAWNERS
|
-- CALL 'CREATE' FOR ALL SPAWNERS
|
||||||
--
|
--
|
||||||
|
|
||||||
for i, mob_table in ipairs(spawners.mob_tables) do
|
for i, mob_table in ipairs(spawners_mobs.mob_tables) do
|
||||||
if mob_table then
|
if mob_table then
|
||||||
|
|
||||||
spawners.create(mob_table.name, mob_table.mod_prefix, mob_table.dummy_size, mob_table.dummy_offset, mob_table.dummy_mesh, mob_table.dummy_texture, mob_table.night_only, mob_table.sound_custom)
|
spawners_mobs.create(mob_table.name, mob_table.mod_prefix, mob_table.dummy_size, mob_table.dummy_offset, mob_table.dummy_mesh, mob_table.dummy_texture, mob_table.night_only, mob_table.sound_custom)
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,7 +1,7 @@
|
|||||||
-- main tables
|
-- main tables
|
||||||
spawners = {}
|
spawners_ores = {}
|
||||||
|
|
||||||
function spawners.add_effects(pos, radius)
|
function spawners_ores.add_effects(pos, radius)
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 32,
|
amount = 32,
|
||||||
time = 2,
|
time = 2,
|
||||||
@ -15,12 +15,12 @@ function spawners.add_effects(pos, radius)
|
|||||||
maxexptime = 2,
|
maxexptime = 2,
|
||||||
minsize = .5,
|
minsize = .5,
|
||||||
maxsize = 8,
|
maxsize = 8,
|
||||||
texture = "spawners_smoke_particle.png",
|
texture = "spawners_ores_smoke_particle.png",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- start spawning ores
|
-- start spawning ores
|
||||||
function spawners.start_spawning_ores(pos, ore_name, sound_custom, spawners_pos)
|
function spawners_ores.start_spawning_ores(pos, ore_name, sound_custom, spawners_pos)
|
||||||
if not pos or not ore_name then return end
|
if not pos or not ore_name then return end
|
||||||
local sound_name
|
local sound_name
|
||||||
local player_near = false
|
local player_near = false
|
||||||
@ -38,7 +38,7 @@ function spawners.start_spawning_ores(pos, ore_name, sound_custom, spawners_pos)
|
|||||||
for i=1, how_many do
|
for i=1, how_many do
|
||||||
|
|
||||||
if i > 1 then
|
if i > 1 then
|
||||||
player_near, pos = spawners.check_around_radius_ores(pos, "default:stone")
|
player_near, pos = spawners_ores.check_around_radius_ores(pos, "default:stone")
|
||||||
|
|
||||||
if not pos then return end
|
if not pos then return end
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ function spawners.start_spawning_ores(pos, ore_name, sound_custom, spawners_pos)
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.set_node(pos, {name=ore_name})
|
minetest.set_node(pos, {name=ore_name})
|
||||||
spawners.add_effects(pos, 1)
|
spawners_ores.add_effects(pos, 1)
|
||||||
else
|
else
|
||||||
minetest.sound_play(sound_name, {
|
minetest.sound_play(sound_name, {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
@ -58,14 +58,28 @@ function spawners.start_spawning_ores(pos, ore_name, sound_custom, spawners_pos)
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.set_node(pos, {name=ore_name})
|
minetest.set_node(pos, {name=ore_name})
|
||||||
spawners.add_effects(pos, 1)
|
spawners_ores.add_effects(pos, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawners.check_around_radius_ores(pos, check_node)
|
function spawners_ores.check_around_radius(pos)
|
||||||
local player_near = spawners.check_around_radius(pos);
|
local player_near = false
|
||||||
|
local radius = 21
|
||||||
|
local node_ore_pos = nil
|
||||||
|
|
||||||
|
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, radius)) do
|
||||||
|
if obj:is_player() then
|
||||||
|
player_near = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return player_near
|
||||||
|
end
|
||||||
|
|
||||||
|
function spawners_ores.check_around_radius_ores(pos, check_node)
|
||||||
|
local player_near = spawners_ores.check_around_radius(pos);
|
||||||
local found_node = false
|
local found_node = false
|
||||||
local node_ore_pos = nil
|
local node_ore_pos = nil
|
||||||
if check_node then
|
if check_node then
|
||||||
@ -80,10 +94,10 @@ function spawners.check_around_radius_ores(pos, check_node)
|
|||||||
return player_near, found_node
|
return player_near, found_node
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawners.check_node_status_ores(pos, ore_name, check_node)
|
function spawners_ores.check_node_status_ores(pos, ore_name, check_node)
|
||||||
if not check_node then return end
|
if not check_node then return end
|
||||||
|
|
||||||
local player_near, found_node = spawners.check_around_radius_ores(pos, check_node)
|
local player_near, found_node = spawners_ores.check_around_radius_ores(pos, check_node)
|
||||||
|
|
||||||
if player_near and found_node then
|
if player_near and found_node then
|
||||||
return true, found_node
|
return true, found_node
|
||||||
|
@ -1 +1,3 @@
|
|||||||
default
|
default
|
||||||
|
xpanes?
|
||||||
|
fire?
|
@ -1,42 +1,9 @@
|
|||||||
-- Main settings
|
MOD_NAME = minetest.get_current_modname()
|
||||||
dofile(minetest.get_modpath("spawners").."/settings.txt")
|
|
||||||
|
|
||||||
-- Spawners configurations
|
|
||||||
dofile(minetest.get_modpath("spawners").."/config.lua")
|
|
||||||
|
|
||||||
-- API
|
-- API
|
||||||
dofile(minetest.get_modpath("spawners").."/API.lua")
|
dofile(minetest.get_modpath(MOD_NAME).."/api.lua")
|
||||||
|
|
||||||
-- Spawners for mobs
|
|
||||||
dofile(minetest.get_modpath("spawners").."/spawners_mobs.lua")
|
|
||||||
|
|
||||||
-- Spawners for ores
|
-- Spawners for ores
|
||||||
dofile(minetest.get_modpath("spawners").."/spawners_ores.lua")
|
dofile(minetest.get_modpath(MOD_NAME).."/spawners_ores.lua")
|
||||||
|
|
||||||
-- include mummy mobs redo addon (mob)
|
print ("[Mod] Spawners Ores 0.6 Loaded.")
|
||||||
if minetest.get_modpath("mobs") then
|
|
||||||
dofile(minetest.get_modpath("spawners").."/mob_mummy.lua")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Spawners Pyramids
|
|
||||||
if SPAWN_PYRAMIDS then
|
|
||||||
dofile(minetest.get_modpath("spawners").."/pyramids.lua")
|
|
||||||
|
|
||||||
print("[Mod][spawners] Pyramids enabled")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add Spawners to dungeons, temples..
|
|
||||||
if SPAWNERS_GENERATE then
|
|
||||||
dofile(minetest.get_modpath("spawners").."/spawners_gen.lua")
|
|
||||||
|
|
||||||
print("[Mod][spawners] Spawners generate enabled")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add Chests to dungeons, temples..
|
|
||||||
if CHESTS_GENERATE then
|
|
||||||
dofile(minetest.get_modpath("spawners").."/chests_gen.lua")
|
|
||||||
|
|
||||||
print("[Mod][spawners] Chests generate enabled")
|
|
||||||
end
|
|
||||||
|
|
||||||
print ("[Mod] Spawners 0.6 Loaded.")
|
|
||||||
|
@ -13,7 +13,13 @@ local ore_formspec =
|
|||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
default.get_hotbar_bg(0, 4.25)
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
|
||||||
function spawners.get_formspec(pos)
|
local function can_dig(pos, player)
|
||||||
|
local meta = minetest.get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:is_empty("fuel")
|
||||||
|
end
|
||||||
|
|
||||||
|
function spawners_ores.get_formspec(pos)
|
||||||
|
|
||||||
-- Inizialize metadata
|
-- Inizialize metadata
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -32,12 +38,6 @@ function spawners.get_formspec(pos)
|
|||||||
meta:set_string("formspec", ore_formspec)
|
meta:set_string("formspec", ore_formspec)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
|
||||||
local meta = minetest.get_meta(pos);
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
return inv:is_empty("fuel")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
minetest.record_protection_violation(pos, player:get_player_name())
|
minetest.record_protection_violation(pos, player:get_player_name())
|
||||||
@ -87,8 +87,8 @@ local function on_receive_fields(pos, formname, fields, sender)
|
|||||||
local fuellist = inv:get_list("fuel")
|
local fuellist = inv:get_list("fuel")
|
||||||
|
|
||||||
if inv:is_empty("fuel") then
|
if inv:is_empty("fuel") then
|
||||||
if ore_node.name ~= "spawners:stone_with_"..ingot[3].."_spawner" then
|
if ore_node.name ~= "spawners_ores:stone_with_"..ingot[3].."_spawner" then
|
||||||
minetest.swap_node(pos, {name="spawners:stone_with_"..ingot[3].."_spawner"})
|
minetest.swap_node(pos, {name="spawners_ores:stone_with_"..ingot[3].."_spawner"})
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", ingot[3].." ore spawner is empty")
|
meta:set_string("infotext", ingot[3].." ore spawner is empty")
|
||||||
else
|
else
|
||||||
@ -107,12 +107,12 @@ local function on_receive_fields(pos, formname, fields, sender)
|
|||||||
ingot[3] = "iron"
|
ingot[3] = "iron"
|
||||||
end
|
end
|
||||||
|
|
||||||
local waiting, found_node = spawners.check_node_status_ores(pos, "stone_with_"..ingot[3], "default:stone")
|
local waiting, found_node = spawners_ores.check_node_status_ores(pos, "stone_with_"..ingot[3], "default:stone")
|
||||||
|
|
||||||
if found_node then
|
if found_node then
|
||||||
minetest.swap_node(pos, {name="spawners:stone_with_"..ingot[3].."_spawner_active"})
|
minetest.swap_node(pos, {name="spawners_ores:stone_with_"..ingot[3].."_spawner_active"})
|
||||||
elseif waiting then
|
elseif waiting then
|
||||||
minetest.swap_node(pos, {name="spawners:stone_with_"..ingot[3].."_spawner_waiting"})
|
minetest.swap_node(pos, {name="spawners_ores:stone_with_"..ingot[3].."_spawner_waiting"})
|
||||||
|
|
||||||
meta:set_string("infotext", "Waiting status - player was away or no stone around, "..ingot[3].." ore spawner fuel: "..inv:get_stack("fuel", 1):get_count())
|
meta:set_string("infotext", "Waiting status - player was away or no stone around, "..ingot[3].." ore spawner fuel: "..inv:get_stack("fuel", 1):get_count())
|
||||||
else
|
else
|
||||||
@ -122,7 +122,7 @@ local function on_receive_fields(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Ores creation
|
-- Ores creation
|
||||||
function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_custom)
|
function spawners_ores.create_ore(ore_name, mod_prefix, size, offset, texture, sound_custom)
|
||||||
-- dummy inside the spawner
|
-- dummy inside the spawner
|
||||||
local dummy_ore_definition = {
|
local dummy_ore_definition = {
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
@ -150,16 +150,16 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
self.timer = self.timer + dtime
|
self.timer = self.timer + dtime
|
||||||
local n = minetest.get_node_or_nil(self.object:getpos())
|
local n = minetest.get_node_or_nil(self.object:getpos())
|
||||||
if self.timer > 2 then
|
if self.timer > 2 then
|
||||||
if n and n.name and n.name ~= "spawners:"..ore_name.."_spawner_active" and n.name ~= "spawners:"..ore_name.."_spawner_waiting" and n.name ~= "spawners:"..ore_name.."_spawner" then
|
if n and n.name and n.name ~= "spawners_ores:"..ore_name.."_spawner_active" and n.name ~= "spawners_ores:"..ore_name.."_spawner_waiting" and n.name ~= "spawners_ores:"..ore_name.."_spawner" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_entity("spawners:dummy_ore_"..ore_name, dummy_ore_definition)
|
minetest.register_entity("spawners_ores:dummy_ore_"..ore_name, dummy_ore_definition)
|
||||||
|
|
||||||
-- node spawner active
|
-- node spawner active
|
||||||
minetest.register_node("spawners:"..ore_name.."_spawner_active", {
|
minetest.register_node("spawners_ores:"..ore_name.."_spawner_active", {
|
||||||
description = ore_name.." spawner active",
|
description = ore_name.." spawner active",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
light_source = 4,
|
light_source = 4,
|
||||||
@ -170,7 +170,7 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = {
|
tiles = {
|
||||||
{
|
{
|
||||||
name = "spawners_spawner_animated.png",
|
name = "spawners_ores_spawner_animated.png",
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
aspect_w = 32,
|
aspect_w = 32,
|
||||||
@ -181,7 +181,7 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
||||||
drop = "spawners:"..ore_name.."_spawner",
|
drop = "spawners_ores:"..ore_name.."_spawner",
|
||||||
can_dig = can_dig,
|
can_dig = can_dig,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
@ -189,7 +189,7 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- node spawner waiting - no stone around or no fuel
|
-- node spawner waiting - no stone around or no fuel
|
||||||
minetest.register_node("spawners:"..ore_name.."_spawner_waiting", {
|
minetest.register_node("spawners_ores:"..ore_name.."_spawner_waiting", {
|
||||||
description = ore_name.." spawner waiting",
|
description = ore_name.." spawner waiting",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
light_source = 2,
|
light_source = 2,
|
||||||
@ -199,7 +199,7 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = {
|
tiles = {
|
||||||
{
|
{
|
||||||
name = "spawners_spawner_waiting_animated.png",
|
name = "spawners_ores_spawner_waiting_animated.png",
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
aspect_w = 32,
|
aspect_w = 32,
|
||||||
@ -210,7 +210,7 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=1,level=2,not_in_creative_inventory=1},
|
groups = {cracky=1,level=2,not_in_creative_inventory=1},
|
||||||
drop = "spawners:"..ore_name.."_spawner",
|
drop = "spawners_ores:"..ore_name.."_spawner",
|
||||||
can_dig = can_dig,
|
can_dig = can_dig,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
@ -218,22 +218,22 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- node spawner inactive (default)
|
-- node spawner inactive (default)
|
||||||
minetest.register_node("spawners:"..ore_name.."_spawner", {
|
minetest.register_node("spawners_ores:"..ore_name.."_spawner", {
|
||||||
description = ore_name.." spawner",
|
description = ore_name.." spawner",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "allfaces",
|
drawtype = "allfaces",
|
||||||
walkable = true,
|
walkable = true,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = {"spawners_spawner.png"},
|
tiles = {"spawners_ores_spawner.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=1,level=2},
|
groups = {cracky=1,level=2},
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
spawners.get_formspec(pos)
|
spawners_ores.get_formspec(pos)
|
||||||
pos.y = pos.y + offset
|
pos.y = pos.y + offset
|
||||||
minetest.add_entity(pos,"spawners:dummy_ore_"..ore_name)
|
minetest.add_entity(pos,"spawners_ores:dummy_ore_"..ore_name)
|
||||||
meta:set_string("infotext", ore[3].." ore spawner is empty")
|
meta:set_string("infotext", ore[3].." ore spawner is empty")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -246,21 +246,20 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
|
|
||||||
-- ABM
|
-- ABM
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"spawners:"..ore_name.."_spawner_active", "spawners:"..ore_name.."_spawner_waiting"},
|
nodenames = {"spawners_ores:"..ore_name.."_spawner_active", "spawners_ores:"..ore_name.."_spawner_waiting"},
|
||||||
interval = 5.0,
|
interval = 5.0,
|
||||||
chance = 5,
|
chance = 5,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
|
||||||
local waiting, found_node = spawners.check_node_status_ores(pos, ore_name, "default:stone")
|
local waiting, found_node = spawners_ores.check_node_status_ores(pos, ore_name, "default:stone")
|
||||||
|
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
if found_node then
|
if found_node then
|
||||||
-- make sure the right node status is shown
|
-- make sure the right node status is shown
|
||||||
if node.name ~= "spawners:"..ore_name.."_spawner_active" then
|
if node.name ~= "spawners_ores:"..ore_name.."_spawner_active" then
|
||||||
minetest.swap_node(pos, {name="spawners:"..ore_name.."_spawner_active"})
|
minetest.swap_node(pos, {name="spawners_ores:"..ore_name.."_spawner_active"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -274,18 +273,18 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
meta:set_string("infotext", ore[3].." ore spawner fuel: "..inv:get_stack("fuel", 1):get_count())
|
meta:set_string("infotext", ore[3].." ore spawner fuel: "..inv:get_stack("fuel", 1):get_count())
|
||||||
|
|
||||||
-- enough place to spawn more ores
|
-- enough place to spawn more ores
|
||||||
spawners.start_spawning_ores(found_node, "default:"..ore_name, sound_custom)
|
spawners_ores.start_spawning_ores(found_node, "default:"..ore_name, sound_custom)
|
||||||
|
|
||||||
-- empty / no fuel
|
-- empty / no fuel
|
||||||
if inv:is_empty("fuel") then
|
if inv:is_empty("fuel") then
|
||||||
minetest.swap_node(pos, {name="spawners:"..ore_name.."_spawner"})
|
minetest.swap_node(pos, {name="spawners_ores:"..ore_name.."_spawner"})
|
||||||
meta:set_string("infotext", ore[3].." ore spawner is empty.")
|
meta:set_string("infotext", ore[3].." ore spawner is empty.")
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- waiting status
|
-- waiting status
|
||||||
if node.name ~= "spawners:"..ore_name.."_spawner_waiting" then
|
if node.name ~= "spawners_ores:"..ore_name.."_spawner_waiting" then
|
||||||
minetest.swap_node(pos, {name="spawners:"..ore_name.."_spawner_waiting"})
|
minetest.swap_node(pos, {name="spawners_ores:"..ore_name.."_spawner_waiting"})
|
||||||
|
|
||||||
meta:set_string("infotext", "Waiting status - player was away or no stone around, "..ore[3].." ore spawner fuel: "..inv:get_stack("fuel", 1):get_count())
|
meta:set_string("infotext", "Waiting status - player was away or no stone around, "..ore[3].." ore spawner fuel: "..inv:get_stack("fuel", 1):get_count())
|
||||||
end
|
end
|
||||||
@ -297,18 +296,18 @@ function spawners.create_ore(ore_name, mod_prefix, size, offset, texture, sound_
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- default:stone_with_gold
|
-- default:stone_with_gold
|
||||||
spawners.create_ore("stone_with_gold", "", {x=.33,y=.33}, 0, {"default_stone.png^default_mineral_gold.png"}, "strike")
|
spawners_ores.create_ore("stone_with_gold", "", {x=.33,y=.33}, 0, {"default_stone.png^default_mineral_gold.png"}, "spawners_ores_strike")
|
||||||
|
|
||||||
-- default:stone_with_iron
|
-- default:stone_with_iron
|
||||||
spawners.create_ore("stone_with_iron", "", {x=.33,y=.33}, 0, {"default_stone.png^default_mineral_gold.png"}, "strike")
|
spawners_ores.create_ore("stone_with_iron", "", {x=.33,y=.33}, 0, {"default_stone.png^default_mineral_gold.png"}, "spawners_ores_strike")
|
||||||
|
|
||||||
-- default:stone_with_copper
|
-- default:stone_with_copper
|
||||||
spawners.create_ore("stone_with_copper", "", {x=.33,y=.33}, 0, {"default_stone.png^default_mineral_gold.png"}, "strike")
|
spawners_ores.create_ore("stone_with_copper", "", {x=.33,y=.33}, 0, {"default_stone.png^default_mineral_gold.png"}, "spawners_ores_strike")
|
||||||
|
|
||||||
|
|
||||||
-- recipes
|
-- recipes
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "spawners:stone_with_gold_spawner",
|
output = "spawners_ores:stone_with_gold_spawner",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
||||||
{"xpanes:bar_flat", "default:goldblock", "xpanes:bar_flat"},
|
{"xpanes:bar_flat", "default:goldblock", "xpanes:bar_flat"},
|
||||||
@ -317,7 +316,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "spawners:stone_with_iron_spawner",
|
output = "spawners_ores:stone_with_iron_spawner",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
||||||
{"xpanes:bar_flat", "default:steelblock", "xpanes:bar_flat"},
|
{"xpanes:bar_flat", "default:steelblock", "xpanes:bar_flat"},
|
||||||
@ -326,7 +325,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "spawners:stone_with_copper_spawner",
|
output = "spawners_ores:stone_with_copper_spawner",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
||||||
{"xpanes:bar_flat", "default:copperblock", "xpanes:bar_flat"},
|
{"xpanes:bar_flat", "default:copperblock", "xpanes:bar_flat"},
|
||||||
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |