Merge branch 'classic_upate'

master
LeMagnesium 2016-03-23 18:10:55 +01:00
commit 9e7899e9de
108 changed files with 2245 additions and 955 deletions

View File

@ -1 +1 @@
name = MinetestForFun CREATIVE
name = MinetestForFun Game Creative

View File

@ -1,2 +1,3 @@
# Enable jungles on new worlds, disable biome blend and mud flow (faster, looks better).
mgv6_spflags = jungles, nobiomeblend, nomudflow
disable_fire = true

View File

@ -9,8 +9,7 @@
# 0 to disable
#share_bones_time = 1200
# Whether standard fire should be disabled ('basic flame' nodes will disappear)
# 'permanent flame' nodes will remain with either setting
# Whether fire should be disabled (all fire nodes will instantly disappear)
#disable_fire = false
# Whether steel tools, torches and cobblestone should be given to new players

View File

@ -1,11 +1,16 @@
-- minetest/creative/init.lua
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
creative_inventory.init_creative_inventory = function(player)
local player_name = player:get_player_name()
creative_inventory[player_name] = {}
creative_inventory[player_name].size = 0
creative_inventory[player_name].filter = nil
creative_inventory[player_name].start_i = 1
local inv = minetest.create_detached_inventory("creative_" .. player_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
@ -35,19 +40,41 @@ minetest.after(0, function()
end
end,
})
creative_inventory.update(player_name, nil, 2)
--print("creative inventory size: "..dump(creative_inventory[player_name].size))
end
local function tab_category(tab_id)
local id_category = {
nil, -- Reserved for crafting tab.
minetest.registered_items,
minetest.registered_nodes,
minetest.registered_tools,
minetest.registered_craftitems
}
-- If index out of range, show default ("All") page.
return id_category[tab_id] or id_category[2]
end
function creative_inventory.update(player_name, filter, tab_id)
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
local inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
for name, def in pairs(tab_category(tab_id)) do
if not (def.groups.not_in_creative_inventory == 1) and
def.description and def.description ~= "" and
(not filter or def.name:find(filter, 1, true)) then
creative_list[#creative_list+1] = name
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
inv:set_list("main", creative_list)
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
creative_inventory[player_name].size = #creative_list
end
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
@ -66,70 +93,117 @@ local trash = minetest.create_detached_inventory("creative_trash", {
})
trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum, tab_id)
local player_name = player:get_player_name()
local filter = creative_inventory[player_name].filter or ""
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;5,3.5;8,1;]"..
"list[current_player;main;5,4.75;8,3;8]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
"listring[current_player;main]"..
"listring[detached:creative;main]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
default.get_hotbar_bg(5,3.5)
local pagemax = math.floor((creative_inventory[player_name].size - 1) / (3*8) + 1)
tab_id = tab_id or 2
player:set_inventory_formspec([[
size[8,8.6]
image[4.06,3.4;0.8,0.8;trash_icon.png]
list[current_player;main;0,4.7;8,1;]
list[current_player;main;0,5.85;8,3;8]
list[detached:creative_trash;main;4,3.3;1,1;]
tablecolumns[color;text;color;text]
tableoptions[background=#00000000;highlight=#00000000;border=false]
button[5.4,3.2;0.8,0.9;creative_prev;<]
button[7.25,3.2;0.8,0.9;creative_next;>]
button[2.1,3.4;0.8,0.5;search;?]
button[2.75,3.4;0.8,0.5;clear;X]
tooltip[search;Search]
tooltip[clear;Reset]
listring[current_player;main]
]] ..
"field[0.3,3.5;2.2,1;filter;;".. filter .."]"..
"listring[detached:creative_".. player_name ..";main]"..
"tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;".. tostring(tab_id) ..";true;false]"..
"list[detached:creative_".. player_name ..";main;0,0;8,3;".. tostring(start_i) .."]"..
"table[6.05,3.35;1.15,0.5;pagenum;#FFFF00,".. tostring(pagenum) ..",#FFFFFF,/ ".. tostring(pagemax) .."]"..
default.get_hotbar_bg(0,4.7)..
default.gui_bg .. default.gui_bg_img .. default.gui_slots
)
end
creative_inventory.set_crafting_formspec = function(player)
player:set_inventory_formspec([[
size[8,8.6]
list[current_player;craft;2,0.75;3,3;]
list[current_player;craftpreview;6,1.75;1,1;]
list[current_player;main;0,4.7;8,1;]
list[current_player;main;0,5.85;8,3;8]
list[detached:creative_trash;main;0,2.75;1,1;]
image[0.06,2.85;0.8,0.8;trash_icon.png]
image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]
tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;1;true;false]
listring[current_player;main]
listring[current_player;craft]
]] ..
default.get_hotbar_bg(0,4.7)..
default.gui_bg .. default.gui_bg_img .. default.gui_slots
)
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
creative_inventory.init_creative_inventory(player)
creative_inventory.set_creative_formspec(player, 0, 1, 2)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local player_name = player:get_player_name()
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
local filter = formspec:match("filter;;([%w_:]+)") or ""
local start_i = formspec:match("list%[detached:creative_".. player_name ..";.*;(%d+)%]")
local tab_id = tonumber(formspec:match("tabheader%[.*;(%d+)%;.*%]"))
local inv_size = creative_inventory[player_name].size
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end
if fields.quit then
if tab_id == 1 then
creative_inventory.set_crafting_formspec(player)
end
elseif fields.tabs then
if tonumber(fields.tabs) == 1 then
creative_inventory.set_crafting_formspec(player)
else
creative_inventory.update(player_name, filter, tonumber(fields.tabs))
creative_inventory.set_creative_formspec(player, 0, 1, tonumber(fields.tabs))
end
elseif fields.clear then
creative_inventory[player_name].filter = ""
creative_inventory.update(player_name, nil, tab_id)
creative_inventory.set_creative_formspec(player, 0, 1, tab_id)
elseif fields.search then
creative_inventory[player_name].filter = fields.filter:lower()
creative_inventory.update(player_name, fields.filter:lower(), tab_id)
creative_inventory.set_creative_formspec(player, 0, 1, tab_id)
else
if fields.creative_prev then
start_i = start_i - 3*8
if start_i < 0 then
start_i = inv_size - (inv_size % (3*8))
if inv_size == start_i then
start_i = math.max(0, inv_size - (3*8))
end
end
elseif fields.creative_next then
start_i = start_i + 3*8
if start_i >= inv_size then
start_i = 0
end
end
if start_i < 0 then
start_i = start_i + 4*6
creative_inventory.set_creative_formspec(player, start_i, start_i / (3*8) + 1, tab_id)
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end)
if minetest.setting_getbool("creative_mode") then
@ -137,7 +211,7 @@ if minetest.setting_getbool("creative_mode") then
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
wield_scale = {x=1, y=1, z=2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
@ -164,7 +238,7 @@ if minetest.setting_getbool("creative_mode") then
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
for _, item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
@ -172,5 +246,4 @@ if minetest.setting_getbool("creative_mode") then
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -148,6 +148,14 @@ BlockMen (CC BY-SA 3.0):
heart.png
gui_*.png
sofar (CC BY-SA 3.0):
default_book_written.png, based on default_book.png
default_aspen_sapling
default_aspen_leaves
default_aspen_tree
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
default_aspen_wood, derived from default_pine_wood (by paramat)
Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect

View File

@ -68,9 +68,9 @@ minetest.register_alias("steel_ingot", "default:steel_ingot")
minetest.register_alias("clay_brick", "default:clay_brick")
minetest.register_alias("snow", "default:snow")
-- 'mese_block' was used for a while for the block form of mese
minetest.register_alias("default:mese_block", "default:mese")
-- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")
-- Mese now comes in the form of blocks, ore, crystal and fragments
minetest.register_alias("default:mese", "default:mese_block")

View File

@ -35,6 +35,13 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:aspen_wood 4',
recipe = {
{'default:aspen_tree'},
}
})
minetest.register_craft({
output = 'default:stick 9',
recipe = {

View File

@ -85,12 +85,42 @@ minetest.register_craftitem("default:book", {
minetest.register_craftitem("default:book_written", {
description = "Book With Text",
inventory_image = "default_book.png",
inventory_image = "default_book_written.png",
groups = {book=1, not_in_creative_inventory=1},
stack_max = 1,
on_use = book_on_use,
})
minetest.register_craft({
type = "shapeless",
output = "default:book_written",
recipe = { "default:book", "default:book_written" }
})
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
if itemstack:get_name() ~= "default:book_written" then
return
end
local copy = ItemStack("default:book_written")
local original
local index
for i = 1, player:get_inventory():get_size("craft") do
if old_craft_grid[i]:get_name() == "default:book_written" then
original = old_craft_grid[i]
index = i
end
end
if not original then
return
end
local copymeta = original:get_metadata()
-- copy of the book held by player's mouse cursor
itemstack:set_metadata(copymeta)
-- put the book with metadata back in the craft grid
craft_inv:set_stack("craft", index, original)
end)
minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump",
wield_scale = {x = 1, y = 1, z = 2},

View File

@ -53,7 +53,7 @@ function default.register_ores()
-- Clay
minetest.register_ore({
minetest.register_ore({
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
@ -63,75 +63,76 @@ function default.register_ores()
y_max = 0,
noise_threshhold = 0.0,
noise_params = {
offset = 0.5,
offset = 0.35,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.0
persist = 0.5
},
})
-- Sand
minetest.register_ore({
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone"},
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone", "default:sandstone",
"default:desert_stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -63,
y_max = 4,
noise_threshhold = 0.0,
noise_threshhold = 0,
noise_params = {
offset = 0.5,
offset = 0.35,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 2316,
octaves = 1,
persist = 0.0
persist = 0.5
},
})
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone", "default:sandstone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -63,
y_max = 31000,
noise_threshhold = 0.0,
noise_threshhold = 0,
noise_params = {
offset = 0.5,
offset = 0.35,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 17676,
octaves = 1,
persist = 0.0
persist = 0.5
},
})
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -31000,
y_max = 31000,
noise_threshhold = 0.0,
noise_threshhold = 0,
noise_params = {
offset = 0.5,
offset = 0.35,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
persist = 0.5
},
})
@ -202,8 +203,8 @@ function default.register_ores()
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5,
clust_size = 3,
y_min = -63,
y_max = -16,
y_min = -63,
y_max = -16,
})
minetest.register_ore({
@ -215,6 +216,7 @@ function default.register_ores()
clust_size = 3,
y_min = -30000,
y_max = -64,
flags = "absheight",
})
minetest.register_ore({
@ -226,6 +228,7 @@ function default.register_ores()
clust_size = 6,
y_min = -30000,
y_max = -64,
flags = "absheight",
})
minetest.register_ore({
@ -262,6 +265,7 @@ function default.register_ores()
clust_size = 3,
y_min = -1024,
y_max = -256,
flags = "absheight",
})
minetest.register_ore({
@ -273,6 +277,7 @@ function default.register_ores()
clust_size = 2,
y_min = -30000,
y_max = -1024,
flags = "absheight",
})
minetest.register_ore({
@ -337,6 +342,7 @@ function default.register_ores()
clust_size = 2,
y_min = -255,
y_max = -64,
flags = "absheight",
})
minetest.register_ore({
@ -348,6 +354,7 @@ function default.register_ores()
clust_size = 3,
y_min = -30000,
y_max = -256,
flags = "absheight",
})
-- Diamond
@ -381,9 +388,9 @@ function default.register_ores()
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 30 * 30 * 30,
clust_num_ores = 64,
clust_num_ores = 32,
clust_size = 5,
y_max = -1024,
y_max = -4096,
y_min = -30000,
})
@ -698,6 +705,24 @@ function default.register_biomes()
humidity_point = 35,
})
minetest.register_biome({
name = "tundra_beach",
--node_dust = "",
node_top = "default:gravel",
depth_top = 1,
node_filler = "default:gravel",
depth_filler = 2,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -3,
y_max = 1,
heat_point = 15,
humidity_point = 35,
})
minetest.register_biome({
name = "tundra_ocean",
--node_dust = "",
@ -711,7 +736,7 @@ function default.register_biomes()
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 1,
y_max = -4,
heat_point = 15,
humidity_point = 35,
})
@ -767,12 +792,30 @@ function default.register_biomes()
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_min = 6,
y_max = 31000,
heat_point = 40,
humidity_point = 35,
})
minetest.register_biome({
name = "stone_grassland_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 40,
humidity_point = 35,
})
minetest.register_biome({
name = "stone_grassland_ocean",
--node_dust = "",
@ -804,12 +847,30 @@ function default.register_biomes()
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_min = 6,
y_max = 31000,
heat_point = 40,
humidity_point = 65,
})
minetest.register_biome({
name = "coniferous_forest_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 40,
humidity_point = 65,
})
minetest.register_biome({
name = "coniferous_forest_ocean",
--node_dust = "",
@ -841,12 +902,30 @@ function default.register_biomes()
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_min = 6,
y_max = 31000,
heat_point = 60,
humidity_point = 35,
})
minetest.register_biome({
name = "sandstone_grassland_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 60,
humidity_point = 35,
})
minetest.register_biome({
name = "sandstone_grassland_ocean",
--node_dust = "",
@ -1086,6 +1165,10 @@ function default.register_biomes()
y_max = -113,
heat_point = 50,
humidity_point = 50,
node_underwater = "default:sand",
height_shore = 3,
node_shore_filler = "default:sand",
node_shore_top = "default:sand",
})
end
@ -1117,7 +1200,7 @@ function default.register_mgv6_decorations()
y_max = 1,
decoration = "default:papyrus",
height = 2,
height_max = 4,
y_max = 4,
spawn_by = "default:water_source",
num_spawn_by = 1,
})
@ -1140,7 +1223,7 @@ function default.register_mgv6_decorations()
y_max = 30,
decoration = "default:cactus",
height = 3,
height_max = 4,
y_max = 4,
})
-- Long grasses
@ -1217,7 +1300,9 @@ local function register_grass_decoration(offset, scale, length)
persist = 0.6
},
biomes = {"stone_grassland", "sandstone_grassland",
"deciduous_forest", "coniferous_forest"},
"deciduous_forest", "coniferous_forest",
"stone_grassland_dunes", "sandstone_grassland_dunes",
"coniferous_forest_dunes"},
y_min = 1,
y_max = 31000,
decoration = "default:grass_"..length,
@ -1247,7 +1332,7 @@ end
function default.register_decorations()
minetest.clear_registered_decorations()
-- Apple tree
-- Apple tree and log
minetest.register_decoration({
deco_type = "schematic",
@ -1268,7 +1353,40 @@ function default.register_decorations()
flags = "place_center_x, place_center_z",
})
-- Jungle tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.002,
scale = 0.001,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:tree", param2 = 12, prob = 191 },
{ name = "default:tree", param2 = 12 },
{ name = "default:tree", param2 = 12, prob = 127 },
{ name = "air", prob = 0 },
{ name = "flowers:mushroom_brown", prob = 63 },
{ name = "air", prob = 0 },
},
},
flags = "place_center_x",
rotation = "random",
})
-- Jungle tree and log
minetest.register_decoration({
deco_type = "schematic",
@ -1283,7 +1401,33 @@ function default.register_decorations()
rotation = "random",
})
-- Taiga and temperate coniferous forest pine tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_grass", "default:dirt"},
sidelen = 80,
fill_ratio = 0.01,
biomes = {"rainforest", "rainforest_swamp"},
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:jungletree", param2 = 12, prob = 191 },
{ name = "default:jungletree", param2 = 12 },
{ name = "default:jungletree", param2 = 12, prob = 127 },
{ name = "air", prob = 0 },
{ name = "flowers:mushroom_brown", prob = 127 },
{ name = "air", prob = 0 },
},
},
flags = "place_center_x",
rotation = "random",
})
-- Taiga and temperate coniferous forest pine tree and log
minetest.register_decoration({
deco_type = "schematic",
@ -1304,7 +1448,33 @@ function default.register_decorations()
flags = "place_center_x, place_center_z",
})
-- Acacia tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
sidelen = 80,
fill_ratio = 0.003,
biomes = {"taiga", "coniferous_forest"},
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:pine_tree", param2 = 12, prob = 191 },
{ name = "default:pine_tree", param2 = 12 },
{ name = "default:pine_tree", param2 = 12, prob = 127 },
{ name = "air", prob = 0 },
{ name = "flowers:mushroom_red", prob = 63 },
{ name = "air", prob = 0 },
},
},
flags = "place_center_x",
rotation = "random",
})
-- Acacia tree and log
minetest.register_decoration({
deco_type = "schematic",
@ -1326,6 +1496,90 @@ function default.register_decorations()
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_dry_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.001,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"savanna"},
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 2, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:acacia_tree", param2 = 12, prob = 191 },
{ name = "default:acacia_tree", param2 = 12 },
{ name = "default:acacia_tree", param2 = 12, prob = 127 },
},
},
flags = "place_center_x",
rotation = "random",
})
-- Aspen tree and log
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.01,
scale = -0.02,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.0005,
scale = -0.001,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:aspen_tree", param2 = 12 },
{ name = "default:aspen_tree", param2 = 12 },
{ name = "default:aspen_tree", param2 = 12, prob = 127 },
{ name = "flowers:mushroom_red", prob = 63 },
{ name = "flowers:mushroom_brown", prob = 63 },
{ name = "air", prob = 0 },
},
},
flags = "place_center_x",
rotation = "random",
})
-- Large cactus
minetest.register_decoration({
@ -1367,7 +1621,7 @@ function default.register_decorations()
y_max = 31000,
decoration = "default:cactus",
height = 2,
height_max = 5,
y_max = 5,
})
-- Papyrus
@ -1481,13 +1735,13 @@ function default.generate_nyancats(minp, maxp, seed)
local volume = (maxp.x - minp.x + 1) * (y_max - y_min + 1) * (maxp.z - minp.z + 1)
local pr = PseudoRandom(seed + 9324342)
local max_num_nyancats = math.floor(volume / (16 * 16 * 16))
for i = 1, max_num_nyancats do
for i = 1,max_num_nyancats do
if pr:next(0, 1000) == 0 then
local x0 = pr:next(minp.x, maxp.x)
local y0 = pr:next(minp.y, maxp.y)
local z0 = pr:next(minp.z, maxp.z)
local p0 = {x = x0, y = y0, z = z0}
default.make_nyancat(p0, pr:next(0, 3), pr:next(3, 15))
local p0 = { x =x0, y = y0, z = z0}
default.make_nyancat(p0, pr:next(0, 3), pr:next(10, 15))
end
end
end
@ -1506,8 +1760,8 @@ if mg_params.mgname == "v6" then
default.register_mgv6_decorations()
minetest.register_on_generated(default.generate_nyancats)
elseif mg_params.mgname ~= "singlenode" then
default.register_ores()
default.register_biomes()
default.register_ores()
default.register_decorations()
minetest.register_on_generated(default.generate_nyancats)
end

View File

@ -80,6 +80,11 @@ default:acacia_wood
default:acacia_leaves
default:acacia_sapling
default:aspen_tree
default:aspen_wood
default:aspen_leaves
default:aspen_sapling
default:cherry_tree
default:cherry_log
default:cherry_plank
@ -195,9 +200,13 @@ default:nyancat_rainbow
minetest.register_node("default:stone", {
description = "Stone",
tiles = {"default_stone.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 1},
drop = 'default:cobble',
legacy_mineral = true,
drop = {
items = {
{items = {"default:cobble"}},
},
},
sounds = default.node_sound_stone_defaults(),
})
@ -230,7 +239,7 @@ minetest.register_node("default:mossycobble", {
description = "Mossy Cobblestone",
tiles = {"default_mossycobble.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 1},
groups = {cracky=3, stone=1},
drop = "default:mossycobble",
sounds = default.node_sound_stone_defaults(),
})
@ -239,9 +248,9 @@ minetest.register_node("default:mossycobble", {
minetest.register_node("default:desert_stone", {
description = "Desert Stone",
tiles = {"default_desert_stone.png"},
legacy_mineral = true,
groups = {crumbly = 1, cracky = 3, stone = 1},
drop = 'default:desert_cobble',
legacy_mineral = true,
sounds = default.node_sound_stone_defaults(),
})

View File

@ -95,7 +95,7 @@ minetest.register_on_joinplayer(function(player)
default.player_attached[player:get_player_name()] = false
default.player_set_model(player, "character.b3d")
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_survival_form)

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

@ -15,7 +15,7 @@ minetest.register_item(":", {
oddly_breakable_by_hand = {times = {[1] = 3.50, [2] = 2.00, [3] = 0.65}, uses = 0},
nether = {times = {[1] = 0.5, [2] = 0.5, [3] = 0.5}, uses = 0},
},
damage_groups = {fleshy=1},
damage_groups = {fleshy = 2},
}
})

View File

@ -16,9 +16,9 @@ function default.can_grow(pos)
if is_soil == 0 then
return false
end
local light_level = minetest.get_node_light(pos)
if not light_level or light_level < 13 then
return false
local ll = minetest.get_node_light(pos)
if not ll or ll < 13 then -- Minimum light level for growth
return false -- matches grass, wheat and cotton
end
return true
end
@ -28,9 +28,10 @@ end
minetest.register_abm({
nodenames = {"default:sapling", "default:junglesapling",
"default:pine_sapling", "default:acacia_sapling"},
interval = 10,
chance = 50,
"default:pine_sapling", "default:acacia_sapling",
"default:aspen_sapling"},
interval = 5,
chance = 40,
action = function(pos, node)
if not default.can_grow(pos) then
return
@ -65,6 +66,10 @@ minetest.register_abm({
minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_acacia_tree(pos)
elseif node.name == "default:aspen_sapling" then
minetest.log("action", "An aspen sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_aspen_tree(pos)
end
end
})
@ -360,7 +365,6 @@ function default.grow_pine_tree(pos)
vm:update_map()
end
-- New apple tree
function default.grow_new_apple_tree(pos)
@ -396,6 +400,14 @@ function default.grow_new_acacia_tree(pos)
path, random, nil, false)
end
-- New aspen tree
function default.grow_new_aspen_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/aspen_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, 0, nil, false)
end
-- From BFD:
minetest.register_node("default:mg_cherry_sapling", {

View File

@ -6,6 +6,7 @@ License of source code:
-----------------------
Copyright (C) 2012 PilzAdam
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
Steel trapdoor added by sofar.
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
@ -27,14 +28,18 @@ following Textures created by BlockMen (WTFPL):
door_obsidian_glass_side.png
following textures created by celeron55 (CC BY-SA 3.0):
door_trapdoor_side.png
door_glass_a.png
door_glass_b.png
following Textures created by PenguinDad (CC BY-SA 4.0):
door_glass.png
door_obsidian_glass.png
following textures created by sofar (CC-BY-SA-3.0)
doors_trapdoor_steel.png
doors_trapdoor_steel_side.png
door_trapdoor_side.png
All other textures (created by PilzAdam): WTFPL

View File

@ -28,19 +28,19 @@ function doors3.get_pos(pos, dir, p1, b)
else
if p1 == 1 then
if dir == 1 then
pos2.x=pos2.x+1--ok
pos2.x=pos2.x+1
elseif dir == 2 then
pos2.z=pos2.z-1
elseif dir == 3 then
pos2.x=pos2.x-1
else
pos2.z=pos2.z+1--ok
pos2.z=pos2.z+1
end
else
if dir == 1 then
pos2.z=pos2.z+1
elseif dir == 2 then
pos2.x=pos2.x+1--ok
pos2.x=pos2.x+1
elseif dir == 3 then
pos2.z=pos2.z-1
else
@ -246,11 +246,6 @@ function doors3.register_door(name, def)
snd_2 = def.sound_close_door
end
local b = minetest.get_meta(pos):get_int("right")
if b ~= 0 then
minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
local pos2 = doors3.get_pos(pos, oldparam2, params[1], b)
local node = minetest.get_node_or_nil(pos2)
@ -261,6 +256,13 @@ function doors3.register_door(name, def)
end
end
end
--if double doors, only 2eme play sound
if b ~= 0 then
minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
end

View File

@ -25,8 +25,8 @@ function doors.register_door(name, def)
if not def.sound_open_door then
def.sound_open_door = "doors_door_open"
end
minetest.register_craftitem(name, {
description = def.description,
inventory_image = def.inventory_image,
@ -100,7 +100,7 @@ function doors.register_door(name, def)
local tt = def.tiles_top
local tb = def.tiles_bottom
local function after_dig_node(pos, name, digger)
local node = minetest.get_node(pos)
if node.name == name then
@ -134,16 +134,16 @@ function doors.register_door(name, def)
end
local p2 = minetest.get_node(pos).param2
p2 = params[p2+1]
minetest.swap_node(pos, {name=replace_dir, param2=p2})
pos.y = pos.y-dir
minetest.swap_node(pos, {name=replace, param2=p2})
local snd_1 = def.sound_close_door
local snd_2 = def.sound_open_door
local snd_2 = def.sound_open_door
if params[1] == 3 then
snd_1 = def.sound_open_door
snd_1 = def.sound_open_door
snd_2 = def.sound_close_door
end
@ -206,18 +206,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_bottom
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1
after_dig_node(pos, name.."_t_1", digger)
end,
on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_1", mode)
end,
@ -244,18 +244,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_top
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y-1
after_dig_node(pos, name.."_b_1", digger)
end,
on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_1", mode)
end,
@ -282,18 +282,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_bottom
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1
after_dig_node(pos, name.."_t_2", digger)
end,
on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_2", mode)
end,
@ -320,18 +320,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_top
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y-1
after_dig_node(pos, name.."_b_2", digger)
end,
on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_2", mode)
end,
@ -512,7 +512,19 @@ function doors.register_trapdoor(name, def)
local name_closed = name
local name_opened = name.."_open"
def.on_rightclick = function (pos, node)
local function check_player_priv(pos, player)
if not def.only_placer_can_open then
return true
end
local meta = minetest.get_meta(pos)
local pn = player:get_player_name()
return meta:get_string("doors_owner") == pn
end
def.on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if not check_player_priv(pos, clicker) then
return
end
local newname = node.name == name_closed and name_opened or name_closed
local sound = false
if node.name == name_closed then sound = def.sound_open end
@ -520,41 +532,54 @@ function doors.register_trapdoor(name, def)
if sound then
minetest.sound_play(sound, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
minetest.swap_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
end
def.on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple
-- Common trapdoor configuration
def.drawtype = "nodebox"
def.paramtype = "light"
def.paramtype2 = "facedir"
def.is_ground_content = false
def.can_dig = check_player_priv
if def.only_placer_can_open then
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
local pn = placer:get_player_name()
local meta = minetest.get_meta(pos)
meta:set_string("doors_owner", pn)
meta:set_string("infotext", "Owned by "..pn)
return minetest.setting_getbool("creative_mode")
end
end
local def_opened = table.copy(def)
local def_closed = table.copy(def)
def_closed.node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
}
def_closed.selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
}
def_closed.tiles = { def.tile_front, def.tile_front, def.tile_side, def.tile_side,
def.tile_side, def.tile_side }
def_opened.node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
}
def_opened.selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
}
def_opened.tiles = { def.tile_side, def.tile_side, def.tile_side, def.tile_side,
def.tile_front, def.tile_front }
def_opened.tiles = { def.tile_side, def.tile_side,
def.tile_side .. '^[transform3',
def.tile_side .. '^[transform1',
def.tile_front, def.tile_front }
def_opened.drop = name_closed
def_opened.groups.not_in_creative_inventory = 1
@ -576,6 +601,19 @@ doors.register_trapdoor("doors:trapdoor", {
sound_close = "doors_door_close"
})
doors.register_trapdoor("doors:trapdoor_steel", {
description = "Steel Trapdoor",
inventory_image = "doors_trapdoor_steel.png",
wield_image = "doors_trapdoor_steel.png",
tile_front = "doors_trapdoor_steel.png",
tile_side = "doors_trapdoor_steel_side.png",
only_placer_can_open = true,
groups = {snappy=1, bendy=2, cracky=1, melty=2, level=2, door=1},
sounds = default.node_sound_wood_defaults(),
sound_open = "doors_door_open",
sound_close = "doors_door_close"
})
minetest.register_craft({
output = 'doors:trapdoor 2',
recipe = {
@ -585,6 +623,14 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'doors:trapdoor_steel',
recipe = {
{'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot'},
}
})
doors.register_trapdoor("doors:trapdoor_cherry", {
description = "Cherry tree trapdoor",
inventory_image = "doors_trapdoor_cherry.png",

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

View File

@ -147,120 +147,84 @@ minetest.register_abm({
-- Mushrooms
--
local mushrooms_datas = {
{"brown", 2},
{"red", -6}
}
minetest.register_node("flowers:mushroom_red", {
description = "Red Mushroom",
tiles = {"flowers_mushroom_red.png"},
inventory_image = "flowers_mushroom_red.png",
wield_image = "flowers_mushroom_red.png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(-5),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
for _, m in pairs(mushrooms_datas) do
local name, nut = m[1], m[2]
-- Register fertile mushrooms
-- These are placed by mapgen and the growing ABM.
-- These drop an infertile mushroom, and 0 to 3 spore
-- nodes with an average of 1.25 per mushroom, for
-- a slow multiplication of mushrooms when farming.
minetest.register_node("flowers:mushroom_fertile_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Fertile Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1,
not_in_creative_inventory = 1},
drop = {
items = {
{items = {"flowers:mushroom_" .. name}},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 4},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 2},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 2}
}
},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register infertile mushrooms
-- These do not drop spores, to avoid the use of repeated digging
-- and placing of a single mushroom to generate unlimited spores.
minetest.register_node("flowers:mushroom_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register mushroom spores
minetest.register_node("flowers:mushroom_spores_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom Spores",
drawtype = "signlike",
tiles = {"flowers_mushroom_spores_" .. name .. ".png"},
inventory_image = "flowers_mushroom_spores_" .. name .. ".png",
wield_image = "flowers_mushroom_spores_" .. name .. ".png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
selection_box = {
type = "wallmounted",
},
groups = {dig_immediate = 3, attached_node = 1},
})
end
-- Register growing ABM
minetest.register_node("flowers:mushroom_brown", {
description = "Brown Mushroom",
tiles = {"flowers_mushroom_brown.png"},
inventory_image = "flowers_mushroom_brown.png",
wield_image = "flowers_mushroom_brown.png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(1),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- mushroom spread and death
minetest.register_abm({
nodenames = {"flowers:mushroom_spores_brown", "flowers:mushroom_spores_red"},
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
interval = 11,
chance = 50,
action = function(pos, node)
local node_under = minetest.get_node_or_nil({x = pos.x,
y = pos.y - 1, z = pos.z})
if minetest.get_node_light(pos, nil) == 15 then
minetest.remove_node(pos)
end
local random = {
x = pos.x + math.random(-2,2),
y = pos.y + math.random(-1,1),
z = pos.z + math.random(-2,2)
}
local random_node = minetest.get_node_or_nil(random)
if not random_node then
return
end
if random_node.name ~= "air" then
return
end
local node_under = minetest.get_node_or_nil({x = random.x,
y = random.y - 1, z = random.z})
if not node_under then
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 13 then
if node.name == "flowers:mushroom_spores_brown" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_brown"})
elseif node.name == "flowers:mushroom_spores_red" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_red"})
end
minetest.get_node_light(pos, nil) <= 9 and
minetest.get_node_light(random, nil) <= 9 then
minetest.set_node(random, {name = node.name})
end
end
})
-- these old mushroom related nodes can be simplified now
minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown")
minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red")
minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown")
minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red")
--
-- Waterlily

View File

@ -70,8 +70,8 @@ function flowers.register_mgv6_decorations()
register_mgv6_flower("viola")
register_mgv6_flower("dandelion_white")
register_mgv6_mushroom("mushroom_fertile_brown")
register_mgv6_mushroom("mushroom_fertile_red")
register_mgv6_mushroom("mushroom_brown")
register_mgv6_mushroom("mushroom_red")
register_mgv6_waterlily()
end
@ -87,8 +87,8 @@ local function register_flower(seed, name)
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = -0.02,
scale = 0.03,
offset = -0.015,
scale = 0.025,
spread = {x = 200, y = 200, z = 200},
seed = seed,
octaves = 3,
@ -151,8 +151,8 @@ function flowers.register_decorations()
register_flower(1133, "viola")
register_flower(73133, "dandelion_white")
register_mushroom("mushroom_fertile_brown")
register_mushroom("mushroom_fertile_red")
register_mushroom("mushroom_brown")
register_mushroom("mushroom_red")
register_waterlily()
end
@ -216,7 +216,7 @@ minetest.register_decoration({
-- Mods using singlenode mapgen can call these functions to enable
-- the use of minetest.generate_ores or minetest.generate_decorations
-- Enable in mapgen v6 only
local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v6" then
flowers.register_mgv6_decorations()

View File

@ -36,6 +36,10 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name]
-- verify node is facedir (expected to be rotatable)
if ndef.paramtype2 ~= "facedir" then
return
end
-- Compute param2
local rotationPart = node.param2 % 32 -- get first 4 bits
local preservePart = node.param2 - rotationPart

View File

@ -22,6 +22,7 @@ local replace = minetest.setting_getbool("enable_stairs_replace_abm")
-- Node will be called stairs:stair_<subname>
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
groups.stair = 1
minetest.register_node(":stairs:stair_" .. subname, {
description = description,
drawtype = "mesh",
@ -111,6 +112,7 @@ end
-- Node will be called stairs:slab_<subname>
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
groups.slab = 1
minetest.register_node(":stairs:slab_" .. subname, {
description = description,
drawtype = "nodebox",
@ -170,7 +172,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
return itemstack
end
-- Upside down slabs
if p0.y - 1 == p1.y then
-- Turn into full block if pointing at a existing slab
@ -287,6 +289,13 @@ stairs.register_stair_and_slab("acacia_wood", "default:acacia_wood",
"Acacia Wood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("aspen_wood", "default:aspen_wood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_aspen_wood.png"},
"Aspen Wood Stair",
"Aspen Wood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("stone", "default:stone",
{cracky = 3},
{"default_stone.png"},
@ -335,7 +344,7 @@ stairs.register_stair_and_slab("sandstone", "default:sandstone",
"Sandstone Stair",
"Sandstone Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick",
{crumbly = 2, cracky = 2},
{"default_sandstone_brick.png"},

View File

@ -52,7 +52,7 @@ minetest.register_node("vessels:shelf", {
local stack = inv:get_stack(from_list, from_index)
local to_stack = inv:get_stack(to_list, to_index)
if to_list == "vessels" then
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0
and to_stack:is_empty() then
return 1
else

View File

@ -9,7 +9,7 @@ local wool = {}
-- colors, and then some recipes using more specific colors for a few non-base
-- colors available. When crafting, the last recipes will be checked first.
wool.dyes = {
{"white", "White", nil},
{"white", "White", "basecolor_white"},
{"grey", "Grey", "basecolor_grey"},
{"black", "Black", "basecolor_black"},
{"red", "Red", "basecolor_red"},

View File

@ -64,3 +64,6 @@ alias("advertising:pepso", "default:stone")
alias("advertising:mineyoshi", "default:stone")
alias("advertising:michel", "default:stone")
alias("advertising:avivas", "default:stone")
-- Remove "xmas_tree" from snow mod
alias("snow:xmas_tree", "default:dirt")

View File

@ -1,12 +1,13 @@
minetest.register_on_newplayer(function(player)
print("Un nouveau joueur vient de nous rejoindre !")
if minetest.setting_getbool("give_initial_stuff") then
local pinv = player:get_inventory()
minetest.log("action", "Giving initial stuff to player "..player:get_player_name())
player:get_inventory():add_item('main', 'default:cobble 99')
player:get_inventory():add_item('main', 'colored_steel:block_blue 99')
player:get_inventory():add_item('main', 'default:torch 99')
player:get_inventory():add_item('main', 'default:cherry_plank 99')
player:get_inventory():add_item('main', 'bakedclay:magenta 99')
player:get_inventory():add_item('main', 'moreblocks:all_faces_tree 99')
pinv:add_item('main', 'default:cobble 99')
pinv:add_item('main', 'colored_steel:block_blue 99')
pinv:add_item('main', 'default:torch 99')
pinv:add_item('main', 'default:cherry_plank 99')
pinv:add_item('main', 'bakedclay:magenta 99')
pinv:add_item('main', 'moreblocks:all_faces_tree 99')
end
end)

View File

@ -3,9 +3,6 @@
local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000)
local SOUNDVOLUME = 1
local ambiences
local played_on_start = false
local tempy = {}
-- compatibility with soundset mod
local get_volume
@ -108,6 +105,14 @@ local largefire = {
{name="fire_large", length=8}
}
local get_num_nodes = function(pos, nodes)
return #minetest.find_nodes_in_area(
{x=pos.x-6,y=pos.y-2, z=pos.z-6},
{x=pos.x+6,y=pos.y+3, z=pos.z+6},
nodes
)
end
-- check where player is and which sounds are played
local get_ambience = function(player)
@ -115,46 +120,21 @@ local get_ambience = function(player)
local pos = player:getpos()
-- what is around me?
pos.y = pos.y + 1.4 -- head level
local nod_head = minetest.get_node(pos).name
pos.y = pos.y - 1.2 -- feet level
local nod_feet = minetest.get_node(pos).name
pos.y = pos.y - 0.2 -- reset pos
--= START Ambiance
if nod_head == "default:water_source"
or nod_head == "default:water_flowing" then
local nod_head = minetest.get_node({x=pos.x,y=pos.y+1.4, z=pos.z}).name
if string.find(nod_head, "water_") then
return {underwater=underwater}
end
if nod_feet == "default:water_source"
or nod_feet == "default:water_flowing" then
local nod_feet = minetest.get_node({x=pos.x,y=pos.y+0.2, z=pos.z}).name
if string.find(nod_feet, "water_") then
return {splash=splash}
end
local num_fire, num_lava, num_water_source, num_water_flowing, num_desert = 0,0,0,0,0
-- get block of nodes we need to check
tempy = minetest.find_nodes_in_area({x=pos.x-6,y=pos.y-2, z=pos.z-6},
{x=pos.x+6,y=pos.y+2, z=pos.z+6},
{"fire:basic_flame", "bakedclay:safe_fire", "default:lava_flowing", "default:lava_source",
"default:water_flowing", "default:water_source", "default:desert_sand", "default:desert_stone",})
-- count separate instances in block
for _, npos in ipairs(tempy) do
local node = minetest.get_node(npos).name
if node == "fire:basic_flame" or node == "bakedclay:safe_fire" then num_fire = num_fire + 1 end
if node == "default:lava_flowing" or node == "default:lava_source" then num_lava = num_lava + 1 end
if node == "default:water_flowing" then num_water_flowing = num_water_flowing + 1 end
if node == "default:water_source" then num_water_source = num_water_source + 1 end
if node == "default:desert_sand" or node == "default:desert_stone" then num_desert = num_desert + 1 end
end ; --print (num_fire, num_lava, num_water_flowing, num_water_source, num_desert)
--= START Ambiance
-- is fire redo mod active?
if fire and fire.mod and fire.mod == "redo" then
local num_fire = get_num_nodes(pos, {"fire:basic_flame", "bakedclay:safe_fire"})
--print("num_fire:"..dump(num_fire))
if num_fire > 8 then
return {largefire=largefire}
elseif num_fire > 0 then
@ -162,18 +142,28 @@ local get_ambience = function(player)
end
end
local num_lava = get_num_nodes(pos, {"default:lava_flowing", "default:lava_source"})
--print("num_lava:"..dump(num_lava))
if num_lava > 5 then
return {lava=lava}
end
local num_water_flowing = get_num_nodes(pos, {"default:water_flowing", "default:river_water_flowing"})
--print("num_water_flowing:"..dump(num_water_flowing))
if num_water_flowing > 30 then
return {flowing_water=flowing_water}
end
if pos.y < 7 and pos.y > 0 and num_water_source > 100 then
return {beach=beach}
if pos.y < 7 and pos.y > 0 then
local num_water_source = get_num_nodes(pos, {"default:water_source", "default:river_water_source"})
--print("num_water_source:"..dump(num_water_source))
if num_water_source > 100 then
return {beach=beach}
end
end
local num_desert = get_num_nodes(pos, {"default:desert_sand", "default:desert_stone"})
--print("num_desert:"..dump(num_desert))
if num_desert > 150 then
return {desert=desert}
end
@ -253,21 +243,18 @@ local still_playing = function(still_playing, player)
if not still_playing.largefire then stop_sound(largefire, player) end
end
local function tick()
for _,player in ipairs(minetest.get_connected_players()) do
--local t1 = os.clock()
ambiences = get_ambience(player)
--print ("[AMBIENCE] "..math.ceil((os.clock() - t1) * 1000).." ms")
still_playing(ambiences, player)
if get_volume(player:get_player_name(), "ambience") > 0 then
local playername = player:get_player_name()
local gain = get_volume(playername, "ambience")
if gain > 0 then
--local t1 = os.clock()
local ambiences = get_ambience(player)
--print ("[AMBIENCE] "..math.ceil((os.clock() - t1) * 1000).." ms")
still_playing(ambiences, player)
for _,ambience in pairs(ambiences) do
if math.random(1, 1000) <= ambience.frequency then
if ambience.on_start and played_on_start == false then
played_on_start = true
minetest.sound_play(ambience.on_start,
{to_player=player:get_player_name(),gain=get_volume(player:get_player_name(), "ambience")})
end
play_sound(player, ambience, math.random(1, #ambience))
end
end

View File

@ -172,3 +172,33 @@ function areas:getSpawn(pos)
end
return nil
end
--MFF DEBUT crabman(17/09/2015 ) respawn player in special area(event) if a spawn is set.
--1 party (2 party in beds mod)
local dead_players = {}
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if not player_name then return end
local pos = player:getpos()
if pos then
dead_players[player_name] = pos
end
end)
function areas:onRespawn(player)
local player_name = player:get_player_name()
if not player_name or not dead_players[player_name] then return false end
local pos = dead_players[player_name]
dead_players[player_name] = nil
if pos then
for _, area in pairs(areas:getAreasAtPos(pos)) do
if area.spawn then
player:setpos(area.spawn)
return true
end
end
end
return false
end
--FIN

View File

@ -13,7 +13,23 @@
darkage:gneiss
--]]
local function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, stratus_chance, radius, radius_y, deep, height_min, height_max)
local getID = minetest.get_content_id
local function generate_stratus(data, varea, name, wherein, ceilin, ceil, minp, maxp, seed, stratus_chance, radius, radius_y, deep, height_min, height_max)
local c_ore = getID(name)
local c_wherein = {}
local c_ceilin = {}
for k, v in ipairs(wherein) do
c_wherein[k] = getID(v)
end
for k, v in ipairs(ceilin) do
c_ceilin[k] = getID(v)
end
local c_ceil
if ceil then
c_ceil = getID(ceil)
end
if maxp.y < height_min or minp.y > height_max then
return
end
@ -51,80 +67,86 @@ local function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, s
z0 = pr:next(minp.z, z0)
end
local p0 = {x=x0, y=y0, z=z0}
local n = minetest.get_node(p0).name
local n = data[varea:indexp(p0)]
local i = 0
x = 0
for k, v in ipairs(ceilin) do
for k, v in ipairs(c_ceilin) do
if n == v then
x = 1
break
end
end
if x == 1 then
for y1=y0-1,y_min,-1 do
p0.y=y1
n = minetest.get_node(p0).name
x = 0
for k, v in ipairs(wherein) do
if n == v then
x = 1
break
end
end
if x == 1 then
y0=y1-deep
if y0 < y_min then
y0 = y_min
end
break
end
end
local rx=pr:next(radius/2,radius)+1
local rz=pr:next(radius/2,radius)+1
local ry=pr:next(radius_y/2,radius_y)+1
for x1=0,rx do
rz = rz + 3 - pr:next(1,6)
if rz < 1 then
rz = 1
end
for z1=pr:next(1,3),rz do
local ry0=ry+ pr:next(1,3)
for y1=pr:next(1,3),ry0 do
local x2 = x0+x1
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
n = minetest.get_node(p2).name
for y1=y0-1,y_min,-1 do
p0.y=y1
n = data[varea:indexp(p0)]
x = 0
for k, v in ipairs(wherein) do
if n == v then
x = 1
for k, v in ipairs(c_wherein) do
if n == v then
x = 1
break
end
end
if x == 1 then
y0=y1-deep
if y0 < y_min then
y0 = y_min
end
break
end
end
if x == 1 then
if ceil == nil then
minetest.set_node(p2, {name=name})
i = i +1
else
local p3 = {p2.x,p2.y+1,p2}
if minetest.get_node(p3).name == ceil then
minetest.set_node(p2, {name=name})
i = i +1
local rx=pr:next(radius/2,radius)+1
local rz=pr:next(radius/2,radius)+1
local ry=pr:next(radius_y/2,radius_y)+1
for x1=0,rx do
rz = rz + 3 - pr:next(1,6)
if rz < 1 then
rz = 1
end
for z1=pr:next(1,3),rz do
local ry0=ry+ pr:next(1,3)
for y1=pr:next(1,3),ry0 do
local x2 = x0+x1
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
n = data[varea:indexp(p2)]
x = 0
for k, v in ipairs(c_wherein) do
if n == v then
x = 1
break
end
end
if x == 1 then
if c_ceil == nil then
data[varea:indexp(p2)] = c_ore
i = i +1
else
local p3 = {p2.x,p2.y+1,p2}
if data[varea:indexp(p3)] == c_ceil then
data[varea:indexp(p2)] = c_ore
i = i +1
end
end
end
end
end
end
print(" generated "..dump(i).." blocks in ("..dump(x0)..","..dump(y0)..","..dump(z0)..")")
end
end
end
print(" generated "..dump(i).." blocks in ("..dump(x0)..","..dump(y0)..","..dump(z0)..")")
-- end end end end!
end
end
end
end
local function generate_claylike(name, minp, maxp, seed, chance, minh, maxh, dirt)
local function generate_claylike(data, varea, name, minp, maxp, seed, chance, minh, maxh, dirt)
local c_ore = getID(name)
local c_sand = getID("default:sand")
local c_dirt = getID("default:dirt")
local c_lawn = getID("default:dirt_with_grass")
local c_water = getID("default:water_source")
local c_air = getID("air")
if maxp.y >= maxh+1 and minp.y <= minh-1 then
local pr = PseudoRandom(seed)
local divlen = 4
@ -136,33 +158,33 @@ local function generate_claylike(name, minp, maxp, seed, chance, minh, maxh, dir
for divz=0+1,divs-1-1 do
local cx = minp.x + math.floor((divx+0.5)*divlen)
local cz = minp.z + math.floor((divz+0.5)*divlen)
local up = minetest.get_node({x=cx,y=yy,z=cz}).name
local down = minetest.get_node({x=cx,y=yy-1,z=cz}).name
if ( up == "default:water_source" or up == "air" ) and ( down == "default:sand" or (dirt == 1 and (down == "default:dirt" or down == "default:dirt_with_grass" ))) then
local up = data[varea:index(cx,yy,cz)]
local down = data[varea:index(cx,yy-1,cz)]
if ( up == c_water or up == c_air ) and ( down == c_sand or (dirt == 1 and (down == c_dirt or down == c_lawn ))) then
local is_shallow = true
local num_water_around = 0
if minetest.get_node({x=cx-divlen*2,y=yy,z=cz}).name == "default:water_source" then
if data[varea:index(cx-divlen*2,yy,cz)] == c_water then
num_water_around = num_water_around + 1
end
if minetest.get_node({x=cx+divlen*2,y=yy,z=cz}).name == "default:water_source" then
if data[varea:index(cx+divlen*2,yy,cz)] == c_water then
num_water_around = num_water_around + 1
end
if minetest.get_node({x=cx,y=yy,z=cz-divlen*2}).name == "default:water_source" then
if data[varea:index(cx,yy,cz-divlen*2)] == c_water then
num_water_around = num_water_around + 1
end
if minetest.get_node({x=cx,y=yy,z=cz+divlen*2}).name == "default:water_source" then
if data[varea:index(cx,yy,cz+divlen*2)] == c_water then
num_water_around = num_water_around + 1
end
if num_water_around >= 3 then
is_shallow = false
end
end
if is_shallow then
for x1=-divlen,divlen do
for z1=-divlen,divlen do
local p={x=cx+x1,y=yy-1,z=cz+z1}
down = minetest.get_node(p).name
if down == "default:sand" or (dirt == 1 and (down == "default:dirt" or down == "default:dirt_with_grass")) then
minetest.set_node(p, {name=name})
down = data[varea:indexp(p)]
if down == c_sand or (dirt == 1 and (down == c_dirt or down == c_lawn)) then
data[varea:indexp(p)] = c_ore
end
end
end
@ -176,7 +198,10 @@ local function generate_claylike(name, minp, maxp, seed, chance, minh, maxh, dir
end
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
local function generate_ore(data, varea, name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
local c_ore = getID(name)
local c_wherein = getID(wherein)
if maxp.y < height_min or minp.y > height_max then
return
end
@ -200,8 +225,9 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
if minetest.get_node(p2).name == wherein then
minetest.set_node(p2, {name=name})
local indexp2 = varea:indexp(p2)
if data[indexp2] == c_wherein then
data[indexp2] = c_ore
end
end
end
@ -211,45 +237,65 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
end
end
minetest.register_on_generated(function(minp, maxp, seed)
if minp.y < -19600 then return end
print("DARKAGE: Generate stratus");
generate_claylike("darkage:mud", minp, maxp, seed+1, 4, 0, 2, 0)
generate_claylike("darkage:silt", minp, maxp, seed+2, 4, -1, 1, 1)
generate_stratus("darkage:chalk",
function darkage_mapgen(data, area, minp, maxp, seed) -- public function, to be used by Lua mapgens
if minp.y < -19600 then return end
local t1 = os.clock()
generate_claylike(data, area, "darkage:mud", minp, maxp, seed+1, 4, 0, 2, 0)
generate_claylike(data, area, "darkage:silt", minp, maxp, seed+2, 4, -1, 1, 1)
generate_stratus(data, area, "darkage:chalk",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+3, 4, 25, 8, 0, -20, 50)
generate_stratus("darkage:ors",
generate_stratus(data, area, "darkage:ors",
{"default:stone"},
{"default:stone","air","default:water_source"}, nil,
minp, maxp, seed+4, 4, 25, 7, 50, -200, 500)
generate_stratus("darkage:shale",
generate_stratus(data, area, "darkage:shale",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+5, 4, 23, 7, 50, -50, 20)
generate_stratus("darkage:slate",
generate_stratus(data, area, "darkage:slate",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+6, 6, 23, 5, 50, -500, 0)
generate_stratus("darkage:schist",
generate_stratus(data, area, "darkage:schist",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+7, 6, 19, 6, 50, -31000, -10)
generate_stratus("darkage:basalt",
generate_stratus(data, area, "darkage:basalt",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+8, 5, 20, 5, 20, -31000, -50)
generate_stratus("darkage:marble",
generate_stratus(data, area, "darkage:marble",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+9, 4, 25, 6, 50, -31000, -75)
generate_stratus("darkage:serpentine",
generate_stratus(data, area, "darkage:serpentine",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+10, 4, 28, 8, 50, -31000, -350)
generate_stratus("darkage:gneiss",
generate_stratus(data, area, "darkage:gneiss",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+11, 4, 15, 5, 50, -31000, -250)
print("DARKAGE: calculating time : " .. os.clock() - t1)
end
minetest.register_on_mapgen_init(function(mgparams)
if mgparams.mgname ~= "singlenode" then
minetest.register_on_generated(function(minp, maxp, seed)
if minp.y < -19600 then return end
local t0 = os.clock()
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local data = vm:get_data()
darkage_mapgen(data, area, minp, maxp, seed)
vm:set_data(data)
vm:write_to_map()
print("DARKAGE: total time taken : " .. os.clock() - t0)
end)
end
end)

View File

@ -69,30 +69,30 @@ end
local p0 = {-2/16, -1/2, -2/16, 2/16, 1/2, 2/16}
local p1 = {-2/16, 1/2, -2/16, -2/16, 1/2+8/16, -2/16}
local p2 = {-2/16, 1/2, 2/16, -2/16, 1/2+8/16, 2/16}
local p1 = {-2/16, 1/2, -2/16, -2/16, 1/2--[[+8/16]], -2/16}
local p2 = {-2/16, 1/2, 2/16, -2/16, 1/2--[[+8/16]], 2/16}
local p3 = {0, 0, 0, 0, 0, 0}
local p4 = {2/16, 1/2, -2/16, 2/16, 1/2+8/16, -2/16}
local p5 = {2/16, 1/2, 2/16, 2/16, 1/2+8/16, 2/16}
local p4 = {2/16, 1/2, -2/16, 2/16, 1/2--[[+8/16]], -2/16}
local p5 = {2/16, 1/2, 2/16, 2/16, 1/2--[[+8/16]], 2/16}
local x1 = {-2/16, 1/2-4/16, 1/16, -1/2, 1/2-1/16, -1/16} --oben(quer) -x
local x12 = {-2/16, -1/2+6/16, 1/16, -1/2, -1/2+9/16, -1/16} --unten(quer) -x
local x12 = {-2/16, -1/2+6/16, 1/16, -1/2, -1/2--[[+9/16]], -1/16} --unten(quer) -x
local x2 = {2/16, 1/2-4/16, -1/16, 1/2, 1/2-1/16, 1/16} --oben(quer) x
local x22 = {2/16, -1/2+6/16, -1/16, 1/2, -1/2+9/16, 1/16} --unten(quer) x
local x22 = {2/16, -1/2+6/16, -1/16, 1/2, -1/2--[[+9/16]], 1/16} --unten(quer) x
local z1 = {1/16, 1/2-4/16, -2/16, -1/16, 1/2-1/16, -1/2} --oben(quer) -z
local z12 = {1/16, -1/2+6/16, -2/16, -1/16, -1/2+9/16, -1/2} --unten(quer) -z
local z12 = {1/16, -1/2+6/16, -2/16, -1/16, -1/2--[[+9/16]], -1/2} --unten(quer) -z
local z2 = {-1/16, 1/2-4/16, 2/16, 1/16, 1/2-1/16, 1/2} --oben(quer) z
local z22 = {-1/16, -1/2+6/16, 2/16, 1/16, -1/2+9/16, 1/2} --unten(quer) z
local z22 = {-1/16, -1/2+6/16, 2/16, 1/16, -1/2--[[+9/16]], 1/2} --unten(quer) z
local bz1 = {1/16, 1/2-1/16, -6/16, 1/16, 1/2+8/16, -6/16} --oben_block(quer) -z 1seite
local bz11 = {-1/16, 1/2-1/16, -6/16, -1/16, 1/2+8/16, -6/16} --oben_block(quer) -z 2seite
local bz2 = {1/16, 1/2-1/16, 5/16, 1/16, 1/2+8/16, 5/16} --oben_block(quer) z 1seite
local bz21 = {-1/16, 1/2-1/16, 5/16, -1/16, 1/2+8/16, 5/16} --oben_block(quer) z 2seite
local bz1 = {1/16, 1/2-1/16, -6/16, 1/16, 1/2--[[+8/16]], -6/16} --oben_block(quer) -z 1seite
local bz11 = {-1/16, 1/2-1/16, -6/16, -1/16, 1/2--[[+8/16]], -6/16} --oben_block(quer) -z 2seite
local bz2 = {1/16, 1/2-1/16, 5/16, 1/16, 1/2--[[+8/16]], 5/16} --oben_block(quer) z 1seite
local bz21 = {-1/16, 1/2-1/16, 5/16, -1/16, 1/2--[[+8/16]], 5/16} --oben_block(quer) z 2seite
local bx1 = {-6/16, 1/2-1/16, 1/16, -6/16, 1/2+8/16, 1/16} --oben_block(quer) -x 1seite
local bx11 = {-6/16, 1/2-1/16, -1/16, -6/16, 1/2+8/16, -1/16} --oben_block(quer) -x 2seite
local bx2 = {5/16, 1/2-1/16, 1/16, 5/16, 1/2+8/16, 1/16} --oben_block(quer) x 1seite
local bx21 = {5/16, 1/2-1/16, -1/16, 5/16, 1/2+8/16, -1/16} --oben_block(quer) x 2seite
local bx1 = {-6/16, 1/2-1/16, 1/16, -6/16, 1/2--[[+8/16]], 1/16} --oben_block(quer) -x 1seite
local bx11 = {-6/16, 1/2-1/16, -1/16, -6/16, 1/2--[[+8/16]], -1/16} --oben_block(quer) -x 2seite
local bx2 = {5/16, 1/2-1/16, 1/16, 5/16, 1/2--[[+8/16]], 1/16} --oben_block(quer) x 1seite
local bx21 = {5/16, 1/2-1/16, -1/16, 5/16, 1/2--[[+8/16]], -1/16} --oben_block(quer) x 2seite
minetest.register_node("fences:fence_wood", {

View File

@ -194,13 +194,15 @@ function refill(player, stck_name, index)
local inv = player:get_inventory()
local old_stack = inv:get_stack("main", index)
if old_stack:get_name() == stck_name then return end
for i,stack in ipairs(inv:get_list("main")) do
if i ~= index and stack:get_name() == stck_name then
inv:set_stack("main", index, stack)
stack:clear()
inv:set_stack("main", i, stack)
minetest.log("action", "Inventory Tweaks: refilled stack("..stck_name..") of " .. player:get_player_name() )
return
if inv:get_list("main") then
for i,stack in ipairs(inv:get_list("main")) do
if i ~= index and stack:get_name() == stck_name then
inv:set_stack("main", index, stack)
stack:clear()
inv:set_stack("main", i, stack)
minetest.log("action", "Inventory Tweaks: refilled stack("..stck_name..") of " .. player:get_player_name() )
return
end
end
end
end

View File

@ -1,6 +1,38 @@
item_drop = {}
local enable_damage = minetest.setting_getbool("enable_damage")
local creative_mode = minetest.setting_getbool("creative_mode")
local TICK_UPDATE = 0.1
local die_timeout = 20
local die_time = {}
local die_respawned = {}
minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
die_time[player_name] = 0
die_respawned[player_name] = false
end)
minetest.register_on_leaveplayer(function(player)
local player_name = player:get_player_name()
die_time[player_name] = nil
die_respawned[player_name] = nil
end)
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if not player_name then return end
die_respawned[player_name] = false
die_time[player_name] = die_timeout
end)
minetest.register_on_respawnplayer(function(player)
local player_name = player:get_player_name()
if not player_name then return end
die_respawned[player_name] = true
end)
-- Following edits by gravgun
@ -33,81 +65,88 @@ local pickup_duration = 0.1
local pickup_inv_duration = 1/pickup_duration*0.7
local function tick()
minetest.after(0.1, tick)
local tstamp = minetest.get_us_time()
for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not enable_damage then
local pos = player:getpos()
pos.y = pos.y + player_half_height
local inv = player:get_inventory()
local player_name = player:get_player_name()
if die_time[player_name] and die_time[player_name] < 1 then
if player:get_hp() > 0 or not enable_damage then
local pos = player:getpos()
pos.y = pos.y + player_half_height
local inv = player:get_inventory()
if inv then
for _,object in ipairs(minetest.get_objects_inside_radius(pos, scan_range)) do
local luaEnt = object:get_luaentity()
if luaEnt and luaEnt.name == "__builtin:item" then
local ticky = luaEnt.item_drop_min_tstamp
if ticky then
if tstamp >= ticky then
luaEnt.item_drop_min_tstamp = nil
end
elseif not luaEnt.item_drop_nopickup then
-- Point-line distance computation, heavily simplified since the wanted line,
-- being the player, is completely upright (no variation on X or Z)
local pos2 = object:getpos()
-- No sqrt, avoid useless computation
-- (just take the radius, compare it to the square of what you want)
-- Pos order doesn't really matter, we're squaring the result
-- (but don't change it, we use the cached values afterwards)
local dX = pos.x-pos2.x
local dZ = pos.z-pos2.z
local playerDistance = dX*dX+dZ*dZ
if playerDistance <= pickup_range_squared then
local itemStack = ItemStack(luaEnt.itemstring)
if inv:room_for_item("main", itemStack) then
local vec = {x=dX, y=pos.y-pos2.y, z=dZ}
vec.x = vec.x*pickup_inv_duration
vec.y = vec.y*pickup_inv_duration
vec.z = vec.z*pickup_inv_duration
object:setvelocity(vec)
luaEnt.physical_state = false
luaEnt.object:set_properties({
physical = false
})
-- Mark the object as already picking up
luaEnt.item_drop_nopickup = true
if inv then
for _,object in ipairs(minetest.get_objects_inside_radius(pos, scan_range)) do
local luaEnt = object:get_luaentity()
if luaEnt and luaEnt.name == "__builtin:item" then
local ticky = luaEnt.item_drop_min_tstamp
if ticky then
if tstamp >= ticky then
luaEnt.item_drop_min_tstamp = nil
end
elseif not luaEnt.item_drop_nopickup then
-- Point-line distance computation, heavily simplified since the wanted line,
-- being the player, is completely upright (no variation on X or Z)
local pos2 = object:getpos()
-- No sqrt, avoid useless computation
-- (just take the radius, compare it to the square of what you want)
-- Pos order doesn't really matter, we're squaring the result
-- (but don't change it, we use the cached values afterwards)
local dX = pos.x-pos2.x
local dZ = pos.z-pos2.z
local playerDistance = dX*dX+dZ*dZ
if playerDistance <= pickup_range_squared then
local itemStack = ItemStack(luaEnt.itemstring)
if inv:room_for_item("main", itemStack) then
local vec = {x=dX, y=pos.y-pos2.y, z=dZ}
vec.x = vec.x*pickup_inv_duration
vec.y = vec.y*pickup_inv_duration
vec.z = vec.z*pickup_inv_duration
object:setvelocity(vec)
luaEnt.physical_state = false
luaEnt.object:set_properties({
physical = false
})
-- Mark the object as already picking up
luaEnt.item_drop_nopickup = true
minetest.after(pickup_duration, function()
local lua = luaEnt
if object == nil or lua == nil or lua.itemstring == nil then
return
end
if inv:room_for_item("main", itemStack) then
inv:add_item("main", itemStack)
if luaEnt.itemstring ~= "" then
minetest.sound_play("item_drop_pickup", {pos = pos, gain = 0.3, max_hear_distance = 8})
minetest.after(pickup_duration, function()
local lua = luaEnt
if object == nil or lua == nil or lua.itemstring == nil then
return
end
luaEnt.itemstring = ""
object:remove()
for i, cb in ipairs(item_drop.pickup_callbacks) do
cb(player, itemstack)
if inv:room_for_item("main", itemStack) then
inv:add_item("main", itemStack)
if luaEnt.itemstring ~= "" then
minetest.sound_play("item_drop_pickup", {pos = pos, gain = 0.3, max_hear_distance = 8})
end
luaEnt.itemstring = ""
object:remove()
for i, cb in ipairs(item_drop.pickup_callbacks) do
cb(player, itemstack)
end
else
object:setvelocity({x = 0,y = 0,z = 0})
luaEnt.physical_state = true
luaEnt.object:set_properties({
physical = true
})
luaEnt.item_drop_nopickup = nil
end
else
object:setvelocity({x = 0,y = 0,z = 0})
luaEnt.physical_state = true
luaEnt.object:set_properties({
physical = true
})
luaEnt.item_drop_nopickup = nil
end
end)
end)
end
end
end
end
end
end
end
else
if die_respawned[player_name] then
die_time[player_name] = (die_time[player_name] or die_timeout) - TICK_UPDATE
end
end
end
minetest.after(TICK_UPDATE, tick)
end
local mt_handle_node_drops = minetest.handle_node_drops
@ -149,7 +188,7 @@ end
local mt_item_drop = minetest.item_drop
function minetest.item_drop(itemstack, dropper, pos)
if dropper.is_player then
if dropper and dropper.is_player then
local v = dropper:get_look_dir()
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
local cs = itemstack:get_count()

View File

@ -360,6 +360,7 @@ local permafire = table.copy(minetest.registered_nodes["fire:basic_flame"])
permafire.stack_max = 10000
permafire.range = 12
permafire.description = S("Permanent Fire")
permafire.groups = {not_in_creative_inventory = maptools.creative}
minetest.register_node("maptools:permanent_fire", permafire)

View File

@ -10,7 +10,7 @@ minetest.register_node("mesecons:mesecon_off", {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.45, 0.5},
},
groups = {dig_immediate=3, mesecon=1, mesecon_conductor_craftable=1},
groups = {dig_immediate=2, mesecon=1, mesecon_conductor_craftable=1}, --MFF
description="Mesecons",
mesecons = {conductor={
state = mesecon.state.off,
@ -28,7 +28,7 @@ minetest.register_node("mesecons:mesecon_on", {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.45, 0.5},
},
groups = {dig_immediate=3, not_in_creaive_inventory=1, mesecon=1},
groups = {dig_immediate=2, not_in_creaive_inventory=1, mesecon=1}, --MFF
drop = "mesecons:mesecon_off 1",
light_source = default.LIGHT_MAX-11,
mesecons = {conductor={

View File

@ -197,9 +197,9 @@ register_wires = function()
offstate = "mesecons:wire_"..nodeid.."_off"
}}
local groups_on = {dig_immediate = 3, mesecon_conductor_craftable = 1,
not_in_creative_inventory = 1}
local groups_off = {dig_immediate = 3, mesecon_conductor_craftable = 1}
local groups_on = {dig_immediate = 2, mesecon_conductor_craftable = 1,
not_in_creative_inventory = 1} --MFF
local groups_off = {dig_immediate = 2, mesecon_conductor_craftable = 1} --MFF
if nodeid ~= "00000000" then
groups_off["not_in_creative_inventory"] = 1
end

View File

@ -37,7 +37,7 @@ minetest.register_node("mesecons_extrawires:corner_on", {
sunlight_propagates = true,
selection_box = corner_selectionbox,
node_box = corner_nodebox,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
groups = {dig_immediate = 2, not_in_creative_inventory = 1}, -- MFF
drop = "mesecons_extrawires:corner_off",
mesecons = {conductor =
{
@ -64,7 +64,7 @@ minetest.register_node("mesecons_extrawires:corner_off", {
sunlight_propagates = true,
selection_box = corner_selectionbox,
node_box = corner_nodebox,
groups = {dig_immediate = 3},
groups = {dig_immediate = 2}, --MFF
mesecons = {conductor =
{
state = mesecon.state.off,

View File

@ -41,7 +41,7 @@ minetest.register_node("mesecons_extrawires:crossover_off", {
{ -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 },
},
},
groups = {dig_immediate=3, mesecon=3},
groups = {dig_immediate=2, mesecon=3}, --MFF
mesecons = {
conductor = {
states = crossover_states,
@ -77,7 +77,7 @@ minetest.register_node("mesecons_extrawires:crossover_01", {
{ -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 },
},
},
groups = {dig_immediate=3, mesecon=3, not_in_creative_inventory=1},
groups = {dig_immediate=2, mesecon=3, not_in_creative_inventory=1}, --MFF
mesecons = {
conductor = {
states = crossover_states,

View File

@ -38,7 +38,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", {
sunlight_propagates = true,
selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
groups = {dig_immediate = 2, not_in_creative_inventory = 1}, --MFF
drop = "mesecons_extrawires:tjunction_off",
mesecons = {conductor =
{
@ -65,7 +65,7 @@ minetest.register_node("mesecons_extrawires:tjunction_off", {
sunlight_propagates = true,
selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox,
groups = {dig_immediate = 3},
groups = {dig_immediate = 2}, --MFF
mesecons = {conductor =
{
state = mesecon.state.off,

View File

@ -90,7 +90,8 @@ mesecon.register_node("mesecons_extrawires:vertical", {
after_dig_node = vertical_update
},{
tiles = {"mesecons_wire_off.png"},
groups = {dig_immediate=3},
groups = {dig_immediate=2}, --MFF
vertical_conductor_state = "off",
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_extrawires:vertical_on",
@ -98,7 +99,8 @@ mesecon.register_node("mesecons_extrawires:vertical", {
}}
},{
tiles = {"mesecons_wire_on.png"},
groups = {dig_immediate=3, not_in_creative_inventory=1},
groups = {dig_immediate=2, not_in_creative_inventory=1}, --MFF
vertical_conductor_state = "on",
mesecons = {conductor = {
state = mesecon.state.on,
offstate = "mesecons_extrawires:vertical_off",
@ -113,7 +115,7 @@ mesecon.register_node("mesecons_extrawires:vertical_top", {
walkable = false,
paramtype = "light",
sunlight_propagates = true,
groups = {dig_immediate=3, not_in_creative_inventory=1},
groups = {dig_immediate=2, not_in_creative_inventory=1}, --MFF
selection_box = top_box,
node_box = top_box,
is_vertical_conductor = true,
@ -143,7 +145,7 @@ mesecon.register_node("mesecons_extrawires:vertical_bottom", {
walkable = false,
paramtype = "light",
sunlight_propagates = true,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
groups = {dig_immediate = 2, not_in_creative_inventory = 1}, --MFF
selection_box = bottom_box,
node_box = bottom_box,
is_vertical_conductor = true,

View File

@ -30,7 +30,7 @@ minetest.register_node("mesecons_insulated:insulated_on", {
type = "fixed",
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
groups = {dig_immediate = 2, not_in_creative_inventory = 1}, --MFF
drop = "mesecons_insulated:insulated_off",
mesecons = {conductor = {
state = mesecon.state.on,
@ -62,7 +62,7 @@ minetest.register_node("mesecons_insulated:insulated_off", {
type = "fixed",
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
groups = {dig_immediate = 3},
groups = {dig_immediate = 2}, --MFF
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_insulated:insulated_on",

View File

@ -1,4 +1,4 @@
-- Mobs Api (8th February 2016)
-- Mobs Api (9th February 2016)
mobs = {}
mobs.mod = "redo"
@ -1986,7 +1986,7 @@ end -- END mobs:register_mob function
mobs.spawning_mobs = {}
function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
interval, chance, active_object_count, min_height, max_height, spawn_in_area) --MFF crabman
interval, chance, active_object_count, min_height, max_height, spawn_in_area, day_toggle) --MFF crabman "spawn_in_area"
mobs.spawning_mobs[name] = true
@ -1995,7 +1995,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
if new_chance ~= nil then
if chance == 0 then
if new_chance == 0 then
--print("[Mobs Redo] " .. name .. " has spawning disabled")
return
end
@ -2022,6 +2022,24 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
return
end
-- if toggle set to nil then ignore day/night check
if day_toggle ~= nil then
local tod = (minetest.get_timeofday() or 0) * 24000
if tod > 4500 and tod < 19500 then
-- daylight, but mob wants night
if day_toggle == false then
return
end
else
-- night time but mob wants day
if day_toggle == true then
return
end
end
end
-- spawn above node
pos.y = pos.y + 1
@ -2082,10 +2100,10 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
end
-- compatibility with older mob registration
function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height)
function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_in_area, day_toggle)
mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30,
chance, active_object_count, -31000, max_height)
chance, active_object_count, -31000, max_height, spawn_in_area, day_toggle)
end
-- set content id's
@ -2308,7 +2326,7 @@ function mobs:register_egg(mob, desc, background, addegg)
inventory_image = invimg,
groups = {not_in_creative_inventory = 1}, -- MFF creative (Mg|11/25/2015)
on_place = function(itemstack, placer, pointed_thing)
if not minetest.check_player_privs(placer:get_player_name(), {server=true}) then -- MFF creative
if not minetest.check_player_privs(placer:get_player_name(), {server=true}) then -- MFF
return
end
local pos = pointed_thing.above

View File

@ -49,7 +49,7 @@ mobs:register_mob("mobs:bee", {
end,
})
-- spawn on group:flowers between 4 and 20 light, 1 in 5000 chance, 1 bee in area up to 31000 in height
mobs:spawn_specific("mobs:bee", {"group:flower"}, {"air"}, 4, 20, 30, 5000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:bee", {"group:flower"}, {"air"}, 4, 20, 30, 5000, 2, -31000, 31000, true, true)
-- register spawn egg
mobs:register_egg("mobs:bee", "Bee", "mobs_bee_inv.png", 1)
@ -73,9 +73,13 @@ minetest.register_node("mobs:beehive", {
groups = {fleshy=3,dig_immediate=3},
on_use = minetest.item_eat(4),
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name = "mobs:beehive", param2 = 1})
if math.random(1, 5) == 1 then
minetest.add_entity(pos, "mobs:bee")
end
@ -113,4 +117,4 @@ minetest.register_craft({
recipe = {
{"mobs:honey_block"},
}
})
})

View File

@ -51,9 +51,9 @@ mobs:register_mob("mobs:bunny", {
},
-- follows carrot from farming redo
follow = {"farming:carrot", "farming_plus:carrot_item"},
view_range = 10,
view_range = 8,
-- eat carrots
replace_rate = 80,
replace_rate = 10,
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
replace_with = "air",
-- right click to pick up rabbit
@ -90,5 +90,5 @@ mobs:register_mob("mobs:bunny", {
attack_type = "dogfight",
damage = 5,
})
mobs:spawn_specific("mobs:bunny", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:bunny", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true)
mobs:register_egg("mobs:bunny", "Bunny", "mobs_bunny_inv.png", 1)

View File

@ -58,20 +58,26 @@ mobs:register_mob("mobs:chicken", {
},
-- follows wheat
follow = {"farming:seed_wheat", "farming:seed_cotton"},
view_range = 8,
view_range = 5,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end,
do_custom = function(self)
if not self.child
and math.random(1, 500) == 1 then
local pos = self.object:getpos()
minetest.add_item(pos, "mobs:egg")
minetest.sound_play("default_place_node_hard", {
pos = pos,
gain = 1.0,
@ -81,7 +87,7 @@ mobs:register_mob("mobs:chicken", {
end,
})
-- spawn on default or bamboo grass between 8 and 20 light, 1 in 10000 change, 1 chicken in area up to 31000 in height
mobs:spawn_specific("mobs:chicken", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:chicken", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true)
-- register spawn egg
mobs:register_egg("mobs:chicken", "Chicken", "mobs_chicken_inv.png", 1)
-- egg entity
@ -109,16 +115,22 @@ mobs:register_arrow("mobs:egg_entity", {
hit_node = function(self, pos, node)
local num = math.random(1, 10)
if num == 1 then
pos.y = pos.y + 1
local nod = minetest.get_node_or_nil(pos)
if not nod
or not minetest.registered_nodes[nod.name]
or minetest.registered_nodes[nod.name].walkable == true then
return
end
local mob = minetest.add_entity(pos, "mobs:chicken")
local ent2 = mob:get_luaentity()
mob:set_properties({
textures = ent2.child_texture[1],
visual_size = {
@ -134,6 +146,7 @@ mobs:register_arrow("mobs:egg_entity", {
ent2.base_colbox[6] / 2
},
})
ent2.child = true
ent2.tamed = true
ent2.owner = self.playername
@ -148,35 +161,45 @@ local egg_VELOCITY = 19
-- shoot egg
local mobs_shoot_egg = function (item, player, pointed_thing)
local playerpos = player:getpos()
minetest.sound_play("default_place_node_hard", {
pos = playerpos,
gain = 1.0,
max_hear_distance = 5,
})
local obj = minetest.add_entity({
x = playerpos.x,
y = playerpos.y +1.5,
z = playerpos.z
}, "mobs:egg_entity")
local ent = obj:get_luaentity()
local dir = player:get_look_dir()
ent.velocity = egg_VELOCITY -- needed for api internal timing
ent.switch = 1 -- needed so that egg doesn't despawn straight away
obj:setvelocity({
x = dir.x * egg_VELOCITY,
y = dir.y * egg_VELOCITY,
z = dir.z * egg_VELOCITY
})
obj:setacceleration({
x = dir.x * -3,
y = -egg_GRAVITY,
z = dir.z * -3
})
-- pass player name to egg for chick ownership
local ent2 = obj:get_luaentity()
ent2.playername = player:get_player_name()
item:take_item()
return item
end
@ -236,4 +259,4 @@ minetest.register_craft({
type = "cooking",
recipe = "mobs:chicken_raw",
output = "mobs:chicken_cooked",
})
})

View File

@ -60,8 +60,8 @@ mobs:register_mob("mobs:cow", {
punch_end = 100,
},
follow = "farming:wheat",
view_range = 8,
replace_rate = 50,
view_range = 7,
replace_rate = 10,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air",
fear_height = 2,
@ -110,7 +110,7 @@ mobs:register_mob("mobs:cow", {
})
-- spawn on default;green;prairie grass between 0 and 20 light, 1 in 11000 chance, 1 cow in area up to 31000 in height
mobs:spawn_specific("mobs:cow", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:cow", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true)
-- register spawn egg
mobs:register_egg("mobs:cow", "Cow", "mobs_cow_inv.png", 1)

View File

@ -45,11 +45,16 @@ mobs:register_mob("mobs:creeper", {
light_damage = 0,
-- model animation
animation = {
stand_start = 0, stand_end = 24,
walk_start = 25, walk_end = 47,
run_start = 48, run_end = 62,
punch_start = 48, punch_end = 62,
speed_normal = 15, speed_run = 15,
stand_start = 0,
stand_end = 24,
walk_start = 25,
walk_end = 47,
run_start = 48,
run_end = 62,
punch_start = 48,
punch_end = 62,
speed_normal = 15,
speed_run = 15,
},
})
mobs:spawn_specific("mobs:creeper", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 20000, 1, -31000, 31000, false)

View File

@ -33,25 +33,39 @@ mobs:register_mob("mobs:dirt_monster", {
jump = true,
-- drops dirt and coins when dead
drops = {
{name = "default:dirt",
chance = 1, min = 3, max = 5,},
{name = "maptools:silver_coin",
chance = 2, min = 1, max = 1,},
{name = "default:dirt", chance = 1, min = 3, max = 5,},
{name = "maptools:silver_coin", chance = 2, min = 1, max = 1,},
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 2,
fear_height = 3,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 14,
walk_start = 15, walk_end = 38,
run_start = 40, run_end = 63,
punch_start = 40, punch_end = 63,
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
},
})
-- spawn on dirt_with_grass and drygrass between -1 and 5 light, 1 in 10000 change, 1 dirt monster in area up to 31000 in height
mobs:spawn_specific("mobs:dirt_monster", {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, {"air"}, -1, 5, 30, 10000, 1, -31000, 31000, false)
mobs:spawn_specific("mobs:dirt_monster", {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, {"air"}, -1, 5, 30, 10000, 1, -31000, 31000, false, false)
-- register spawn egg
mobs:register_egg("mobs:dirt_monster", "Dirt Monster", "mobs_dirt_monster_inv.png", 1)
minetest.register_craft({
output = "mobs:dirt_monster",
recipe = {
{"default:dirt", "default:dirt", "default:dirt"},
{"default:dirt", "default:nyancat_rainbow", "default:dirt"},
{"default:dirt", "default:dirt", "default:dirt"}
}
})

View File

@ -43,29 +43,28 @@ mobs:register_mob("mobs:dungeon_master", {
knock_back = 0.05, -- Very small knockback
-- drops mese or diamond when dead
drops = {
{name = "mobs:dungeon_master_blood",
chance = 2, min = 1, max = 2,},
{name = "default:diamond",
chance = 4, min = 1, max = 3,},
{name = "default:mese_crystal",
chance = 4, min = 3, max = 6,},
{name = "mobs:dungeon_master_diamond",
chance = 6, min = 1, max = 1,},
{name = "maptools:gold_coin",
chance = 20, min = 1, max = 1,},
{name = "default:diamondblock",
chance = 33, min = 1, max = 1,},
{name = "mobs:dungeon_master_blood", chance = 2, min = 1, max = 2,},
{name = "default:diamond", chance = 4, min = 1, max = 3,},
{name = "default:mese_crystal", chance = 4, min = 3, max = 6,},
{name = "mobs:dungeon_master_diamond", chance = 6, min = 1, max = 1,},
{name = "maptools:gold_coin", chance = 20, min = 1, max = 1,},
{name = "default:diamondblock", chance = 33, min = 1, max = 1,},
},
-- damaged by
water_damage = 1,
lava_damage = 1,
light_damage = 0,
fear_height = 3,
-- model animation
animation = {
stand_start = 0, stand_end = 19,
walk_start = 20, walk_end = 35,
punch_start = 36, punch_end = 48,
speed_normal = 15, speed_run = 15,
stand_start = 0,
stand_end = 19,
walk_start = 20,
walk_end = 35,
punch_start = 36,
punch_end = 48,
speed_normal = 15,
speed_run = 15,
},
})
-- spawn on stone between 20 and -1 light, 1 in 7000 chance, 1 dungeon master in area starting at -100 and below

106
mods/mobs/ent.lua Executable file
View File

@ -0,0 +1,106 @@
-- Ent from https://github.com/Minetest-LOTT/Lord-of-the-Test
mobs:register_mob("mobs:ent", {
type = "npc",
hp_min = 50,
hp_max = 70,
collisionbox = {-0.5, 0, -0.5, 0.5, 5, 0.5},
textures = {
{"mobs_ent.png"},
},
visual_size = {x=3.5,y=3.5},
visual = "mesh",
mesh = "mobs_ent.x",
view_range = 20,
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 1.5,
armor = 100,
damage = 5,
drops = {
{name = "default:sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:apple_tree_sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:birch_sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:beech_sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:acacia_sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:pine_sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:fir_sapling",
chance = 5,
min = 1,
max = 3,},
{name = "moretrees:rubber_tree_sapling",
chance = 5,
min = 1,
max = 3,},
},
light_resistant = true,
drawtype = "front",
water_damage = 0,
lava_damage = 60,
light_damage = 0,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 17,
stand_end = 17,
walk_start = 10,
walk_end = 80,
run_start = 10,
run_end = 80,
punch_start = 1,
punch_end = 1,
},
jump = true,
sounds = {
war_cry = "mobs_die_yell",
death = "mobs_yeti_death",
attack = "default_punch2",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
minetest.register_node("mobs:ent_spawner", {
description = "Ent Spawner",
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png^mobs_chicken_egg.png"},
is_ground_content = false,
groups = {unbreakable = 1, mob_spawner=1},
})
minetest.register_node("mobs:tree_monster_spawner", {
description = "Tree Monster Spawner",
tiles = {"default_wood.png^mobs_chicken_egg.png"},
is_ground_content = false,
groups = {unbreakable = 1, mob_spawner=1},
})
-- Boss
-- spawn on mobs:ent_spawner between 1 and 20 light, 4 interval, 1 chance, 1 ent in area up to 31000 in height
mobs:spawn_specific("mobs:ent", {"mobs:ent_spawner"}, {"air"}, 1, 20, 300, 1, 100, -31000, 31000, true)
mobs:register_egg("mobs:ent", "Ent", "mobs_ent_inv.png", 1)
-- Minions
-- spawn on mobs:pumpboom_spawner between 1 and 20 light, 4 interval, 1 chance, 1 pumpboom in area up to 31000 in height
mobs:spawn_specific("mobs:tree_monster", {"mobs:tree_monster_spawner"}, {"air"}, 1, 20, 10, 4, 100, -31000, 31000, true)

View File

@ -44,10 +44,8 @@ mobs:register_mob("mobs:greensmall", {
floats = 1,
-- chance of dropping glue and coins
drops = {
{name = "mesecons_materials:glue",
chance = 4, min = 1, max = 2},
{name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,},
{name = "mesecons_materials:glue", chance = 4, min = 1, max = 2},
{name = "maptools:silver_coin", chance = 4, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,

View File

@ -26,6 +26,7 @@ dofile(path.."/sandmonster.lua") -- PilzAdam
dofile(path.."/stonemonster.lua") -- PilzAdam
dofile(path.."/treemonster.lua") -- PilzAdam
dofile(path.."/wolf.lua") -- PilzAdam
dofile(path.."/dog.lua") -- CProgrammerRU
--dofile(path.."/lava_flan.lua") -- Zeg9 --Remplaced by Lava Slimes
dofile(path.."/mese_monster.lua") -- Zeg9
dofile(path.."/spider.lua") -- AspireMint
@ -34,6 +35,10 @@ dofile(path.."/lavaslimes.lua") -- davedevils/TomasJLuis/TenPlus1
dofile(path.."/zombie.lua") -- ???
dofile(path.."/yeti.lua") -- ???
dofile(path.."/minotaur.lua") -- Kalabasa
-- The bosses
dofile(path.."/pumpkins.lua")
dofile(path.."/ent.lua")
]]
-- begin slimes mobs compatibility changes

View File

@ -54,11 +54,13 @@ mobs:register_mob("mobs:kitten", {
view_range = 10,
-- feed with raw fish to tame or right click to pick up
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 4, true, true) then
return
end
mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
end
})
mobs:spawn_specific("mobs:kitten", {"default:dirt_with_grass"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:kitten", {"default:dirt_with_grass"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true, true)
mobs:register_egg("mobs:kitten", "Kitten", "mobs_kitten_inv.png", 0)

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:lava_flan", {
-- aggressive, deals 5 damage to player when hit
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 5,
-- health and armor
hp_min = 20,
@ -35,8 +36,7 @@ mobs:register_mob("mobs:lava_flan", {
floats = 1,
-- chance of dropping lava orb when dead
drops = {
{name = "mobs:lava_orb",
chance = 15, min = 1, max = 1},
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1},
},
-- damaged by
water_damage = 5,
@ -44,11 +44,16 @@ mobs:register_mob("mobs:lava_flan", {
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 8,
walk_start = 10, walk_end = 18,
run_start = 20, run_end = 28,
punch_start = 20, punch_end = 28,
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 8,
walk_start = 10,
walk_end = 18,
run_start = 20,
run_end = 28,
punch_start = 20,
punch_end = 28,
},
-- do things when die
on_die = function(self, pos)
@ -66,4 +71,4 @@ minetest.register_craftitem("mobs:lava_orb", {
inventory_image = "zmobs_lava_orb.png",
})
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")

View File

@ -22,7 +22,8 @@ mobs:register_mob("mobs:lavasmall", {
attack_type = "dogfight",
attacks_monsters = true,
-- health and armor
hp_min = 4, hp_max = 8,
hp_min = 4,
hp_max = 8,
armor = 100,
-- textures and model
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
@ -46,10 +47,8 @@ mobs:register_mob("mobs:lavasmall", {
floats = 1,
-- chance of dropping lava orb and coins
drops = {
{name = "mobs:lava_orb",
chance = 15, min = 1, max = 1,},
{name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,},
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1,},
{name = "maptools:silver_coin", chance = 4, min = 1, max = 1,},
},
-- damaged by
water_damage = 10,
@ -70,7 +69,8 @@ mobs:register_mob("mobs:lavamedium", {
attack_type = "dogfight",
attacks_monsters = true,
-- health and armor
hp_min = 16, hp_max = 32,
hp_min = 16,
hp_max = 32,
armor = 90,
-- textures and model
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
@ -162,6 +162,7 @@ mobs:register_mob("mobs:lavabig", {
end
end,
})
mobs:register_egg("mobs:lavabig", "Big Lava Slime", "mobs_lava_slime_big_inv.png", 1)
--mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height)

View File

@ -6,7 +6,7 @@ mobs:register_mob("mobs:mese_monster", {
type = "monster",
-- agressive, deals 9 damage to player when hit
passive = false,
damage = 8,
damage = 7,
attack_type = "shoot",
shoot_interval = 1.0,
arrow = "mobs:mese_arrow",
@ -37,16 +37,13 @@ mobs:register_mob("mobs:mese_monster", {
jump_height = 8,
fall_damage = 0,
fall_speed = -6,
stepheight = 2.1,
-- drops mese when dead
drops = {
{name = "default:mese_crystal",
chance = 9, min = 1, max = 3,},
{name = "default:mese_crystal_fragment",
chance = 1, min = 1, max = 9,},
{name = "maptools:silver_coin",
chance = 1, min = 1, max = 2,},
{name = "returnmirror:mirror_inactive",
chance = 50, min = 1, max = 1,},
{name = "default:mese_crystal", chance = 9, min = 1, max = 3,},
{name = "default:mese_crystal_fragment", chance = 1, min = 1, max = 9,},
{name = "maptools:silver_coin", chance = 1, min = 1, max = 2,},
{name = "returnmirror:mirror_inactive", chance = 50, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
@ -79,14 +76,14 @@ mobs:register_arrow("mobs:mese_arrow", {
velocity = 6,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8}, --Modif MFF
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8}, --Modif MFF
}, nil)

View File

@ -7,11 +7,11 @@ mobs:register_mob("mobs:minotaur", {
-- aggressive, deals 11 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 10,
damage = 7,
-- health & armor
hp_min = 80,
hp_max = 100,
armor = 70,
hp_min = 60,
hp_max = 70,
armor = 90,
-- textures and model
collisionbox = {-0.9,-0.01,-0.9, 0.9,2.5,0.9},
visual = "mesh",
@ -30,22 +30,18 @@ mobs:register_mob("mobs:minotaur", {
-- death = "mobs_zombie_death",
-- },
-- speed and jump
walk_velocity = 3,
run_velocity = 4,
walk_velocity = 2.5,
run_velocity = 3.5,
jump = true,
floats = 1,
view_range = 16,
knock_back = 0.05, --this is a test
-- drops desert_sand and coins when dead
drops = {
{name = "maptools:gold_coin",
chance = 40, min = 1, max = 1,},
{name = "mobs:minotaur_eye",
chance = 2, min = 1, max = 2,},
{name = "mobs:minotaur_horn",
chance = 4, min = 1, max = 2,},
{name = "mobs:minotaur_fur",
chance = 1, min = 1, max = 3,},
{name = "maptools:gold_coin", chance = 40, min = 1, max = 1,},
{name = "mobs:minotaur_eye", chance = 2, min = 1, max = 2,},
{name = "mobs:minotaur_horn", chance = 4, min = 1, max = 2,},
{name = "mobs:minotaur_fur", chance = 1, min = 1, max = 3,},
},
water_damage = 0,
lava_damage = 5,

View File

@ -47,14 +47,10 @@ mobs:register_mob("mobs:npc", {
jump = true,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "default:axe_stone",
chance = 3, min = 1, max = 1},
-- {name = "maptools:silver_coin",
-- chance = 10, min = 1, max = 1,},
{name = "default:wood", chance = 1, min = 1, max = 3},
{name = "default:apple", chance = 2, min = 1, max = 2},
{name = "default:axe_stone", chance = 3, min = 1, max = 1},
{name = "maptools:silver_coin", chance = 10, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
@ -129,6 +125,6 @@ mobs:register_mob("mobs:npc", {
})
-- spawning enable for now
mobs:spawn_specific("mobs:npc", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 300000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:npc", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 300000, 1, -31000, 31000, true, true)
-- register spawn egg
mobs:register_egg("mobs:npc", "Npc", "mobs_npc_male_inv.png", 1)

View File

@ -8,7 +8,6 @@ mobs.npc_drops = { "farming:meat", "farming:donut", "farming:bread", "default:a
"default:cobble", "default:gravel", "default:clay_lump", "default:sand", "default:dirt_with_grass",
"default:dirt", "default:chest", "default:torch"}
mobs.npc_max_hp = 20
mobs:register_mob("mobs:npc_female", {
-- animal, monster, npc
@ -20,7 +19,9 @@ mobs:register_mob("mobs:npc_female", {
attack_type = "dogfight",
attacks_monsters = true,
-- health & armor
hp_min = 20, hp_max = 20, armor = 100,
hp_min = 20,
hp_max = 20,
armor = 100,
-- textures and model
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
@ -46,18 +47,12 @@ mobs:register_mob("mobs:npc_female", {
jump = true,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "flowers:tulip",
chance = 4, min = 1, max = 2},
{name = "flowers:rose",
chance = 4, min = 1, max = 2},
{name = "default:axe_stone",
chance = 6, min = 1, max = 1},
-- {name = "maptools:silver_coin",
-- chance = 10, min = 1, max = 1,},
{name = "default:wood", chance = 1, min = 1, max = 3},
{name = "default:apple", chance = 2, min = 1, max = 2},
{name = "flowers:tulip", chance = 4, min = 1, max = 2},
{name = "flowers:rose", chance = 4, min = 1, max = 2},
{name = "default:axe_stone", chance = 6, min = 1, max = 1},
{name = "maptools:silver_coin", chance = 10, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
@ -110,6 +105,7 @@ mobs:register_mob("mobs:npc_female", {
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {
@ -126,10 +122,11 @@ mobs:register_mob("mobs:npc_female", {
end
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
end
end,
})
-- spawning enable for now
mobs:spawn_specific("mobs:npc_female", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 300000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:npc_female", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 100000, 1, -31000, 31000, true, true)
-- register spawn egg
mobs:register_egg("mobs:npc_female", "Npc", "mobs_npc_female_inv.png", 1)

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:oerkki", {
-- aggressive, deals 7 damage when player hit
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 6,
-- health & armor
hp_min = 40,
@ -25,7 +26,7 @@ mobs:register_mob("mobs:oerkki", {
makes_footstep_sound = false,
sounds = {
random = "mobs_oerkki",
attack = "mobs_oerkki_attack",
shoot_attack = "mobs_oerkki_attack",
},
-- speed and jump
walk_velocity = 2,
@ -34,22 +35,26 @@ mobs:register_mob("mobs:oerkki", {
jump = true,
-- chance of dropping obsidian and coins
drops = {
{name = "default:obsidian",
chance = 3, min = 1, max = 2,},
{name = "maptools:silver_coin",
chance = 1, min = 1, max = 1},
{name = "default:obsidian", chance = 3, min = 1, max = 2,},
{name = "maptools:silver_coin", chance = 1, min = 1, max = 1},
},
-- damaged by
water_damage = 2,
lava_damage = 4,
light_damage = 1,
fear_height = 3,
-- model animation
animation = {
stand_start = 0, stand_end = 23,
walk_start = 24, walk_end = 36,
run_start = 37, run_end = 49,
punch_start = 37, punch_end = 49,
speed_normal = 15, speed_run = 15,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 36,
run_start = 37,
run_end = 49,
punch_start = 37,
punch_end = 49,
speed_normal = 15,
speed_run = 15,
},
-- replace torch with air (remove)
replace_rate = 50,

View File

@ -6,8 +6,8 @@ mobs:register_mob("mobs:pig", {
type = "animal",
-- aggressive, does 5 damage to player when threatened
passive = false,
group_attack = true,
attack_type = "dogfight",
group_attack = true,
reach = 2,
damage = 4,
-- health & armor
@ -39,10 +39,8 @@ mobs:register_mob("mobs:pig", {
view_range = 10,
-- drops raw pork when dead
drops = {
{name = "mobs:pork_raw",
chance = 1, min = 2, max = 3,},
{name = "maptools:silver_coin",
chance = 10, min = 1, max = 1,},
{name = "mobs:pork_raw", chance = 1, min = 2, max = 3,},
{name = "maptools:silver_coin", chance = 10, min = 1, max = 1,},
},
-- damaged by
water_damage = 1,
@ -52,18 +50,27 @@ mobs:register_mob("mobs:pig", {
-- model animation
animation = {
speed_normal = 15,
stand_start = 25, stand_end = 55,
walk_start = 60, walk_end = 100,
punch_start = 60, punch_end = 100,
stand_start = 25,
stand_end = 55,
walk_start = 60,
walk_end = 100,
punch_start = 60,
punch_end = 100,
},
-- can be tamed by feeding 8 wheat (will not attack when tamed)
on_rightclick = function(self, clicker)
mobs:feed_tame(self, clicker, 8, true, true)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
-- spawns on dirt or junglegrass, between 8 and 20 light, 1 in 15000 chance, 1 in area up to 31000 in height
mobs:spawn_specific("mobs:pig", {"default:dirt", "default:junglegrass", "default:dirt_with_dry_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:pig", {"default:dirt", "default:junglegrass", "default:dirt_with_dry_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true, true)
-- register spawn egg
mobs:register_egg("mobs:pig", "Pig", "mobs_pig_inv.png", 1)

138
mods/mobs/pumpkins.lua Executable file
View File

@ -0,0 +1,138 @@
-- PumpKing by Blert2112
mobs:register_mob("mobs:pumpking", {
type = "monster",
visual = "mesh",
mesh = "mobs_pumpking.x",
textures = {
{"mobs_pumpking.png"}
},
visual_size = {x=3, y=3},
collisionbox = {-0.85, 0.00, -0.85, 0.85, 5.3, 0.85},
animation = {
speed_normal = 15, speed_run = 30,
stand_start = 165, stand_end = 210,
walk_start = 61, walk_end = 110,
run_start = 0, run_end = 50,
punch_start = 150, punch_end = 165
},
makes_footstep_sound = true,
sounds = {
random = "mobs_king"
},
hp_min = 275,
hp_max = 300,
armor = 70,
knock_back = 0,
walk_velocity = 3,
run_velocity = 4,
light_damage = 0,
water_damage = 0,
lava_damage = 0,
fall_damage = 0,
damage = 9,
reach = 5,
attack_type = "dogfight",
view_range = 25,
stepheight = 1.1,
drops = {
-- Ressource & Decoration drops
{name = "farming:jackolantern", chance = 1, min = 1, max = 1},
{name = "default:diamondblock", chance = 2, min = 1, max = 3},
-- Hunter drops
{name = "3d_armor:helmet_hardenedleather", chance = 10, min = 1, max = 1},
{name = "3d_armor:chestplate_hardenedleather", chance = 10, min = 1, max = 1},
{name = "throwing:bow_minotaur_horn", chance = 33, min = 1, max = 1},
-- Warrior drops
{name = "3d_armor:helmet_mithril", chance = 10, min = 1, max = 1},
{name = "3d_armor:chestplate_mithril", chance = 10, min = 1, max = 1},
{name = "moreores:sword_mithril", chance = 33, min = 1, max = 1},
},
lifetimer = 300, -- 5 minutes
--shoot_interval = 1000, -- (lifetimer - (lifetimer / 4)), borrowed for do_custom timer
on_die = function(self)
minetest.chat_send_all("A group of players killed a PumpKing!")
end
})
mobs:register_mob("mobs:pumpboom", {
type = "monster",
visual = "mesh",
mesh = "mobs_pumpboom.x",
textures = {
{"mobs_pumpboom.png"}
},
visual_size = {x=3, y=3},
collisionbox = {-0.70, -0.3, -0.70, 0.70, 0.70, 0.70},
rotate = 270,
animation = {
speed_normal = 15, speed_run = 30,
stand_start = 0, stand_end = 30,
walk_start = 81, walk_end = 97,
run_start = 81, run_end = 97,
punch_start = 100, punch_end = 120
},
sounds = {
random = "mobs_pump"
},
hp_min = 5,
hp_max = 10,
armor = 100,
light_damage = 0,
water_damage = 0,
lava_damage = 0,
fall_damage = 0,
damage = 8,
attack_type = "explode",
group_attack = true,
do_not_project_items = true,
view_range = 15,
walk_velocity = 2,
run_velocity = 4,
drops = {
{name = "farming:pumpkin_seed", chance = 8, min = 4, max = 8}
}
})
minetest.register_node("mobs:pumpking_spawner", {
description = "Pumpkin King Spawner",
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_on.png"
},
is_ground_content = false,
groups = {unbkreakable = 1, mob_spawner=1},
sounds = default.node_sound_stone_defaults({
dug = {name="mobs_king", gain=0.25}
})
})
minetest.register_node("mobs:pumpboom_spawner", {
description = "Pump Boom Spawner",
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_off.png"
},
is_ground_content = false,
groups = {unbreakable = 1, mob_spawner=1},
sounds = default.node_sound_stone_defaults({
dug = {name="mobs_boom", gain=0.25}
})
})
--(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, spawn_in_area)
-- spawn on mobs:pumpking_spawner between 1 and 20 light, interval 300, 1 chance, 1 pumpking_spawner in area up to 31000 in height
mobs:spawn_specific("mobs:pumpking", {"mobs:pumpking_spawner"}, {"air"}, 1, 20, 300, 1, 100, -31000, 31000, true)
mobs:register_egg("mobs:pumpking", "Pumpking", "mobs_pumpking_inv.png", 1)
-- spawn on mobs:pumpboom_spawner between 1 and 20 light, 4 interval, 1 chance, 100 pumpboom in area up to 31000 in height
mobs:spawn_specific("mobs:pumpboom", {"mobs:pumpboom_spawner"}, {"air"}, 1, 20, 10, 4, 100, -31000, 31000, true)
mobs:register_egg("mobs:pumpboom", "Pumpboom", "mobs_pumpboom_inv.png", 1)

View File

@ -47,8 +47,10 @@ mobs:register_mob("mobs:rat", {
end,
--]]
})
-- spawn on stone between 1 and 20 light, 1 in 7000 chance, 1 per area up to 31000 in height
mobs:spawn_specific("mobs:rat", {"default:stone", "default:sandstone"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true)
-- register spawn egg
mobs:register_egg("mobs:rat", "Rat", "mobs_rat_inv.png", 1)

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:sand_monster", {
-- aggressive, deals 5 damage to player when hit
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 4,
-- health & armor
hp_min = 15,
@ -33,25 +34,40 @@ mobs:register_mob("mobs:sand_monster", {
floats = 0,
-- drops desert sand when dead
drops = {
{name = "default:desert_sand",
chance = 1, min = 3, max = 5,},
{name = "maptools:silver_coin",
chance = 10, min = 1, max = 1,},
{name = "default:desert_sand", chance = 1, min = 3, max = 5,},
{name = "maptools:silver_coin", chance = 10, min = 1, max = 1,},
},
-- damaged by
water_damage = 3,
lava_damage = 4,
light_damage = 0,
fear_height = 3,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 39,
walk_start = 41, walk_end = 72,
run_start = 74, run_end = 105,
punch_start = 74, punch_end = 105,
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 39,
walk_start = 41,
walk_end = 72,
run_start = 74,
run_end = 105,
punch_start = 74,
punch_end = 105,
},
})
-- spawns on desert sand between -1 and 20 light, 1 in 15000 chance, 1 sand monster in area up to 31000 in height
mobs:spawn_specific("mobs:sand_monster", {"default:desert_sand", "default:sand"}, {"air"}, -1, 20, 30, 20000, 1, -31000, 31000, false)
-- register spawn egg
mobs:register_egg("mobs:sand_monster", "Sand Monster", "mobs_sand_monster_inv.png", 1)
minetest.register_craft({
output = "mobs:sand_monster",
recipe = {
{"group:sand", "group:sand", "group:sand"},
{"group:sand", "default:nyancat_rainbow", "group:sand"},
{"group:sand", "group:sand", "group:sand"}
}
})

100
mods/mobs/shark.lua Executable file
View File

@ -0,0 +1,100 @@
-- local variables
local l_colors = {
"#111010:200", --dark_grey
"#101020:225", --dark_blue
"#404030:225", --cold_grey
"#404040:210", --light_grey
"#202020:210" --grey
}
local l_skins = {
{"(shark_first.png^[colorize:"..l_colors[1]..")^(shark_second.png^[colorize:"..l_colors[5]..")^shark_third.png"},
{"(shark_first.png^[colorize:"..l_colors[2]..")^(shark_second.png^[colorize:"..l_colors[5]..")^shark_third.png"},
{"(shark_first.png^[colorize:"..l_colors[3]..")^(shark_second.png^[colorize:"..l_colors[4]..")^shark_third.png"}
}
local l_anims = {
speed_normal = 24, speed_run = 24,
stand_start = 1, stand_end = 80,
walk_start = 80, walk_end = 160,
run_start = 80, run_end = 160
}
local l_model = "mobs_shark.b3d"
local l_egg_texture = "mobs_shark_shark_inv.png"
local l_spawn_in = {"default:water_source"}
local l_spawn_near = {"default:water_flowing","default:water_source","seawrecks:woodship","seawrecks:uboot"}
local l_spawn_chance = 500000
-- large
mobs:register_mob("mobs:shark_lg", {
type = "monster",
attack_type = "dogfight",
damage = 6,
reach = 3,
hp_min = 20,
hp_max = 30,
armor = 150,
collisionbox = {-0.75, -0.5, -0.75, 0.75, 0.5, 0.75},
visual = "mesh",
mesh = l_model,
textures = l_skins,
makes_footstep_sound = false,
walk_velocity = 4,
run_velocity = 6,
fly = true,
fly_in = "default:water_source",
fall_speed = 0,
rotate = 270,
view_range = 10,
water_damage = 0,
lava_damage = 10,
light_damage = 0,
animation = l_anims,
do_custom = function(self)
local p = self.object:getpos()
local a = self.object:getvelocity()
if p.y > 0 and a.y > 0 then
a.y = -1
else
local r = math.random(100)
if r >= 1 and r <=25 then a.y = 0.25
elseif r > 25 and r <= 50 then a.y = 0
elseif r > 50 and r <= 75 then a.y = -0.25
end
end
self.object:setvelocity(a)
end
})
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific("mobs:shark_lg", l_spawn_in, l_spawn_near, -1, 20, 30, l_spawn_chance, 1, -50, -1)
mobs:register_egg("mobs:shark_lg", "Shark (large)", l_egg_texture, 1)
-- medium
mobs:register_mob("mobs:shark_md", {
type = "monster",
attack_type = "dogfight",
damage = 5,
reach = 2,
hp_min = 20,
hp_max = 25,
armor = 125,
collisionbox = {-0.57, -0.38, -0.57, 0.57, 0.38, 0.57},
visual = "mesh",
visual_size = {x=0.75, y=0.75},
mesh = l_model,
textures = l_skins,
makes_footstep_sound = false,
walk_velocity = 2,
run_velocity = 4,
fly = true,
fly_in = "default:water_source",
fall_speed = -1,
rotate = 270,
view_range = 10,
water_damage = 0,
lava_damage = 10,
light_damage = 0,
animation = l_anims
})
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific("mobs:shark_md", l_spawn_in, l_spawn_near, -1, 20, 30, l_spawn_chance, 1, -50, -1)
mobs:register_egg("mobs:shark_md", "Shark (medium)", l_egg_texture, 1)

View File

@ -18,7 +18,6 @@ for _, col in pairs(all_colours) do
hp_max = 15,
armor = 200,
-- textures and model
--collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
collisionbox = {-0.5, -1, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "mobs_sheep.b3d",
@ -39,12 +38,10 @@ for _, col in pairs(all_colours) do
runaway = true,
jump = true,
-- drops raw meat and woll of its color when dead
-- drops = {
-- {name = "mobs:meat_raw",
-- chance = 1, min = 2, max = 3},
-- {name = "wool:"..col,
-- chance = 1, min = 1, max = 1},
-- },
drops = {
{name = "mobs:meat_raw", chance = 1, min = 2, max = 3},
{name = "wool:"..col, chance = 1, min = 1, max = 1},
},
-- damaged by
water_damage = 1,
lava_damage = 5,
@ -59,9 +56,9 @@ for _, col in pairs(all_colours) do
walk_end = 100,
},
follow = {"farming:wheat", "default:grass_5"},
view_range = 10,
view_range = 8,
-- replace grass/wheat with air (eat)
replace_rate = 50,
replace_rate = 10,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air",
-- right click sheep to shear sheep and get wood, feed 8 wheat for wool to grow back
@ -75,6 +72,7 @@ for _, col in pairs(all_colours) do
--are we feeding?
if mobs:feed_tame(self, clicker, 8, true, true) then
--if full grow fuzz
if self.gotten == false then
self.object:set_properties({
@ -82,6 +80,7 @@ for _, col in pairs(all_colours) do
mesh = "mobs_sheep.b3d",
})
end
return
end
@ -90,12 +89,18 @@ for _, col in pairs(all_colours) do
--are we giving a haircut>
if itemname == "mobs:shears" then
if self.gotten == false and self.child == false then
self.gotten = true -- shaved
if minetest.get_modpath("wool") then
local pos = self.object:getpos()
pos.y = pos.y + 0.5
local obj = minetest.add_item(pos, ItemStack("wool:"..shpcolor.." "..math.random(1,3)))
if obj then
obj:setvelocity({
x = math.random(-1,1),
@ -103,14 +108,18 @@ for _, col in pairs(all_colours) do
z = math.random(-1,1)
})
end
item:add_wear(650) -- 100 uses
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_sheep_shaved.png"},
mesh = "mobs_sheep_shaved.b3d",
})
end
return
end
@ -118,28 +127,39 @@ for _, col in pairs(all_colours) do
--are we coloring?
if itemname:find("dye:") then
if self.gotten == false
and self.child == false
and self.tamed == true
and name == self.owner then
local col = string.split(itemname,":")[2]
for _,c in pairs(all_colours) do
if c == col then
local pos = self.object:getpos()
self.object:remove()
local mob = minetest.add_entity(pos, "mobs:sheep_"..col)
local ent = mob:get_luaentity()
ent.owner = name
ent.tamed = true
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
break
end
end
end
return
end
@ -152,7 +172,7 @@ for _, col in pairs(all_colours) do
end
mobs:spawn_specific("mobs:sheep_white", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
mobs:spawn_specific("mobs:sheep_white", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true)
-- compatibility (item and entity)
minetest.register_alias("mobs:sheep", "mobs:sheep_white")
@ -168,25 +188,13 @@ minetest.register_entity("mobs:sheep", {
velocity = {x = 0, y = 0, z = 0},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
is_visible = true,
speed = 0,
timer = 0,
on_rightclick = function(self, clicker)
clicker:get_inventory():add_item("main", "mobs:sheep_white")
on_activate = function(self, staticdata, dtime_s)
local pos = self.object:getpos()
self.object:remove()
end,
on_step = function(self, dtime)
self.timer = self.timer + dtime
if self.timer >= 1 then
self.timer = 0
self.object:setacceleration({
x = 0,
y = -10,
z = 0
})
end
end,
minetest.add_entity(pos, "mobs:sheep_white")
end
})

157
mods/mobs/spawner.lua Executable file
View File

@ -0,0 +1,157 @@
-- mob spawner
local spawner_default = "mobs:pig 10 15 0 0"
minetest.register_node("mobs:spawner", {
tiles = {"mob_spawner.png"},
drawtype = "glasslike",
paramtype = "light",
walkable = true,
description = "Mob Spawner",
groups = {cracky = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
-- text entry formspec
meta:set_string("formspec", "field[text;Mob MinLight MaxLight Amount PlayerDist;${command}]")
meta:set_string("infotext", "Spawner Not Active (enter settings)")
meta:set_string("command", spawner_default)
end,
on_right_click = function(pos, placer)
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)
if not fields.text or fields.text == "" then
return
end
local meta = minetest.get_meta(pos)
local comm = fields.text:split(" ")
local name = sender:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local mob = comm[1] -- mob to spawn
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)
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 then
meta:set_string("command", fields.text)
meta:set_string("infotext", "Spawner Active (" .. mob .. ")")
else
minetest.chat_send_player(name, "Mob Spawner settings failed!")
end
end,
})
-- spawner abm
minetest.register_abm({
nodenames = {"mobs:spawner"},
interval = 10,
chance = 4,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
-- check objects inside 9x9 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 9)
-- get meta and command
local meta = minetest.get_meta(pos)
local comm = meta:get_string("command"):split(" ")
-- get settings from command
local mob = comm[1]
local mlig = tonumber(comm[2])
local xlig = tonumber(comm[3])
local num = tonumber(comm[4])
local pla = tonumber(comm[5]) or 0
-- if amount is 0 then do nothing
if num == 0 then
return
end
local count = 0
local ent = nil
-- count mob objects of same type in area
for k, obj in pairs(objs) do
ent = obj:get_luaentity()
if ent and ent.name == mob then
count = count + 1
end
end
-- is there too many of same type?
if count >= num then
return
end
-- spawn mob if player detected and in range
if pla > 0 then
local in_range = 0
local objs = minetest.get_objects_inside_radius(pos, pla)
for _,oir in pairs(objs) do
if oir:is_player() then
in_range = 1
break
end
end
-- player not found
if in_range == 0 then
return
end
end
-- find air blocks within 5 nodes of spawner
local air = minetest.find_nodes_in_area(
{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
if air and #air > 0 then
local pos2 = air[math.random(#air)]
local lig = minetest.get_node_light(pos2) or 0
pos2.y = pos2.y + 0.5
-- only if light levels are within range
if lig >= mlig and lig <= xlig then
minetest.add_entity(pos2, mob)
end
end
end
})

View File

@ -2,11 +2,12 @@
-- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
mobs:register_mob("mobs:spider", {
-- animal, monster, npc, barbarian
docile_by_day = true,
type = "monster",
-- agressive, does 6 damage to player when hit
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 5,
-- health & armor
hp_min = 30,
@ -19,7 +20,7 @@ mobs:register_mob("mobs:spider", {
textures = {
{"mobs_spider.png"},
},
visual_size = {x=7,y=7},
visual_size = {x = 7, y = 7},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
@ -36,13 +37,10 @@ mobs:register_mob("mobs:spider", {
view_range = 16,
floats = 0,
-- drops string with a chance of sandstone or crystal spike if Ethereal installed
drops = {
{name = "farming:string",
chance = 2, min = 1, max = 3,},
{name = "mobs:meat_raw",
chance = 4, min = 1, max = 2,},
{name = "maptools:silver_coin",
chance = 3, min = 1, max = 1,},
drops = {
{name = "farming:string", chance = 2, min = 1, max = 3,},
{name = "mobs:meat_raw", chance = 4, min = 1, max = 2,},
{name = "maptools:silver_coin", chance = 3, min = 1, max = 1,},
},
-- damaged by
water_damage = 5,
@ -50,15 +48,22 @@ mobs:register_mob("mobs:spider", {
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 1, stand_end = 1,
walk_start = 20, walk_end = 40,
run_start = 20, run_end = 40,
punch_start = 50, punch_end = 90,
speed_normal = 15,
speed_run = 15,
stand_start = 1,
stand_end = 1,
walk_start = 20,
walk_end = 40,
run_start = 20,
run_end = 40,
punch_start = 50,
punch_end = 90,
},
})
-- spawn on jungleleaves/jungletree, between 0 and 5 light, 1 in 10000 chance, 1 in area up to 31000 in height
mobs:spawn_specific("mobs:spider", {"default:jungleleaves", "default:jungletree"}, {"air"}, -1, 20, 30, 7500, 1, -31000, 31000, false)
-- register spawn egg
mobs:register_egg("mobs:spider", "Spider", "mobs_spider_inv.png", 1)

View File

@ -7,10 +7,11 @@ mobs:register_mob("mobs:stone_monster", {
-- aggressive, deals 8 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 7,
reach = 2,
damage = 6,
-- health & armor
hp_min = 30,
hp_max = 35,
hp_min = 20,
hp_max = 25,
armor = 70,
-- textures and model
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
@ -36,12 +37,9 @@ mobs:register_mob("mobs:stone_monster", {
drops = {
{name = "default:torch",
chance = 10, min = 3, max = 5,},
{name = "default:iron_lump",
chance = 5, min = 1, max = 2,},
{name = "default:coal_lump",
chance = 3, min = 1, max = 3,},
{name = "maptools:silver_coin",
chance = 1, min = 1, max = 1,},
{name = "default:iron_lump", chance = 5, min = 1, max = 2,},
{name = "default:coal_lump", chance = 3, min = 1, max = 3,},
{name = "maptools:silver_coin", chance = 1, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
@ -49,14 +47,30 @@ mobs:register_mob("mobs:stone_monster", {
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 14,
walk_start = 15, walk_end = 38,
run_start = 40, run_end = 63,
punch_start = 40, punch_end = 63,
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
},
})
-- spawns on stone between -1 and 5 light, 1 in 7000 chance, 1 in area below -25
mobs:spawn_specific("mobs:stone_monster", {"default:stone", "default:sandstone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, -25, false)
-- register spawn egg
mobs:register_egg("mobs:stone_monster", "Stone Monster", "mobs_stone_monster_inv.png", 1)
minetest.register_craft({
output = "mobs:stone_monster",
recipe = {
{"default:stone", "default:stone", "default:stone"},
{"default:stone", "default:nyancat_rainbow", "default:stone"},
{"default:stone", "default:stone", "default:stone"}
}
})

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:tree_monster", {
-- aggressive, deals 9 damage to player when hit
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 8,
-- health & armor
hp_min = 40,
@ -32,16 +33,11 @@ mobs:register_mob("mobs:tree_monster", {
view_range = 16,
-- drops saplings, junglesapling, apple and/or silver coin
drops = {
{name = "default:sapling",
chance = 2, min = 1, max = 2},
{name = "default:junglesapling",
chance = 2, min = 1, max = 2},
{name = "default:apple",
chance = 2, min = 2, max = 3,},
{name = "maptools:superapple",
chance = 4, min = 1, max = 1,},
{name = "maptools:silver_coin",
chance = 3, min = 1, max = 1,},
{name = "default:sapling", chance = 2, min = 1, max = 2},
{name = "default:junglesapling", chance = 2, min = 1, max = 2},
{name = "default:apple", chance = 2, min = 2, max = 3,},
{name = "maptools:superapple", chance = 4, min = 1, max = 1,},
{name = "maptools:silver_coin", chance = 3, min = 1, max = 1,},
},
-- damaged by
water_damage = 1,
@ -50,15 +46,22 @@ mobs:register_mob("mobs:tree_monster", {
fall_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 24,
walk_start = 25, walk_end = 47,
run_start = 48, run_end = 62,
punch_start = 48, punch_end = 62,
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 24,
walk_start = 25,
walk_end = 47,
run_start = 48,
run_end = 62,
punch_start = 48,
punch_end = 62,
},
})
-- spawn on leaves and beech_leaves, between 0 and 5 light, 1 in 8000 chance, 1 in area up to 31000 in height
mobs:spawn_specific("mobs:tree_monster", {"default:leaves", "moretrees:beech_leaves"}, {"air"}, 0, 5, 30, 8000, 1, -31000, 31000, false)
mobs:spawn_specific("mobs:tree_monster", {"default:leaves", "moretrees:beech_leaves"}, {"air"}, 0, 5, 30, 8000, 1, -31000, 31000, false, false)
-- register spawn egg
mobs:register_egg("mobs:tree_monster", "Tree Monster", "mobs_tree_monster_inv.png", 1)
@ -66,4 +69,13 @@ mobs:register_egg("mobs:tree_monster", "Tree Monster", "mobs_tree_monster_inv.pn
if not minetest.get_modpath("ethereal") then
minetest.register_alias("ethereal:tree_sapling", "default:sapling")
minetest.register_alias("ethereal:jungle_tree_sapling", "default:junglesapling")
end
end
minetest.register_craft({
output = "mobs:tree_monster",
recipe = {
{"default:tree", "default:tree", "default:tree"},
{"default:tree", "default:nyancat_rainbow", "default:tree"},
{"default:tree", "default:tree", "default:tree"}
}
})

View File

@ -7,7 +7,8 @@ mobs:register_mob("mobs:yeti", {
-- agressive, deals 7 damage to player when hit
passive = false,
damage = 6,
attack_type = "shoot",
attack_type = "dogshoot",
reach = 2,
shoot_interval = .75,
arrow = "mobs:snowball",
shoot_offset = 2,
@ -28,7 +29,7 @@ mobs:register_mob("mobs:yeti", {
makes_footstep_sound = true,
sounds = {
random = "mobs_dirtmonster",
attack = "mobs_stonemonster_attack",
shoot_attack = "mobs_stonemonster_attack",
death = "mobs_zombie_death",
},
-- speed and jump
@ -70,16 +71,16 @@ mobs:register_arrow("mobs:snowball", {
velocity = 6,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=6},
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=3},
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 3},
}, 0)
end,

View File

@ -137,8 +137,7 @@ local nodes = {
["iron_glass"] = {
description = S("Iron Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_iron_glass.png", "moreblocks_iron_glass_detail.png"},
tiles = {"moreblocks_iron_glass.png"},
tiles = {"moreblocks_iron_glass.png", "moreblocks_iron_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
@ -147,8 +146,7 @@ local nodes = {
["coal_glass"] = {
description = S("Coal Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_coal_glass.png", "moreblocks_coal_glass_detail.png"},
tiles = {"moreblocks_coal_glass.png"},
tiles = {"moreblocks_coal_glass.png", "moreblocks_coal_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
@ -157,8 +155,7 @@ local nodes = {
["clean_glass"] = {
description = S("Clean Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_clean_glass.png", "moreblocks_clean_glass_detail.png"},
tiles = {"moreblocks_clean_glass.png"},
tiles = {"moreblocks_clean_glass.png", "moreblocks_clean_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
@ -230,8 +227,7 @@ local nodes = {
["trap_glass"] = {
description = S("Trap Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_trap_glass.png", "default_glass_detail.png"},
tiles = {"moreblocks_trap_glass.png"},
tiles = {"moreblocks_trap_glass.png", "default_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
walkable = false,
@ -284,8 +280,7 @@ local nodes = {
["glow_glass"] = {
description = S("Glow Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_glow_glass.png", "moreblocks_glow_glass_detail.png"},
tiles = {"moreblocks_glow_glass.png"},
tiles = {"moreblocks_glow_glass.png", "moreblocks_glow_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
light_source = 11,
@ -295,8 +290,7 @@ local nodes = {
["trap_glow_glass"] = {
description = S("Trap Glow Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_trap_glass.png", "moreblocks_glow_glass_detail.png"},
tiles = {"moreblocks_trap_glass.png"},
tiles = {"moreblocks_trap_glass.png", "moreblocks_glow_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
light_source = 11,
@ -308,8 +302,7 @@ local nodes = {
["super_glow_glass"] = {
description = S("Super Glow Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_super_glow_glass.png", "moreblocks_super_glow_glass_detail.png"},
tiles = {"moreblocks_super_glow_glass.png"},
tiles = {"moreblocks_super_glow_glass.png", "moreblocks_super_glow_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
light_source = 15,
@ -319,8 +312,7 @@ local nodes = {
["trap_super_glow_glass"] = {
description = S("Trap Super Glow Glass"),
drawtype = "glasslike_framed_optional",
--tiles = {"moreblocks_trap_super_glow_glass.png", "moreblocks_super_glow_glass_detail.png"},
tiles = {"moreblocks_trap_super_glow_glass.png"},
tiles = {"moreblocks_trap_super_glow_glass.png", "moreblocks_super_glow_glass_detail.png"}, --MFF connected glass
paramtype = "light",
sunlight_propagates = true,
light_source = 15,

View File

@ -227,7 +227,8 @@ local oredefs = {
tools = {
pick = {
groupcaps = {
cracky = {times = {[1] = 3.0, [2] = 1.20, [3] = 0.70}, uses = 90, maxlevel= 2}
cracky = {times = {[1] = 3.0, [2] = 1.20, [3] = 0.70}, uses = 90, maxlevel= 2},
crumbly = {times = {[1] = 1.75, [2] = 0.80, [3] = 0.65}, uses = 90, maxlevel= 2}
},
damage_groups = {fleshy = 3},
full_punch_interval = 0.8,
@ -272,7 +273,8 @@ local oredefs = {
tools = {
pick = {
groupcaps = {
cracky = {times = {[1] = 1.50, [2] = 0.80, [3] = 0.35}, uses = 200, maxlevel= 3}
cracky = {times = {[1] = 1.50, [2] = 0.80, [3] = 0.35}, uses = 200, maxlevel= 3},
crumbly = {times = {[1] = 1.00, [2] = 0.60, [3] = 0.25}, uses = 200, maxlevel= 3}
},
damage_groups = {fleshy = 5},
full_punch_interval = 0.5,

View File

@ -112,7 +112,7 @@ minetest.register_abm({nodenames = {"group:vacuum_tube"},
chance = 1,
label = "Vacuum tubes",
action = function(pos, node, active_object_count, active_object_count_wider)
if node.name == "pipeworks:sand_tube" then
if node.name:find("pipeworks:sand_tube") then
vacuum(pos, 2)
else
local radius = minetest.get_meta(pos):get_int("dist")

View File

@ -44,6 +44,12 @@ minetest.register_node("dryplants:juncus", {
fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16},
},
on_place = function(itemstack, placer, pointed_thing)
local playername = placer:get_player_name()
if minetest.is_protected(pointed_thing.above, playername) or
minetest.is_protected(pointed_thing.under, playername) then
minetest.chat_send_player(playername, "Someone else owns that spot.")
return
end
local pos = pointed_thing.under
local juncus_type = math.random(2,3)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}

View File

@ -242,13 +242,12 @@ minetest.register_node("ferns:fern_trunk_big", {
},
groups = {tree=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
sounds = default.node_sound_wood_defaults(),
after_destruct = function(pos,oldnode)
local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if node.name == "ferns:fern_trunk_big" or node.name == "ferns:fern_trunk_big_top" then
minetest.dig_node({x=pos.x,y=pos.y+1,z=pos.z})
minetest.add_item(pos,"ferns:fern_trunk_big")
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if node.name == "ferns:fern_trunk_big" or node.name == "ferns:fern_trunk_big_top" then
minetest.node_dig({x=pos.x,y=pos.y+1,z=pos.z}, node, digger)
end
end,
})
-----------------------------------------------------------------------------------------------
@ -276,7 +275,7 @@ minetest.register_abm({
chance = 4,
action = function(pos, node, _, _)
abstract_ferns.grow_giant_tree_fern({x = pos.x, y = pos.y-1, z = pos.z})
end
end
})
-----------------------------------------------------------------------------------------------

View File

@ -67,9 +67,9 @@ minetest.register_node("ferns:tree_fern_leaves", {
{
items = {"ferns:sapling_tree_fern"},
},
{
items = {"ferns:tree_fern_leaves"},
}
-- {
-- items = {"ferns:tree_fern_leaves"},
-- }
}
},
sounds = default.node_sound_leaves_defaults(),
@ -98,9 +98,9 @@ minetest.register_node("ferns:tree_fern_leaves_02", {
{
items = {"ferns:sapling_tree_fern"},
},
{
items = {"ferns:tree_fern_leaves"},
}
-- {
-- items = {"ferns:tree_fern_leaves"},
-- }
}
},
sounds = default.node_sound_leaves_defaults(),
@ -131,11 +131,10 @@ minetest.register_node("ferns:fern_trunk", {
},
groups = {tree=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
sounds = default.node_sound_wood_defaults(),
after_destruct = function(pos,oldnode)
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if node.name == "ferns:fern_trunk" then
minetest.dig_node({x=pos.x,y=pos.y+1,z=pos.z})
minetest.add_item(pos,"ferns:fern_trunk")
minetest.node_dig({x=pos.x,y=pos.y+1,z=pos.z}, node, digger)
end
end,
})

View File

@ -66,7 +66,7 @@ biome_lib:register_generate_plant({
rarity = Molehills_Rarity,
min_elevation = 1,
max_elevation = 40,
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node","air"},
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"},--"air"},
avoid_radius = 4,
plantlife_limit = -0.3,
},
@ -79,7 +79,7 @@ biome_lib:register_generate_plant({
rarity = 97,
min_elevation = 1,
max_elevation = 40,
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node","air"},
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"},--,"air"},
avoid_radius = 4,
plantlife_limit = -0.3,
},

View File

@ -8,8 +8,8 @@ minetest.register_tool("vines:shears", {
full_punch_interval = 1.0,
max_drop_level=0,
groupcaps={
snappy={times={[3]=0.2}, maxwear=0.05, maxlevel=3},
wool={times={[3]=0.2}, maxwear=0.05, maxlevel=3}
snappy={times={[3]=0.2}, uses = 1/0.05, maxlevel=3},
wool={times={[3]=0.2}, uses = 1/0.05, maxlevel=3}
}
},
})

View File

@ -1,145 +1,274 @@
--------------------------------------
-- Rollbacks, go Out of those FiLes!
-- ROFL
-- <put meaning here>
-- ROFLMAO
-- Licence : CC0
-- Last modified : 27/11/15
-- By : Mg
--
--
local filepath = minetest.get_worldpath() .. "/rollback/"
local patchsegs = 0
local patchtotp = 100
local bufferfiles = minetest.get_worldpath() .. "/roflmao/"
minetest.mkdir(bufferfiles)
local function none(v)
if not v or v == "None" then
return nil
else
return v
rofl = {}
rofl.version = "ROFLMAO"
rofl.files = {}
rofl.conf = {}
rofl.conf.Tick = 20 -- Tick interval
rofl.conf.Rpertick = 20000 -- Max reading operations per tick
rofl.conf.Wpertick = 50000 -- Max writing operations per tick
rofl.conf.Apertick = 10000 -- Max application operations per tick
rofl.conf.Lpertick = 75000 -- Max loading operations per tick
rofl.buffers = {}
rofl.buffers.RCache = {} -- Reading
rofl.buffers.WCache = {} -- Writing
rofl.buffers.LCache = {} -- Loading -- not in use
rofl.buffers.ACache = {} -- Application
-------------------------------------------------
-- ROFL Capture (not copter)
-- Queue nodes to be written in a buffer file
-------------------------------------------------
function rofl.capture(f, pos1, pos2)
local posU = {x = math.max(pos1.x, pos2.x), y = math.max(pos1.y, pos2.y), z = math.max(pos1.z, pos2.z)}
local posD = {x = math.min(pos1.x, pos2.x), y = math.min(pos1.y, pos2.y), z = math.min(pos1.z, pos2.z)}
local n = 0
for x = posD.x, posU.x do
for y = posD.y, posU.y do
for z = posD.z, posU.z do
local node = minetest.get_node({x = x, y = y, z = z})
if node.name == "ignore" then
-- return false, "Area unloaded : ~" .. minetest.pos_to_string({x = x, y = y, z = z})
else
table.insert(rofl.buffers.WCache, {f, x-posD.x .. ";" .. y-posD.y .. ";" .. z-posD.z .. "|" .. minetest.serialize(node) .. "\n"})
n = n + 1
end
end
end
end
return n
end
local function metaread(v)
--[[
Eg. : channel-in="keyboard",channel-out="terminal",formspec="field[text;;${command}]"
]]
if not v or v == "None" or v == "[]" then return nil end
v = string.sub(v,2,string.len(v)-1)
-- Meta extraction
local cursor = 0
local metas = {}
while cursor <= string.len(v) do
local key, value
local keybeg, keyend, valbeg, valend = cursor, cursor, cursor, cursor
keyend = string.find(v, "=\"", cursor)-1
key = string.sub(v,keybeg,keyend)
valbeg = keyend+3
valend = (string.find(v, "\",", valbeg) or string.len(v))-1
value = string.sub(v,valbeg,valend)
cursor = valend+3
metas[key] = value
end
return metas
end
local function parser(fields)
end
minetest.register_chatcommand("rofl", {
description = "Save MFF",
privs = {server = true},
minetest.register_chatcommand("roflCapture", {
params = "<name> <pos1> <pos2>",
description = "Capture nodes contained in area pos1 to pos2",
privs = {server=true},
func = function(name, param)
-- Alert
minetest.chat_send_all("*** Server Freezing")
local f, p1, p2 = unpack(param:split(" "))
-- The main loop
local i = 0
if tonumber(param) then
i = tonumber(param)
if not f then
return false, "Invalid buffer name"
elseif not minetest.string_to_pos(p1) then
return false, "Invalid pos1"
elseif not minetest.string_to_pos(p2) then
return false, "Invalid pos2"
end
local vm = minetest.get_voxel_manip()
while true do
local file = io.open(filepath .. "/database-output." .. i .. ".txt", "r")
if not file then
break
end
minetest.log("action", "[ROFL] Opened file database-output." .. i .. ".txt ... Extracting datas")
-- [
-- id=155,actor=Mg,type=1;
-- list=None,index=None,add=None,stacknode=None,stackquantity=None,nodemeta=None;
-- x=-18,y=29,z=31;
-- newnode=air,newparam1=13,newparam2=None,newmeta=None
-- ]
for fields in file:lines() do
local id = tonumber(string.sub(fields, string.find(fields, "id=")+string.len("id="), string.find(fields, ",actor")-1))
local actor = string.sub(fields, string.find(fields, "actor=")+string.len("actor="), string.find(fields, ",type")-1)
local action_type = tonumber(string.sub(fields, string.find(fields, "type=")+string.len("type="), string.find(fields, ";list")-1))
p1 = minetest.string_to_pos(p1)
p2 = minetest.string_to_pos(p2)
local list = none(string.sub(fields, string.find(fields, "list=")+string.len("list="), string.find(fields, ",index")-1))
local index = none(tonumber(string.sub(fields, string.find(fields, "index=")+string.len("index="), string.find(fields, ",add")-1)))
local add = none(tonumber(string.sub(fields, string.find(fields, "add=")+string.len("add="), string.find(fields, ",stacknode")-1)))
local stacknode = none(string.sub(fields, string.find(fields, "stacknode=")+string.len("stacknode="), string.find(fields, ",stackquantity")-1))
local stackquantity = none(tonumber(string.sub(fields, string.find(fields, "stackquantity=")+string.len("stackquantity="), string.find(fields, ";x=")-1)))
local x = none(tonumber(string.sub(fields, string.find(fields, ";x=")+string.len(";x="), string.find(fields, ",y=")-1)))
local y = none(tonumber(string.sub(fields, string.find(fields, ",y=")+string.len(",y="), string.find(fields, ",z=")-1)))
local z = none(tonumber(string.sub(fields, string.find(fields, ",z=")+string.len(",z="), string.find(fields, ";newnode=")-1)))
local newnode = none(string.sub(fields, string.find(fields, "newnode=")+string.len("newnode="), string.find(fields, ",newparam1")-1))
local newparam1 = none(tonumber(string.sub(fields, string.find(fields, "newparam1=")+string.len("newparam1="), string.find(fields, ",newparam2")-1)))
local newparam2 = none(tonumber(string.sub(fields, string.find(fields, "newparam2=")+string.len("newparam2="), string.find(fields, ",newmeta=")-1)))
local newmeta = none(metaread(string.sub(fields, string.find(fields, ",newmeta=")+string.len(",newmeta="), string.len(fields)-1)))
minetest.log("action","[ROFL] Applying id = " .. id)
if patchsegs % patchtotp == 0 then
minetest.get_player_by_name(name):setpos({x = x, y = y, z = z})
patchsegs = 0
end
if action_type == 1 then -- TYPE_SETNODE
local forced = minetest.forceload_block({x = x, y = y, z = z})
if forced then
minetest.set_node({x = x, y = y, z = z}, {name = newnode, param1 = newparam1, param2 = newparam2})
minetest.forceload_free_block({x = x, y = y, z = z})
else
minetest.log("error", "[ROFL] Couldn't forceplace block " .. minetest.pos_to_string({x = x, y = y, z = z}))
end
if newmeta then
local meta = minetest.get_meta({x = x, y = y, z = z})
for key,value in ipairs(newmeta) do
if tonumber(value) then
meta:set_int(key, value)
else
meta:set_string(key,value)
end
end
end
elseif action_type == 2 then -- TYPE_MODIFY_INVENTORY_STACK
local inv = minetest.get_meta({x = x, y = y, z = z}):get_inventory()
local stack = inv:get_stack(list, index)
if add == 1 then
stack:set_name(stacknode)
stack:set_count(stackquantity)
else
stack:take_item(stackquantity)
end
inv:set_stack(list, index, stack)
else -- TYPE_NOTHING
print("W.T.F. is type " .. (action_type or "nil"))
end
patchsegs = patchsegs + 1
end
i = i + 1
io.close(file)
if tonumber(param) then
break
end
local k, u = rofl.capture(f, p1, p2)
if k then
io.close(io.open(bufferfiles .. f .. ".buf", "w")) -- Remove any previous file that would have the same name
return true, "Successfully captured area from " ..
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1) ..
" in file " .. f .. " : " .. k .. " nodes"
else
return false, "Failed to capture the area : " .. u
end
minetest.chat_send_all("*** Server Up")
end,
})
----------------------
-- Node application
----------------------
function rofl.apply(pos, buf)
local f = io.open(bufferfiles .. buf .. ".buf")
if not f then
return false, "No such buffer : " .. buf
end
local l = 0
for line in f:lines() do
local t, node = unpack(line:split("|"))
t = t:split(";")
if table.getn(t) == 3 then
local pos2 = {x = t[1] + math.floor(pos.x), y = t[2] + math.floor(pos.y), z = t[3] + math.floor(pos.z)}
node = minetest.deserialize(node)
table.insert(rofl.buffers.ACache, {pos2, node})
l = l + 1
end
end
f:close()
return l
end
minetest.register_chatcommand("roflPaste", {
params = "<name> [<pos>]",
description = "Apply nodes present in buffer",
privs = {server=true},
func = function(name, param)
local bufname, pos = unpack(param:split(" "))
if not bufname or bufname == "" then
return false, "Invalid buffer name"
elseif not pos or pos == "" then
local p = minetest.get_player_by_name(name)
if not p then
return false, "Unable to get your position"
else
pos = minetest.pos_to_string(p:getpos())
end
end
if not minetest.string_to_pos(pos) then
return false, "Invalid pos"
end
local k, u = rofl.apply(minetest.string_to_pos(pos), bufname)
if not k then
return false, "Unable to apply nodes : " .. u
else
minetest.log("action", "{ROFL} " .. k .. " nodes queued")
return true, k .. " nodes are queued"
end
end
})
-----------------
-- Empty Caches
-----------------
minetest.register_chatcommand("roflFlush", {
params = "<W|A>",
description = "Empty Writing or Application buffers",
privs = {server=true},
func = function(name, param)
if param == "" then
return false, "Enter a letter, either W(riting) or A(pplication)"
elseif param == "W" then
rofl.buffers.WCache = {}
return true, "WCache flushed"
elseif param == "A" then
rofl.buffers.ACache = {}
return true, "ACache flushed"
else
return false, "Unknown cache name : " .. param
end
end
})
-------------------------
-- Delete buffer files
-------------------------
minetest.register_chatcommand("roflReset", {
params = "<name>",
description = "Empty a buffer file (or create the file if it doesn't exist)",
privs = {server=true},
func = function(name, param)
param = param:split(" ")[1]
if param == "" then
return false, "Enter a buffer name please"
else
io.close(io.open(bufferfiles .. param .. ".buf", "w"))
return true, "Done"
end
end
})
-------------------------------
-- Regularly work on queues
-------------------------------
function tick()
local t = os.time()
-- Writing
if table.getn(rofl.buffers.WCache) > 0 then
minetest.log("action", "{ROFL} WCache has " .. table.getn(rofl.buffers.WCache) .. " elements")
minetest.log("action", "{ROFL} Doing up to " .. rofl.conf.Wpertick .. " writing operations")
for x = 1, rofl.conf.Wpertick do
if not rofl.buffers.WCache[1] then break end
if not rofl.files[rofl.buffers.WCache[1][1]] then
rofl.files[rofl.buffers.WCache[1][1]] = io.open(bufferfiles .. rofl.buffers.WCache[1][1] .. ".buf", "w")
end
rofl.files[rofl.buffers.WCache[1][1]]:write(rofl.buffers.WCache[1][2])
table.remove(rofl.buffers.WCache, 1)
end
if table.getn(rofl.buffers.WCache) == 0 then
minetest.log("action", "{ROFL} Operations finished")
for fname, f in pairs(rofl.files) do
f:close()
minetest.log("action", "{ROFL} Closing filebuf " .. fname)
end
rofl.files = {}
end
end
--[[if table.getn(rofl.buffers.LCache) > 0 then
minetest.log("action", "{ROFL} LCache has " .. table.getn(rofl.buffers.LCache) .. " elements")
minetest.log("action", "{ROFL} Doing up to " .. rofl.conf.Lpertick .. " loading operations")
for x = 1, rofl.conf.Lpertick do
if not rofl.buffers.LCache[1] then break end
table.remove(rofl.buffers.LCache, 1)
end
if table.getn(rofl.buffers.LCache) == 0 then
minetest.log("action", "{ROFL} Loading operations finished")
end
end]]
-- Applying
if table.getn(rofl.buffers.ACache) > 0 then
minetest.log("action", "{ROFL} ACache has " .. table.getn(rofl.buffers.ACache) .. " elements")
minetest.log("action", "{ROFL} Doing up to " .. rofl.conf.Apertick .. " application operations")
for x = 1, rofl.conf.Apertick do
if not rofl.buffers.ACache[1] then break end
minetest.set_node(rofl.buffers.ACache[1][1], rofl.buffers.ACache[1][2])
table.remove(rofl.buffers.ACache, 1)
end
if table.getn(rofl.buffers.ACache) == 0 then
minetest.log("action", "{ROFL} Operations finished")
end
end
local t2 = os.time()
if os.difftime(t2, t) > 0 then
minetest.log("action", "{ROFL} Tick took " .. os.difftime(t2, t) .. "s")
end
minetest.after(rofl.conf.Tick, tick)
end
minetest.after(1, tick)
--------------------------------
-- Clean our mess on shutdown
--------------------------------
minetest.register_on_shutdown(function()
if table.getn(rofl.buffers.WCache) > 0 then
minetest.log("warning", "{ROFL} WCache is not empty! Canceling all pending writing operations")
rofl.buffers.WCache = {}
end
if table.getn(rofl.buffers.ACache) > 0 then
minetest.log("warning", "{ROFL} ACache is not empty! Canceling all pending application operations")
rofl.buffers.ACache = {}
end
for fname, f in pairs(rofl.files) do
f:close()
minetest.log("action", "{ROFL} Closing filebuf " .. fname)
end
end)

View File

@ -568,7 +568,6 @@ function signs_lib.determine_sign_type(itemstack, placer, pointed_thing, locked)
local fdir = minetest.dir_to_facedir(dir)
local pt_name = minetest.get_node(under).name
minetest.log("action", dump(pt_name))
local signname = itemstack:get_name()
if fences_with_sign[pt_name] and signname == "default:sign_wall" then
@ -858,22 +857,22 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
def_sign = signs_lib.table_copy(def_sign)
fences_with_sign[fencename] = fencewithsignname
def.on_place = function(itemstack, placer, pointed_thing, ...)
local node_above = minetest.get_node(pointed_thing.above)
local node_under = minetest.get_node(pointed_thing.under)
local def_above = minetest.registered_nodes[node_above.name]
local def_under = minetest.registered_nodes[node_under.name]
def_sign.on_place = function(itemstack, placer, pointed_thing, ...)
local node_above = minetest.get_node_or_nil(pointed_thing.above)
local node_under = minetest.get_node_or_nil(pointed_thing.under)
local def_above = node_above and minetest.registered_nodes[node_above.name]
local def_under = node_under and minetest.registered_nodes[node_under.name]
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local playername = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, playername) then
minetest.record_protection_violation(pointed_thing.under, playername)
return
return itemstack
end
if minetest.is_protected(pointed_thing.above, playername) then
minetest.record_protection_violation(pointed_thing.above, playername)
return
return itemstack
end
if def_under and def_under.on_rightclick then
@ -884,15 +883,14 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
itemstack:take_item()
end
placer:set_wielded_item(itemstack)
return itemstack
elseif not def_above or def_above.buildable_to then
elseif def_above and def_above.buildable_to then
minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir})
if not signs_lib.expect_infinite_stacks then
itemstack:take_item()
end
placer:set_wielded_item(itemstack)
return itemstack
end
return itemstack
end
def_sign.on_construct = function(pos, ...)
signs_lib.construct_sign(pos)
@ -915,7 +913,7 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
minetest.register_node(":"..fencename, def)
minetest.register_node(":"..fencewithsignname, def_sign)
table.insert(signs_lib.sign_node_list, fencewithsignname)
minetest.log("action", S("Registered %s and %s"):format(fencename, fencewithsignname))
minetest.log("verbose", S("Registered %s and %s"):format(fencename, fencewithsignname))
end
build_char_db()

BIN
mods/signs_lib/textures/signs_blue_front.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 B

After

Width:  |  Height:  |  Size: 175 B

BIN
mods/signs_lib/textures/signs_blue_inv.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 154 B

BIN
mods/signs_lib/textures/signs_brown_front.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

After

Width:  |  Height:  |  Size: 175 B

BIN
mods/signs_lib/textures/signs_brown_inv.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 155 B

BIN
mods/signs_lib/textures/signs_orange_front.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 B

After

Width:  |  Height:  |  Size: 170 B

BIN
mods/signs_lib/textures/signs_orange_inv.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 141 B

Some files were not shown because too many files have changed in this diff Show More