1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-08 11:30:21 +01:00

Merge branch 'master' of github.com:Ombridride/minetest-minetestforfun-server

This commit is contained in:
Ombridride 2015-06-27 19:11:53 +02:00
commit 283b6043b0
30 changed files with 598 additions and 10 deletions

View File

@ -87,6 +87,10 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
"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)

View File

@ -18,6 +18,10 @@ local function active_formspec(fuel_percent, item_percent)
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0, 4.25)
return formspec
end

View File

@ -1824,6 +1824,7 @@ minetest.register_node("default:chest_locked", {
on_blast = function() end,
})
default.bookshelf_formspec =
"size[8,7;]" ..
default.gui_slots ..

View File

@ -0,0 +1,28 @@
farming.register_hoe(name, hoe definition)
-> Register a new hoe, see [hoe definition]
farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [Plant definition]
Hoe Definition
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
material = "", -- Material for recipes
recipe = { -- Craft recipe, if material isn't used
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
}
}
Plant definition
{
description = "", -- Description of seed item
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested
^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow
maxlight = default.LIGHT_MAX -- Maximum light to grow
}

View File

@ -0,0 +1,303 @@
-- Wear out hoes, place soil
-- TODO Ignore group:flower
farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local above = minetest.get_node(p)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if the node above the pointed thing is air
if above.name ~= "air" then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
-- check if (wet) soil defined
local regN = minetest.registered_nodes
if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then
return
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name = regN[under.name].soil.dry})
minetest.sound_play("default_dig_crumbly", {
pos = pt.under,
gain = 0.5,
})
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/(uses-1))
end
return itemstack
end
-- Register new hoes
farming.register_hoe = function(name, def)
-- Check for : prefix (register new hoes in your mod's namespace)
if name:sub(1,1) ~= ":" then
name = ":" .. name
end
-- Check def table
if def.description == nil then
def.description = "Hoe"
end
if def.inventory_image == nil then
def.inventory_image = "unknown_item.png"
end
if def.recipe == nil then
def.recipe = {
{"air","air",""},
{"","group:stick",""},
{"","group:stick",""}
}
end
if def.max_uses == nil then
def.max_uses = 30
end
-- Register the tool
minetest.register_tool(name, {
description = def.description,
inventory_image = def.inventory_image,
on_use = function(itemstack, user, pointed_thing)
return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses)
end
})
-- Register its recipe
if def.material == nil then
minetest.register_craft({
output = name:sub(2),
recipe = def.recipe
})
else
minetest.register_craft({
output = name:sub(2),
recipe = {
{def.material, def.material, ""},
{"", "group:stick", ""},
{"", "group:stick", ""}
}
})
-- Reverse Recipe
minetest.register_craft({
output = name:sub(2),
recipe = {
{"", def.material, def.material},
{"", "group:stick", ""},
{"", "group:stick", ""}
}
})
end
end
-- Seed placement
farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") < 2 then
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
-- Register plants
farming.register_plant = function(name, def)
local mname = name:split(":")[1]
local pname = name:split(":")[2]
-- Check def table
if not def.description then
def.description = "Seed"
end
if not def.inventory_image then
def.inventory_image = "unknown_item.png"
end
if not def.steps then
return nil
end
if not def.minlight then
def.minlight = 1
end
if not def.maxlight then
def.maxlight = 14
end
if not def.fertility then
def.fertility = {}
end
-- Register seed
local g = {seed = 1, snappy = 3, attached_node = 1}
for k, v in pairs(def.fertility) do
g[v] = 1
end
minetest.register_node(":" .. mname .. ":seed_" .. pname, {
description = def.description,
tiles = {def.inventory_image},
inventory_image = def.inventory_image,
wield_image = def.inventory_image,
drawtype = "signlike",
groups = g,
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
fertility = def.fertility,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname)
end
})
-- Register harvest
minetest.register_craftitem(":" .. mname .. ":" .. pname, {
description = pname:gsub("^%l", string.upper),
inventory_image = mname .. "_" .. pname .. ".png",
})
-- Register growing steps
for i=1,def.steps do
local drop = {
items = {
{items = {mname .. ":" .. pname}, rarity = 9 - i},
{items = {mname .. ":" .. pname}, rarity= 18 - i * 2},
{items = {mname .. ":seed_" .. pname}, rarity = 9 - i},
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2},
}
}
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}
nodegroups[pname] = i
minetest.register_node(mname .. ":" .. pname .. "_" .. i, {
drawtype = "plantlike",
waving = 1,
tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
paramtype = "light",
walkable = false,
buildable_to = true,
drop = drop,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = nodegroups,
sounds = default.node_sound_leaves_defaults(),
})
end
-- Growing ABM
minetest.register_abm({
nodenames = {"group:" .. pname, "group:seed"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
action = function(pos, node)
local plant_height = minetest.get_item_group(node.name, pname)
-- return if already full grown
if plant_height == def.steps then
return
end
local node_def = minetest.registered_items[node.name] or nil
-- grow seed
if minetest.get_item_group(node.name, "seed") and node_def.fertility then
local can_grow = false
local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if not soil_node then
return
end
for _, v in pairs(node_def.fertility) do
if minetest.get_item_group(soil_node.name, v) ~= 0 then
can_grow = true
end
end
if can_grow then
minetest.set_node(pos, {name = node.name:gsub("seed_", "") .. "_1"})
end
return
end
-- check if on wet soil
pos.y = pos.y - 1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y + 1
-- check light
local ll = minetest.get_node_light(pos)
if not ll or ll < def.minlight or ll > def.maxlight then
return
end
-- grow
minetest.set_node(pos, {name = mname .. ":" .. pname .. "_" .. plant_height + 1})
end
})
-- Return
local r = {
seed = mname .. ":seed_" .. pname,
harvest = mname .. ":" .. pname
}
return r
end

View File

@ -0,0 +1,156 @@
minetest.override_item("default:dirt", {
groups = {crumbly=3,soil=1},
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.override_item("default:dirt_with_grass", {
groups = {crumbly=3,soil=1},
soil = {
base = "default:dirt_with_grass",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
drop = "default:dirt",
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.override_item("default:desert_sand", {
groups = {crumbly=3, falling_node=1, sand=1, soil = 1},
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:desert_sand_soil", {
description = "Desert Sand Soil",
drop = "default:desert_sand",
tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"},
groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1},
sounds = default.node_sound_sand_defaults(),
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:desert_sand_soil_wet", {
description = "Wet Desert Sand Soil",
drop = "default:desert_sand",
tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"},
groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1},
sounds = default.node_sound_sand_defaults(),
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:straw", {
description = "Straw",
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {snappy=3, flammable=4},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_abm({
nodenames = {"group:field"},
interval = 15,
chance = 4,
action = function(pos, node)
local n_def = minetest.registered_nodes[node.name] or nil
local wet = n_def.soil.wet or nil
local base = n_def.soil.base or nil
local dry = n_def.soil.dry or nil
if not n_def or not n_def.soil or not wet or not base or not dry then
return
end
pos.y = pos.y + 1
local nn = minetest.get_node_or_nil(pos)
if not nn or not nn.name then
return
end
local nn_def = minetest.registered_nodes[nn.name] or nil
pos.y = pos.y - 1
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
minetest.set_node(pos, {name = base})
return
end
-- check if there is water nearby
local wet_lvl = minetest.get_item_group(node.name, "wet")
if minetest.find_node_near(pos, 3, {"group:water"}) then
-- if it is dry soil and not base node, turn it into wet soil
if wet_lvl == 0 then
minetest.set_node(pos, {name = wet})
end
else
-- only turn back if there are no unloaded blocks (and therefore
-- possible water sources) nearby
if not minetest.find_node_near(pos, 3, {"ignore"}) then
-- turn it back into base if it is already dry
if wet_lvl == 0 then
-- only turn it back if there is no plant/seed on top of it
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
minetest.set_node(pos, {name = base})
end
-- if its wet turn it back into dry soil
elseif wet_lvl == 1 then
minetest.set_node(pos, {name = dry})
end
end
end
end,
})
for i = 1, 5 do
minetest.override_item("default:grass_"..i, {drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
{items = {'default:grass_1'}},
}
}})
end
minetest.override_item("default:junglegrass", {drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'},rarity = 8},
{items = {'default:junglegrass'}},
}
}})

View File

@ -9,6 +9,8 @@ local vessels_shelf_formspec =
"list[context;vessels;0,0.3;8,2;]"..
"list[current_player;main;0,2.85;8,1;]"..
"list[current_player;main;0,4.08;8,3;8]"..
"listring[context;vessels]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0,2.85)
minetest.register_node("vessels:shelf", {

View File

@ -1108,6 +1108,54 @@ minetest.register_craft( {
},
})
minetest.register_craft( {
output = "signs:sign_wall_orange 4",
recipe = {
{ "dye:orange", "dye:black", "dye:orange" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_orange 2",
recipe = {
{ "dye:orange", "dye:black", "dye:orange" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_blue 4",
recipe = {
{ "dye:blue", "dye:white", "dye:blue" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_blue 2",
recipe = {
{ "dye:blue", "dye:white", "dye:blue" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_brown 4",
recipe = {
{ "dye:brown", "dye:white", "dye:brown" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }
},
})
minetest.register_craft( {
output = "signs:sign_wall_brown 2",
recipe = {
{ "dye:brown", "dye:white", "dye:brown" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
},
})
if minetest.setting_get("log_mods") then
minetest.log("action", S("signs loaded"))
end

View File

@ -6,11 +6,16 @@
minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", {
drawtype = "mesh",
mesh = "jeija_hydro_turbine.obj",
tiles = {"jeija_hydro_turbine_off.png"},
tiles = {
"jeija_hydro_turbine_sides_off.png",
"jeija_hydro_turbine_top_bottom.png",
"jeija_hydro_turbine_turbine_top_bottom.png",
"jeija_hydro_turbine_turbine_misc.png"
},
inventory_image = "jeija_hydro_turbine_inv.png",
wield_scale = {x=0.75, y=0.75, z=0.75},
groups = {dig_immediate=2},
description="Water Turbine",
description="Water Turbine",
paramtype = "light",
selection_box = {
type = "fixed",
@ -26,7 +31,12 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", {
drawtype = "mesh",
mesh = "jeija_hydro_turbine.obj",
wield_scale = {x=0.75, y=0.75, z=0.75},
tiles = {"jeija_hydro_turbine_on.png"},
tiles = {
"jeija_hydro_turbine_sides_on.png",
"jeija_hydro_turbine_top_bottom.png",
"jeija_hydro_turbine_turbine_top_bottom.png",
"jeija_hydro_turbine_turbine_misc.png"
},
inventory_image = "jeija_hydro_turbine_inv.png",
drop = "mesecons_hydroturbine:hydro_turbine_off 1",
groups = {dig_immediate=2,not_in_creative_inventory=1},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

View File

@ -24,7 +24,12 @@ mesecon.register_node("mesecons_walllever:wall_lever", {
minetest.sound_play("mesecons_lever", {pos=pos})
end
},{
tiles = { "jeija_wall_lever_off.png" },
tiles = {
"jeija_wall_lever_lever_light_off.png",
"jeija_wall_lever_front.png",
"jeija_wall_lever_front_bump.png",
"jeija_wall_lever_back_edges.png"
},
mesh="jeija_wall_lever_off.obj",
mesecons = {receptor = {
rules = mesecon.rules.buttonlike_get,
@ -32,7 +37,12 @@ mesecon.register_node("mesecons_walllever:wall_lever", {
}},
groups = {dig_immediate = 2, mesecon_needs_receiver = 1}
},{
tiles = { "jeija_wall_lever_on.png" },
tiles = {
"jeija_wall_lever_lever_light_on.png",
"jeija_wall_lever_front.png",
"jeija_wall_lever_front_bump.png",
"jeija_wall_lever_back_edges.png"
},
mesh="jeija_wall_lever_on.obj",
mesecons = {receptor = {
rules = mesecon.rules.buttonlike_get,

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -11,7 +11,7 @@ local function read_file()
local t = f:read("*all")
f:close()
if t == "" or t == nil then return {} end
return minetest.deserialize(t)
return minetest.deserialize(t) or {}
end
local function write_file(tbl)
@ -251,6 +251,10 @@ end
-- end
function luaentity.add_entity(pos, name)
if not luaentity.entities then
minetest.after(0, luaentity.add_entity, vector.new(pos), name)
return
end
local index = luaentity.entities_index
while luaentity.entities[index] do
index = index + 1

View File

@ -190,7 +190,11 @@ minetest.register_abm({
interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle
chance = 100/GRASS_REGROWING_CHANCE,
action = function(pos)
minetest.set_node(pos, {name="default:dirt_with_grass"})
-- Only become dirt with grass if no cut grass or hay lies on top
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
if above.name ~= "dryplants:grass" and above.name ~= "dryplants:hay" then
minetest.set_node(pos, {name="default:dirt_with_grass"})
end
end,
})

View File

@ -110,11 +110,17 @@ minetest.register_node("ferns:tree_fern_leaves_giant", {
not_in_creative_inventory=1
},
drop = {
max_items = 1,
max_items = 2,
items = {
{
-- occasionally, drop a second sapling instead of leaves
-- (extra saplings can also be obtained by replanting and
-- reharvesting leaves)
items = {"ferns:sapling_giant_tree_fern"},
rarity = 10,
},
{
items = {"ferns:sapling_giant_tree_fern"},
rarity = 40,
},
{
items = {"ferns:tree_fern_leaves_giant"},

View File

@ -18,7 +18,11 @@ abstract_ferns.grow_tree_fern = function(pos)
return
end
local size = math.random(1, 5)
local size = math.random(1, 4) + math.random(1, 4)
if (size > 5) then
size = 10 - size
end
size = size + 1
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[math.random(1, 2)]
local i = 1

View File

@ -5,6 +5,10 @@ News de FR - MinetestForFun (Survival - PVP - Hardcore)
/!\ En effet, nous profitons de cette stabilitée pour préparer une grosse MAJ qui boulversera à jamais le gameplay de Minetest /!\
---Next merge--- (Remerciements : ???)
MaJ de "homedecor" (nouveaux panneaux colorés)
MaJ de "plantlife"
MaJ de "mesecons"
MaJ de "pipeworks"
Ajout du mod "broomstick" de palige (permet d'utiliser un balai volant contre 210 de mana)
---21/06/2015--- (Remerciements : mgl512/Le_Docteur, LeMagnesium/Mg, crabman77/crabman, Obani)