1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-09-17 10:10:24 +02:00

Merge pull request #89 from LeMagnesium/remove_whitespaces

Removing all whitespaces from our Lua files
This commit is contained in:
Ombridride 2015-06-11 15:51:57 +02:00
commit f2e4e54832
227 changed files with 1543 additions and 1525 deletions

View File

@ -17,7 +17,7 @@ function beds.register_bed(name, def)
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = def.selectionbox, fixed = def.selectionbox,
}, },
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local n = minetest.get_node_or_nil(pos) local n = minetest.get_node_or_nil(pos)
@ -35,7 +35,7 @@ function beds.register_bed(name, def)
end end
minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2}) minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2})
return false return false
end, end,
on_destruct = function(pos) on_destruct = function(pos)
local n = minetest.get_node_or_nil(pos) local n = minetest.get_node_or_nil(pos)
if not n then return end if not n then return end

View File

@ -64,7 +64,7 @@ beds.register_bed("beds:bed", {
}, },
top = { top = {
"beds_bed_top_top.png^[transformR90", "beds_bed_top_top.png^[transformR90",
"default_wood.png", "default_wood.png",
"beds_bed_side_top_r.png", "beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx", "beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top.png", "beds_bed_side_top.png",

View File

@ -56,7 +56,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
if skip then if skip then
return return
end end
if p then if p then
player:setpos(p) player:setpos(p)
end end
@ -100,7 +100,7 @@ local function update_formspecs(finished)
"label[2.7,11; Good morning.]" "label[2.7,11; Good morning.]"
else else
form_n = beds.formspec .. form_n = beds.formspec ..
"label[2.2,11;"..tostring(player_in_bed).." of "..tostring(ges).." players are in bed]" "label[2.2,11;"..tostring(player_in_bed).." of "..tostring(ges).." players are in bed]"
if is_majority then if is_majority then
form_n = form_n .. form_n = form_n ..
"button_exit[2,8;4,0.75;force;Force night skip]" "button_exit[2,8;4,0.75;force;Force night skip]"

View File

@ -184,7 +184,7 @@ boats.register_boat = function(parameters)
wield_image = "boats_"..parameters.name.."_wield.png", wield_image = "boats_"..parameters.name.."_wield.png",
wield_scale = {x=2, y=2, z=1}, wield_scale = {x=2, y=2, z=1},
liquids_pointable = true, liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return

View File

@ -56,7 +56,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return
end end
local node = minetest.get_node_or_nil(pointed_thing.under) local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef local ndef
if node then if node then

View File

@ -122,7 +122,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if start_i >= creative_inventory.creative_inventory_size then if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6 start_i = start_i - 4*6
end end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0 start_i = 0
end end
@ -150,11 +150,11 @@ if minetest.setting_getbool("creative_mode") then
damage_groups = {fleshy = 10}, damage_groups = {fleshy = 10},
} }
}) })
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return return
end) end)
function minetest.handle_node_drops(pos, drops, digger) function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then if not digger or not digger:is_player() then
return return
@ -169,5 +169,5 @@ if minetest.setting_getbool("creative_mode") then
end end
end end
end end
end end

View File

@ -13,7 +13,7 @@ minetest.register_craftitem("default:infotool", {
if minetest.registered_items[nn] == nil or minetest.registered_items[nn].tiles == nil or type(minetest.registered_items[nn].tiles[1]) ~= "string" then return end if minetest.registered_items[nn] == nil or minetest.registered_items[nn].tiles == nil or type(minetest.registered_items[nn].tiles[1]) ~= "string" then return end
local def = minetest.registered_nodes[nn] local def = minetest.registered_nodes[nn]
if not def then return end if not def then return end
local textures = def.tiles local textures = def.tiles
local description = def.description local description = def.description
if not textures then if not textures then

View File

@ -176,7 +176,7 @@ local function cool_wf_vm(pos, node1, node2)
nodes[i] = stone nodes[i] = stone
end end
end end
manip:set_data(nodes) manip:set_data(nodes)
manip:write_to_map() manip:write_to_map()
-- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").") -- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").")

View File

@ -4,7 +4,7 @@
-- --
local function active_formspec(fuel_percent, item_percent) local function active_formspec(fuel_percent, item_percent)
local formspec = local formspec =
"size[8,8.5]".. "size[8,8.5]"..
default.gui_slots.. default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..
@ -94,9 +94,9 @@ minetest.register_node("default:furnace", {
legacy_facedir_simple = true, legacy_facedir_simple = true,
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
can_dig = can_dig, can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
@ -126,9 +126,9 @@ minetest.register_node("default:furnace_active", {
legacy_facedir_simple = true, legacy_facedir_simple = true,
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
can_dig = can_dig, can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
@ -335,7 +335,7 @@ minetest.register_abm({
local fuel_time = meta:get_float("fuel_time") or 0 local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0 local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
-- --
-- Inizialize inventory -- Inizialize inventory
-- --
@ -352,24 +352,24 @@ minetest.register_abm({
local srclist = inv:get_list("src") local srclist = inv:get_list("src")
local fuellist = inv:get_list("fuel") local fuellist = inv:get_list("fuel")
local dstlist = inv:get_list("dst") local dstlist = inv:get_list("dst")
-- --
-- Cooking -- Cooking
-- --
-- Check if we have cookable content -- Check if we have cookable content
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true local cookable = true
if cooked.time == 0 then if cooked.time == 0 then
cookable = false cookable = false
end end
-- Check if we have enough fuel to burn -- Check if we have enough fuel to burn
if fuel_time < fuel_totaltime then if fuel_time < fuel_totaltime then
-- The furnace is currently active and has enough fuel -- The furnace is currently active and has enough fuel
fuel_time = fuel_time + 1 fuel_time = fuel_time + 1
-- If there is a cookable item then check if it is ready yet -- If there is a cookable item then check if it is ready yet
if cookable then if cookable then
src_time = src_time + 1 src_time = src_time + 1
@ -387,7 +387,7 @@ minetest.register_abm({
if cookable then if cookable then
-- We need to get new fuel -- We need to get new fuel
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if fuel.time == 0 then if fuel.time == 0 then
-- No valid fuel in fuel list -- No valid fuel in fuel list
fuel_totaltime = 0 fuel_totaltime = 0
@ -396,10 +396,10 @@ minetest.register_abm({
else else
-- Take fuel from fuel list -- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1]) inv:set_stack("fuel", 1, afterfuel.items[1])
fuel_totaltime = fuel.time fuel_totaltime = fuel.time
fuel_time = 0 fuel_time = 0
end end
else else
-- We don't need to get new fuel since there is no cookable item -- We don't need to get new fuel since there is no cookable item
@ -408,7 +408,7 @@ minetest.register_abm({
src_time = 0 src_time = 0
end end
end end
-- --
-- Update formspec, infotext and node -- Update formspec, infotext and node
-- --
@ -425,7 +425,7 @@ minetest.register_abm({
item_state = "Not cookable" item_state = "Not cookable"
end end
end end
local fuel_state = "Empty" local fuel_state = "Empty"
local active = "inactive " local active = "inactive "
if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then
@ -440,9 +440,9 @@ minetest.register_abm({
end end
swap_node(pos, "default:furnace") swap_node(pos, "default:furnace")
end end
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
-- --
-- Set meta values -- Set meta values
-- --
@ -475,13 +475,13 @@ minetest.register_abm({
local srclist = inv:get_list("src") local srclist = inv:get_list("src")
local cooked = nil local cooked = nil
if srclist then if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end end
local was_active = false local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
@ -501,12 +501,12 @@ minetest.register_abm({
meta:set_string("src_time", 0) meta:set_string("src_time", 0)
end end
end end
local item_percent = 0 local item_percent = 0
if cooked then if cooked then
item_percent = meta:get_float("src_time") * 100 / cooked.time item_percent = meta:get_float("src_time") * 100 / cooked.time
end end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") / local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100) meta:get_float("fuel_totaltime") * 100)
@ -520,7 +520,7 @@ minetest.register_abm({
local cooked = nil local cooked = nil
local fuellist = inv:get_list("fuel") local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src") local srclist = inv:get_list("src")
if srclist then if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end end
@ -546,7 +546,7 @@ minetest.register_abm({
meta:set_string("fuel_totaltime", fuel.time) meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0) meta:set_string("fuel_time", 0)
local stack = inv:get_stack("fuel", 1) local stack = inv:get_stack("fuel", 1)
stack:take_item() stack:take_item()
inv:set_stack("fuel", 1, stack) inv:set_stack("fuel", 1, stack)

View File

@ -387,7 +387,7 @@ function default.register_ores()
end end
-- Underground springs: -- Underground springs:
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "default:water_source", ore = "default:water_source",
@ -721,7 +721,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
break break
end end
end end
if ground_y then if ground_y then
local p = {x=x,y =ground_y+1,z=z} local p = {x=x,y =ground_y+1,z=z}
local nn = minetest.get_node(p).name local nn = minetest.get_node(p).name
@ -732,14 +732,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- If desert sand, add dry shrub -- If desert sand, add dry shrub
if nn == "default:desert_sand" then if nn == "default:desert_sand" then
minetest.set_node(p,{name = "default:dry_shrub"}) minetest.set_node(p,{name = "default:dry_shrub"})
-- If dirt with grass, add grass -- If dirt with grass, add grass
elseif nn == "default:dirt_with_grass" then elseif nn == "default:dirt_with_grass" then
minetest.set_node(p,{name = "default:grass_" .. pr:next(1, 5)}) minetest.set_node(p,{name = "default:grass_" .. pr:next(1, 5)})
end end
end end
end end
end end
end end
end end
@ -989,7 +989,7 @@ end
-- --
function default.register_blobs() function default.register_blobs()
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:sand", ore = "default:sand",
wherein = {"default:stone"}, wherein = {"default:stone"},

View File

@ -1613,7 +1613,7 @@ minetest.register_node("default:meze", {
drop = "", drop = "",
groups = {cracky = 1, level = 2, fall_damage_add_percent = -75}, groups = {cracky = 1, level = 2, fall_damage_add_percent = -75},
sounds = default.node_sound_wood_defaults(), -- Intended. sounds = default.node_sound_wood_defaults(), -- Intended.
on_dig = function(pos, node, digger) on_dig = function(pos, node, digger)
if digger and minetest.setting_getbool("enable_damage") and not minetest.setting_getbool("creative_mode") then if digger and minetest.setting_getbool("enable_damage") and not minetest.setting_getbool("creative_mode") then
minetest.after(3, die_later, digger) minetest.after(3, die_later, digger)
@ -2170,7 +2170,7 @@ if minetest.setting_getbool("xray") then
minetest.override_item("default:stone_with_mese", {tiles = {"default_mineral_mese.png"}}) minetest.override_item("default:stone_with_mese", {tiles = {"default_mineral_mese.png"}})
minetest.override_item("default:stone_with_diamond", {tiles = {"default_mineral_diamond.png"}}) minetest.override_item("default:stone_with_diamond", {tiles = {"default_mineral_diamond.png"}})
minetest.override_item("default:stone_with_coin", {tiles = {"maptools_gold_coin.png"}}) minetest.override_item("default:stone_with_coin", {tiles = {"maptools_gold_coin.png"}})
-- Nodes to hide: -- Nodes to hide:
minetest.override_item("default:stone", {drawtype = "airlike", pointable = false,}) minetest.override_item("default:stone", {drawtype = "airlike", pointable = false,})
minetest.override_item("default:dirt", {drawtype = "airlike", pointable = false,}) minetest.override_item("default:dirt", {drawtype = "airlike", pointable = false,})

View File

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

View File

@ -57,13 +57,13 @@ minetest.register_abm({
if not can_grow(pos) then if not can_grow(pos) then
return return
end end
minetest.log("action", "A pine sapling grows into a tree at ".. minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
default.grow_pine_tree(pos) default.grow_pine_tree(pos)
end end
}) })
-- Appletree, jungletree function -- Appletree, jungletree function
local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
@ -72,7 +72,7 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
local c_air = minetest.get_content_id("air") local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore") local c_ignore = minetest.get_content_id("ignore")
local c_apple = minetest.get_content_id("default:apple") local c_apple = minetest.get_content_id("default:apple")
-- Trunk -- Trunk
for y_dist = 0, height - 1 do for y_dist = 0, height - 1 do
local vi = a:index(x, y + y_dist, z) local vi = a:index(x, y + y_dist, z)
@ -139,7 +139,7 @@ function default.grow_tree(pos, is_apple_tree, bad)
local height = random(4, 5) local height = random(4, 5)
local c_tree = minetest.get_content_id("default:tree") local c_tree = minetest.get_content_id("default:tree")
local c_leaves = minetest.get_content_id("default:leaves") local c_leaves = minetest.get_content_id("default:leaves")
local vm = minetest.get_voxel_manip() local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map( local minp, maxp = vm:read_from_map(
{x = pos.x - 2, y = pos.y, z = pos.z - 2}, {x = pos.x - 2, y = pos.y, z = pos.z - 2},
@ -410,15 +410,15 @@ minetest.register_abm({
interval = 80, interval = 80,
chance = 3, chance = 3,
action = function(pos, node) action = function(pos, node)
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
local is_soil = minetest.get_item_group(nu, "soil") local is_soil = minetest.get_item_group(nu, "soil")
if is_soil == 0 then if is_soil == 0 then
return return
end end
minetest.remove_node({x=pos.x, y=pos.y, z=pos.z}) minetest.remove_node({x=pos.x, y=pos.y, z=pos.z})
default.grow_cherry_tree(pos, false, "default:cherry_tree", "default:cherry_blossom_leaves") default.grow_cherry_tree(pos, false, "default:cherry_tree", "default:cherry_blossom_leaves")
end, end,

View File

@ -25,7 +25,7 @@ function doors.register_door(name, def)
if not def.sound_open_door then if not def.sound_open_door then
def.sound_open_door = "doors_door_open" def.sound_open_door = "doors_door_open"
end end
minetest.register_craftitem(name, { minetest.register_craftitem(name, {
description = def.description, description = def.description,
inventory_image = def.inventory_image, inventory_image = def.inventory_image,
@ -99,7 +99,7 @@ function doors.register_door(name, def)
local tt = def.tiles_top local tt = def.tiles_top
local tb = def.tiles_bottom local tb = def.tiles_bottom
local function after_dig_node(pos, name, digger) local function after_dig_node(pos, name, digger)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == name then if node.name == name then
@ -114,16 +114,16 @@ function doors.register_door(name, def)
end end
local p2 = minetest.get_node(pos).param2 local p2 = minetest.get_node(pos).param2
p2 = params[p2+1] p2 = params[p2+1]
minetest.swap_node(pos, {name=replace_dir, param2=p2}) minetest.swap_node(pos, {name=replace_dir, param2=p2})
pos.y = pos.y-dir pos.y = pos.y-dir
minetest.swap_node(pos, {name=replace, param2=p2}) minetest.swap_node(pos, {name=replace, param2=p2})
local snd_1 = def.sound_close_door 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 if params[1] == 3 then
snd_1 = def.sound_open_door snd_1 = def.sound_open_door
snd_2 = def.sound_close_door snd_2 = def.sound_close_door
end end
@ -158,18 +158,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_bottom fixed = def.selection_box_bottom
}, },
groups = def.groups, groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1 pos.y = pos.y+1
after_dig_node(pos, name.."_t_1", digger) after_dig_node(pos, name.."_t_1", digger)
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end end
end, end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight sunlight_propagates = def.sunlight
@ -190,18 +190,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_top fixed = def.selection_box_top
}, },
groups = def.groups, groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y-1 pos.y = pos.y-1
after_dig_node(pos, name.."_b_1", digger) after_dig_node(pos, name.."_b_1", digger)
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0}) on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
end end
end, end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight, sunlight_propagates = def.sunlight,
@ -222,18 +222,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_bottom fixed = def.selection_box_bottom
}, },
groups = def.groups, groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1 pos.y = pos.y+1
after_dig_node(pos, name.."_t_2", digger) after_dig_node(pos, name.."_t_2", digger)
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end end
end, end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight sunlight_propagates = def.sunlight
@ -254,18 +254,18 @@ function doors.register_door(name, def)
fixed = def.selection_box_top fixed = def.selection_box_top
}, },
groups = def.groups, groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y-1 pos.y = pos.y-1
after_dig_node(pos, name.."_b_2", digger) after_dig_node(pos, name.."_b_2", digger)
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2}) on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
end end
end, end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight sunlight_propagates = def.sunlight

View File

@ -15,11 +15,11 @@ minetest.register_node("fire:basic_flame", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
damage_per_second = 4, damage_per_second = 4,
on_construct = function(pos, placer) on_construct = function(pos, placer)
fire.on_flame_add_at(pos) fire.on_flame_add_at(pos)
end, end,
on_destruct = function(pos, oldnode, oldmetadata, digger) on_destruct = function(pos, oldnode, oldmetadata, digger)
fire.on_flame_remove_at(pos) fire.on_flame_remove_at(pos)
end, end,

View File

@ -95,23 +95,23 @@ minetest.register_abm({
elseif under.name ~= "default:dirt_with_grass" then elseif under.name ~= "default:dirt_with_grass" then
return return
end end
local light = minetest.get_node_light(pos) local light = minetest.get_node_light(pos)
if not light or light < 13 then if not light or light < 13 then
return return
end end
local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4} local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4}
local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4} local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4}
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
return return
end end
local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora") local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora")
if #flowers > 3 then if #flowers > 3 then
return return
end end
local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass") local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
if #seedling > 0 then if #seedling > 0 then
seedling = seedling[math.random(#seedling)] seedling = seedling[math.random(#seedling)]

View File

@ -138,7 +138,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end end
return itemstack return itemstack
end end
-- Upside down slabs -- Upside down slabs
if p0.y-1 == p1.y then if p0.y-1 == p1.y then
-- Turn into full block if pointing at a existing slab -- Turn into full block if pointing at a existing slab
@ -267,7 +267,7 @@ stairs.register_stair_and_slab("sandstone", "default:sandstone",
"Sandstone Stair", "Sandstone Stair",
"Sandstone Slab", "Sandstone Slab",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick", stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"default_sandstone_brick.png"}, {"default_sandstone_brick.png"},

View File

@ -50,7 +50,7 @@ minetest.register_node("vessels:shelf", {
local stack = inv:get_stack(from_list, from_index) local stack = inv:get_stack(from_list, from_index)
local to_stack = inv:get_stack(to_list, to_index) local to_stack = inv:get_stack(to_list, to_index)
if to_list == "vessels" then 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 and to_stack:is_empty() then
return 1 return 1
else else

View File

@ -16,7 +16,7 @@ ARMOR_MATERIALS = {
mithril = "moreores:mithril_ingot", mithril = "moreores:mithril_ingot",
crystal = "ethereal:crystal_ingot", crystal = "ethereal:crystal_ingot",
-- Hunter armors (A déc-ommenter quand activation de l'armure au total) -- Hunter armors (A déc-ommenter quand activation de l'armure au total)
--hardened_leather = "3d_armor:hardened_leather" --hardened_leather = "3d_armor:hardened_leather"
--reinforced_leather = "3d_armor:reinforced_leather" --reinforced_leather = "3d_armor:reinforced_leather"
-- Wizard armors -- Wizard armors
--armor = "xxx", --armor = "xxx",
@ -255,7 +255,7 @@ armor.update_armor = function(self, player, dtime)
end end
end end
end end
end end
if hp <= 0 or hp == self.player_hp[name] then if hp <= 0 or hp == self.player_hp[name] then
return return
end end
@ -463,7 +463,7 @@ minetest.register_on_joinplayer(function(player)
for i=1, 6 do for i=1, 6 do
local stack = player_inv:get_stack("armor", i) local stack = player_inv:get_stack("armor", i)
armor_inv:set_stack("armor", i, stack) armor_inv:set_stack("armor", i, stack)
end end
-- Legacy support, import player's armor from old inventory format -- Legacy support, import player's armor from old inventory format
for _,v in pairs(armor.elements) do for _,v in pairs(armor.elements) do

View File

@ -124,4 +124,4 @@ minetest.after(0, function()
table.insert(armor.elements, "shield") table.insert(armor.elements, "shield")
end) end)

View File

@ -16,17 +16,17 @@ local IRC = [[
Voici les sanctions prevues pour les infractions aux regles ci-dessus. Voici les sanctions prevues pour les infractions aux regles ci-dessus.
- Infraction niveau DIRT : - Infraction niveau DIRT :
Manque de respect envers autrui : Devoice une journee Manque de respect envers autrui : Devoice une journee
Provocation envers autrui : Devoice une journee Provocation envers autrui : Devoice une journee
Insultes envers autrui : Kick + Devoice une journee Insultes envers autrui : Kick + Devoice une journee
- Infraction niveau STONE : - Infraction niveau STONE :
- Recidivide d'infraction niveau dirt : Kick + Ban 1/2 journee - Recidivide d'infraction niveau dirt : Kick + Ban 1/2 journee
- Flood, Discrimination : Kick + Devoice deux heures - Flood, Discrimination : Kick + Devoice deux heures
- Spam : Kick + Devoice 1 jour + Ban 1/2 journee - Spam : Kick + Devoice 1 jour + Ban 1/2 journee
- Infraction niveau MESE : - Infraction niveau MESE :
- Recidive d'infraction niveau stone : Kick + Ban 4 jours + devoice 5 jours - Recidive d'infraction niveau stone : Kick + Ban 4 jours + devoice 5 jours
- Diffusion de contenu a caractere sexuel : Kick + Ban 1 semaine + devoice 5 jours - Diffusion de contenu a caractere sexuel : Kick + Ban 1 semaine + devoice 5 jours
- Irrespect envers l'equipe du canal : Kick + Ban 10 jours + devoice 8 jours - Irrespect envers l'equipe du canal : Kick + Ban 10 jours + devoice 8 jours
@ -35,7 +35,7 @@ Voici les sanctions prevues pour les infractions aux regles ci-dessus.
- Recidive d'infraction niveau mese : Kick + Ban 1 mois + devoice 2 semaines - Recidive d'infraction niveau mese : Kick + Ban 1 mois + devoice 2 semaines
- Violation des lois en vigueur : Kick + Ban definitif + Gline si accord des IrcOP d'InchraNet - Violation des lois en vigueur : Kick + Ban definitif + Gline si accord des IrcOP d'InchraNet
- Violation des regles d'InchraNet : Kick + Ban definitif + Gline ou sanction defnie par l'equipe d'InchraNet - Violation des regles d'InchraNet : Kick + Ban definitif + Gline ou sanction defnie par l'equipe d'InchraNet
Autres regles de bienseances : Autres regles de bienseances :
- Ne demandez pas a faire partie des operateurs/semi-operateurs du canal. - Ne demandez pas a faire partie des operateurs/semi-operateurs du canal.

View File

@ -16,17 +16,17 @@ local IRC = [[
Voici les sanctions prévues pour les infractions aux règles ci-dessus. Voici les sanctions prévues pour les infractions aux règles ci-dessus.
- Infraction niveau DIRT : - Infraction niveau DIRT :
Manque de respect envers autrui : Devoice une journée Manque de respect envers autrui : Devoice une journée
Provocation envers autrui : Devoice une journée Provocation envers autrui : Devoice une journée
Insultes envers autrui : Kick + Devoice une journée Insultes envers autrui : Kick + Devoice une journée
- Infraction niveau STONE : - Infraction niveau STONE :
- Récidivide d'infraction niveau dirt : Kick + Ban 1/2 journée - Récidivide d'infraction niveau dirt : Kick + Ban 1/2 journée
- Flood, Discrimination : Kick + Devoice deux heures - Flood, Discrimination : Kick + Devoice deux heures
- Spam : Kick + Devoice 1 jour + Ban 1/2 journée - Spam : Kick + Devoice 1 jour + Ban 1/2 journée
- Infraction niveau MESE : - Infraction niveau MESE :
- Récidive d'infraction niveau stone : Kick + Ban 4 jours + devoice 5 jours - Récidive d'infraction niveau stone : Kick + Ban 4 jours + devoice 5 jours
- Diffusion de contenu à caractère sexuel : Kick + Ban 1 semaine + devoice 5 jours - Diffusion de contenu à caractère sexuel : Kick + Ban 1 semaine + devoice 5 jours
- Irrespect envers l'équipe du canal : Kick + Ban 10 jours + devoice 8 jours - Irrespect envers l'équipe du canal : Kick + Ban 10 jours + devoice 8 jours
@ -35,7 +35,7 @@ Voici les sanctions prévues pour les infractions aux règles ci-dessus.
- Récidive d'infraction niveau mese : Kick + Ban 1 mois + devoice 2 semaines - Récidive d'infraction niveau mese : Kick + Ban 1 mois + devoice 2 semaines
- Violation des lois en vigueur : Kick + Ban définitif + Gline si accord des IrcOP d'InchraNet - Violation des lois en vigueur : Kick + Ban définitif + Gline si accord des IrcOP d'InchraNet
- Violation des règles d'InchraNet : Kick + Ban définitif + Gline ou sanction défnie par l'équipe d'InchraNet - Violation des règles d'InchraNet : Kick + Ban définitif + Gline ou sanction défnie par l'équipe d'InchraNet
Autres règles de bienséances : Autres règles de bienséances :
- Ne demandez pas à faire partie des opérateurs/semi-opérateurs du canal. - Ne demandez pas à faire partie des opérateurs/semi-opérateurs du canal.

View File

@ -15,36 +15,36 @@ local max_frequency_all = 1000 --the larger you make this number the lest freque
--for frequencies below use a number between 0 and max_frequency_all --for frequencies below use a number between 0 and max_frequency_all
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds --for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
local night_frequency = 20 --owls, wolves local night_frequency = 20 --owls, wolves
local night_volume = 0.9 local night_volume = 0.9
local night_frequent_frequency = 150 --crickets local night_frequent_frequency = 150 --crickets
local night_frequent_volume = 0.9 local night_frequent_volume = 0.9
local day_frequency = 80 --crow, bluejay, cardinal local day_frequency = 80 --crow, bluejay, cardinal
local day_volume = 0.6 local day_volume = 0.6
local day_frequent_frequency = 250 --crow, bluejay, cardinal local day_frequent_frequency = 250 --crow, bluejay, cardinal
local day_frequent_volume = 0.18 local day_frequent_volume = 0.18
local cave_frequency = 10 --bats local cave_frequency = 10 --bats
local cave_volume = 1.0 local cave_volume = 1.0
local cave_frequent_frequency = 70 --drops of water dripping local cave_frequent_frequency = 70 --drops of water dripping
local cave_frequent_volume = 1.0 local cave_frequent_volume = 1.0
local beach_frequency = 20 --seagulls local beach_frequency = 20 --seagulls
local beach_volume = 1.0 local beach_volume = 1.0
local beach_frequent_frequency = 1000 --waves local beach_frequent_frequency = 1000 --waves
local beach_frequent_volume = 1.0 local beach_frequent_volume = 1.0
local water_frequent_frequency = 1000 --water sounds local water_frequent_frequency = 1000 --water sounds
local water_frequent_volume = 1.0 local water_frequent_volume = 1.0
local desert_frequency = 20 --coyote local desert_frequency = 20 --coyote
local desert_volume = 1.0 local desert_volume = 1.0
local desert_frequent_frequency = 700 --desertwind local desert_frequent_frequency = 700 --desertwind
local desert_frequent_volume = 1.0 local desert_frequent_volume = 1.0
local swimming_frequent_frequency = 1000 --swimming splashes local swimming_frequent_frequency = 1000 --swimming splashes
local swimming_frequent_volume = 1.0 local swimming_frequent_volume = 1.0
local water_surface_volume = 1.0 -- sloshing water local water_surface_volume = 1.0 -- sloshing water
local lava_volume = 1.0 --lava local lava_volume = 1.0 --lava
local flowing_water_volume = .4 --waterfall local flowing_water_volume = .4 --waterfall
local splashing_water_volume = 1 local splashing_water_volume = 1
local music_frequency = 7 --music (suggestion: keep this one low like around 6) local music_frequency = 7 --music (suggestion: keep this one low like around 6)
local music_volume = 0.3 local music_volume = 0.3
--End of Config --End of Config
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -269,7 +269,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = totalnodes + #nodes totalnodes = totalnodes + #nodes
maxp = {x=pos.x+20,y=height, z=pos.z+search_distance} maxp = {x=pos.x+20,y=height, z=pos.z+search_distance}
minp = {x=pos.x+20,y=height, z=pos.z-search_distance} minp = {x=pos.x+20,y=height, z=pos.z-search_distance}
nodes = minetest.find_nodes_in_area(minp, maxp, node_name) nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")") -- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then if #nodes >= threshold then
return true return true
@ -277,8 +277,8 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
totalnodes = totalnodes + #nodes totalnodes = totalnodes + #nodes
maxp = {x=pos.x-20,y=height, z=pos.z+search_distance} maxp = {x=pos.x-20,y=height, z=pos.z+search_distance}
minp = {x=pos.x-20,y=height, z=pos.z-search_distance} minp = {x=pos.x-20,y=height, z=pos.z-search_distance}
nodes = minetest.find_nodes_in_area(minp, maxp, node_name) nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")") -- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
if #nodes >= threshold then if #nodes >= threshold then
return true return true
end end
@ -286,7 +286,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
-- minetest.chat_send_all("Found total(" .. totalnodes .. ")") -- minetest.chat_send_all("Found total(" .. totalnodes .. ")")
if totalnodes >= threshold*2 then if totalnodes >= threshold*2 then
return true return true
end end
return false return false
end end
@ -298,11 +298,11 @@ local get_immediate_nodes = function(pos)
pos.y = pos.y+3 pos.y = pos.y+3
pos.y = pos.y+2.2 pos.y = pos.y+2.2
node_at_upper_body = minetest.get_node(pos).name node_at_upper_body = minetest.get_node(pos).name
pos.y = pos.y-1.19 pos.y = pos.y-1.19
node_at_lower_body = minetest.get_node(pos).name node_at_lower_body = minetest.get_node(pos).name
pos.y = pos.y+0.99 pos.y = pos.y+0.99
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")") --minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
end end
local get_ambience = function(player) local get_ambience = function(player)
@ -315,19 +315,19 @@ local get_ambience = function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
if player_name == nil or players_pos[player_name] == nil then return end if player_name == nil or players_pos[player_name] == nil then return end
if players_pos[player_name]["last_x_pos"] ~=pos.x or players_pos[player_name]["last_z_pos"] ~=pos.z then if players_pos[player_name]["last_x_pos"] ~=pos.x or players_pos[player_name]["last_z_pos"] ~=pos.z then
player_is_moving_horiz = true player_is_moving_horiz = true
end end
if pos.y > players_pos[player_name]["last_y_pos"]+.5 then if pos.y > players_pos[player_name]["last_y_pos"]+.5 then
player_is_climbing = true player_is_climbing = true
end end
if pos.y < players_pos[player_name]["last_y_pos"]-.5 then if pos.y < players_pos[player_name]["last_y_pos"]-.5 then
player_is_descending = true player_is_descending = true
end end
players_pos[player_name]["last_x_pos"] = pos.x players_pos[player_name]["last_x_pos"] = pos.x
players_pos[player_name]["last_z_pos"] = pos.z players_pos[player_name]["last_z_pos"] = pos.z
players_pos[player_name]["last_y_pos"] = pos.y players_pos[player_name]["last_y_pos"] = pos.y
if string.find(node_at_upper_body, "default:water") then if string.find(node_at_upper_body, "default:water") then
if music then if music then
return {water=water, water_frequent=water_frequent, music=music} return {water=water, water_frequent=water_frequent, music=music}
@ -342,20 +342,20 @@ local get_ambience = function(player)
--swimming w, m swimming --swimming w, m swimming
--walking in water nw, m splashing --walking in water nw, m splashing
--treading water w, nm sloshing --treading water w, nm sloshing
--standing in water nw, nm beach trumps, then sloshing --standing in water nw, nm beach trumps, then sloshing
if player_is_moving_horiz then if player_is_moving_horiz then
if string.find(node_under_feet, "default:water") then if string.find(node_under_feet, "default:water") then
if music then if music then
return {swimming_frequent=swimming_frequent, music=music} return {swimming_frequent=swimming_frequent, music=music}
else else
return {swimming_frequent} return {swimming_frequent}
end end
else --didn't find water under feet: walking in water else --didn't find water under feet: walking in water
if music then if music then
return {splashing_water=splashing_water, music=music} return {splashing_water=splashing_water, music=music}
else else
return {splashing_water} return {splashing_water}
end end
end end
else--player is not moving: treading water else--player is not moving: treading water
if string.find(node_under_feet, "default:water") then if string.find(node_under_feet, "default:water") then
@ -363,25 +363,25 @@ local get_ambience = function(player)
return {water_surface=water_surface, music=music} return {water_surface=water_surface, music=music}
else else
return {water_surface} return {water_surface}
end end
else --didn't find water under feet else --didn't find water under feet
standing_in_water = true standing_in_water = true
end end
end end
end end
end end
-- minetest.chat_send_all("----------") -- minetest.chat_send_all("----------")
-- if not player_is_moving_horiz then -- if not player_is_moving_horiz then
-- minetest.chat_send_all("not moving horiz") -- minetest.chat_send_all("not moving horiz")
-- else -- else
-- minetest.chat_send_all("moving horiz") -- minetest.chat_send_all("moving horiz")
-- end -- end
-- minetest.chat_send_all("nub:" ..node_at_upper_body) -- minetest.chat_send_all("nub:" ..node_at_upper_body)
-- minetest.chat_send_all("nlb:" ..node_at_lower_body) -- minetest.chat_send_all("nlb:" ..node_at_lower_body)
-- minetest.chat_send_all("nuf:" ..node_under_feet) -- minetest.chat_send_all("nuf:" ..node_under_feet)
-- minetest.chat_send_all("----------") -- minetest.chat_send_all("----------")
-- if player_is_moving_horiz then -- if player_is_moving_horiz then
-- minetest.chat_send_all("playermoving") -- minetest.chat_send_all("playermoving")
-- end -- end
@ -392,7 +392,7 @@ local get_ambience = function(player)
-- minetest.chat_send_all("nlb:" ..node_at_lower_body) -- minetest.chat_send_all("nlb:" ..node_at_lower_body)
-- minetest.chat_send_all("nuf:" ..node_under_feet) -- minetest.chat_send_all("nuf:" ..node_under_feet)
-- minetest.chat_send_all("n3uf:" ..node_3_under_feet) -- minetest.chat_send_all("n3uf:" ..node_3_under_feet)
-- --
local air_or_ignore = {air=true,ignore=true} local air_or_ignore = {air=true,ignore=true}
local minp = {x=pos.x-3,y=pos.y-4, z=pos.z-3} local minp = {x=pos.x-3,y=pos.y-4, z=pos.z-3}
local maxp = {x=pos.x+3,y=pos.y-1, z=pos.z+3} local maxp = {x=pos.x+3,y=pos.y-1, z=pos.z+3}
@ -405,19 +405,19 @@ local get_ambience = function(player)
-- minetest.chat_send_all("counter: (" .. counter .. "-----------------)") -- minetest.chat_send_all("counter: (" .. counter .. "-----------------)")
--minetest.chat_send_all(air_or_ignore[node_under_feet]) --minetest.chat_send_all(air_or_ignore[node_under_feet])
-- if (player_is_moving_horiz or player_is_climbing) and air_or_ignore[node_at_upper_body] and air_or_ignore[node_at_lower_body] -- if (player_is_moving_horiz or player_is_climbing) and air_or_ignore[node_at_upper_body] and air_or_ignore[node_at_lower_body]
-- and air_or_ignore[node_under_feet] and air_plus_ignore_under == 196 and not player_is_descending then -- and air_or_ignore[node_under_feet] and air_plus_ignore_under == 196 and not player_is_descending then
--minetest.chat_send_all("flying!!!!") --minetest.chat_send_all("flying!!!!")
-- if music then -- if music then
-- return {flying=flying, music=music} -- return {flying=flying, music=music}
-- else -- else
--- return {flying} --- return {flying}
-- end -- end
-- end -- end
--minetest.chat_send_all("not flying!!!!") --minetest.chat_send_all("not flying!!!!")
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
if music then if music then
return {lava=lava, lava2=lava2, music=music} return {lava=lava, lava2=lava2, music=music}
else else
return {lava=lava} return {lava=lava}
end end
@ -428,7 +428,7 @@ local get_ambience = function(player)
else else
return {flowing_water=flowing_water, flowing_water2=flowing_water2} return {flowing_water=flowing_water, flowing_water2=flowing_water2}
end end
end end
--if we are near sea level and there is lots of water around the area --if we are near sea level and there is lots of water around the area
@ -437,17 +437,17 @@ local get_ambience = function(player)
return {beach=beach, beach_frequent=beach_frequent, music=music} return {beach=beach, beach_frequent=beach_frequent, music=music}
else else
return {beach=beach, beach_frequent=beach_frequent} return {beach=beach, beach_frequent=beach_frequent}
end end
end end
if standing_in_water then if standing_in_water then
if music then if music then
return {water_surface=water_surface, music=music} return {water_surface=water_surface, music=music}
else else
return {water_surface} return {water_surface}
end end
end end
local desert_in_range = (nodes_in_range(pos, 6, "default:desert_sand")+nodes_in_range(pos, 6, "default:desert_stone")) local desert_in_range = (nodes_in_range(pos, 6, "default:desert_sand")+nodes_in_range(pos, 6, "default:desert_stone"))
--minetest.chat_send_all("desertcount: " .. desert_in_range .. ",".. pos.y ) --minetest.chat_send_all("desertcount: " .. desert_in_range .. ",".. pos.y )
if desert_in_range >250 then if desert_in_range >250 then
@ -456,12 +456,12 @@ local get_ambience = function(player)
else else
return {desert=desert, desert_frequent=desert_frequent} return {desert=desert, desert_frequent=desert_frequent}
end end
end end
-- pos.y = pos.y-2 -- pos.y = pos.y-2
-- nodename = minetest.get_node(pos).name -- nodename = minetest.get_node(pos).name
-- minetest.chat_send_all("Found " .. nodename .. pos.y ) -- minetest.chat_send_all("Found " .. nodename .. pos.y )
if player:getpos().y < 0 then if player:getpos().y < 0 then
if music then if music then
@ -491,7 +491,7 @@ local play_sound = function(player, list, number, is_music)
if list.handler[player_name] == nil then if list.handler[player_name] == nil then
local gain = 1.0 local gain = 1.0
if list[number].gain ~= nil then if list[number].gain ~= nil then
if is_music then if is_music then
gain = list[number].gain*soundset.get_gain(player_name, "music") gain = list[number].gain*soundset.get_gain(player_name, "music")
--minetest.chat_send_all("gain music: " .. gain ) --minetest.chat_send_all("gain music: " .. gain )
else else
@ -666,7 +666,7 @@ local stop_sound = function(still_playing, player)
minetest.sound_stop(list.handler[player_name]) minetest.sound_stop(list.handler[player_name])
list.handler[player_name] = nil list.handler[player_name] = nil
end end
end end
if still_playing.lava2 == nil then if still_playing.lava2 == nil then
local list = lava2 local list = lava2
if list.handler[player_name] ~= nil then if list.handler[player_name] ~= nil then
@ -676,7 +676,7 @@ local stop_sound = function(still_playing, player)
minetest.sound_stop(list.handler[player_name]) minetest.sound_stop(list.handler[player_name])
list.handler[player_name] = nil list.handler[player_name] = nil
end end
end end
if still_playing.water == nil then if still_playing.water == nil then
local list = water local list = water
if list.handler[player_name] ~= nil then if list.handler[player_name] ~= nil then
@ -690,7 +690,7 @@ local stop_sound = function(still_playing, player)
if still_playing.water_surface == nil then if still_playing.water_surface == nil then
local list = water_surface local list = water_surface
if list.handler[player_name] ~= nil then if list.handler[player_name] ~= nil then
if list.on_stop ~= nil then if list.on_stop ~= nil then
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player_name, "ambience")}) minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player_name, "ambience")})
played_on_start = false played_on_start = false
end end
@ -701,9 +701,9 @@ local stop_sound = function(still_playing, player)
if still_playing.water_frequent == nil then if still_playing.water_frequent == nil then
local list = water_frequent local list = water_frequent
if list.handler[player_name] ~= nil then if list.handler[player_name] ~= nil then
if list.on_stop ~= nil then if list.on_stop ~= nil then
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player_name, "ambience")}) minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player_name, "ambience")})
-- minetest.chat_send_all("list.on_stop " .. list.on_stop ) -- minetest.chat_send_all("list.on_stop " .. list.on_stop )
played_on_start = false played_on_start = false
end end
minetest.sound_stop(list.handler[player_name]) minetest.sound_stop(list.handler[player_name])
@ -723,7 +723,7 @@ local stop_sound = function(still_playing, player)
minetest.sound_stop(list.handler[player_name]) minetest.sound_stop(list.handler[player_name])
list.handler[player_name] = nil list.handler[player_name] = nil
end end
end end
if still_playing.splashing_water == nil then if still_playing.splashing_water == nil then
local list = splashing_water local list = splashing_water
if list.handler[player_name] ~= nil then if list.handler[player_name] ~= nil then
@ -733,8 +733,8 @@ local stop_sound = function(still_playing, player)
minetest.sound_stop(list.handler[player_name]) minetest.sound_stop(list.handler[player_name])
list.handler[player_name] = nil list.handler[player_name] = nil
end end
end end
end end
local timer = 0 local timer = 0
@ -749,7 +749,7 @@ minetest.register_globalstep(function(dtime)
ambiences = get_ambience(player) ambiences = get_ambience(player)
stop_sound(ambiences, player) stop_sound(ambiences, player)
for _,ambience in pairs(ambiences) do for _,ambience in pairs(ambiences) do
if math.random(1, 1000) <= ambience.frequency then if math.random(1, 1000) <= ambience.frequency then
-- if(played_on_start) then -- if(played_on_start) then
-- -- minetest.chat_send_all("playedOnStart " ) -- -- minetest.chat_send_all("playedOnStart " )
-- else -- else
@ -762,7 +762,7 @@ minetest.register_globalstep(function(dtime)
-- minetest.chat_send_all("ambience: " ..ambience ) -- minetest.chat_send_all("ambience: " ..ambience )
-- if ambience.on_start ~= nil and played_on_start_flying == false then -- if ambience.on_start ~= nil and played_on_start_flying == false then
-- played_on_start_flying = true -- played_on_start_flying = true
-- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) -- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
-- end -- end
local is_music =false local is_music =false
if ambience.is_music ~= nil then if ambience.is_music ~= nil then
@ -816,8 +816,8 @@ minetest.register_chatcommand("mvol", {
MUSICVOLUME = tonumber(param) MUSICVOLUME = tonumber(param)
-- local player = minetest.get_player_by_name(name) -- local player = minetest.get_player_by_name(name)
-- stop_sound({}, player) -- stop_sound({}, player)
-- ambiences = get_ambience(player) -- ambiences = get_ambience(player)
minetest.chat_send_player(name, "Music volume set to " .. param .. ".") minetest.chat_send_player(name, "Music volume set to " .. param .. ".")
end, }) end, })
]] ]]

View File

@ -2,7 +2,7 @@
--plants to place in openfarming --plants to place in openfarming
local plants = { ["farming:blueberries"]=1, ["farming:carrot"]=1, ["farming:coffee_beans"]=1, ["farming:corn"]=1, ["farming:cucumber"]=1, local plants = { ["farming:blueberries"]=1, ["farming:carrot"]=1, ["farming:coffee_beans"]=1, ["farming:corn"]=1, ["farming:cucumber"]=1,
["farming:melon_slice"]=1, ["farming:potato"]=1, ["farming:pumpkin_slice"]=1, ["farming:raspberries"]=1, ["farming:rhubarb"]=1, ["farming:melon_slice"]=1, ["farming:potato"]=1, ["farming:pumpkin_slice"]=1, ["farming:raspberries"]=1, ["farming:rhubarb"]=1,
["farming:tomato"]=1, ["farming:seed_cotton"]=1, ["farming:seed_wheat"]=1,["default:papyrus"]=1 ["farming:tomato"]=1, ["farming:seed_cotton"]=1, ["farming:seed_wheat"]=1,["default:papyrus"]=1
} }
--tools to dig in openfarming --tools to dig in openfarming
@ -49,17 +49,17 @@ function areas:canInteract(pos, name)
if not player then return false end if not player then return false end
local wstack = player:get_wielded_item():get_name() local wstack = player:get_wielded_item():get_name()
if wstack == "" then wstack = "hand" end if wstack == "" then wstack = "hand" end
--on_place --on_place
if node == "air" and plants[wstack] ~= nil then if node == "air" and plants[wstack] ~= nil then
return true return true
end end
--on_dig --on_dig
if minetest.get_item_group(node, "plant") == 1 and in_hand[wstack] ~= nil then if minetest.get_item_group(node, "plant") == 1 and in_hand[wstack] ~= nil then
return true return true
end end
owned = true owned = true
else else
owned = true owned = true

View File

@ -60,7 +60,7 @@ minetest.register_chatcommand("set_owner", {
local id = areas:add(ownerName, areaName, pos1, pos2, nil) local id = areas:add(ownerName, areaName, pos1, pos2, nil)
areas:save() areas:save()
minetest.chat_send_player(ownerName, minetest.chat_send_player(ownerName,
"You have been granted control over area #".. "You have been granted control over area #"..
id..". Type /list_areas to show your areas.") id..". Type /list_areas to show your areas.")

View File

@ -1,27 +1,27 @@
--more_signs by addi --more_signs by addi
--Code and Textures are under the CC by-sa 3.0 licence --Code and Textures are under the CC by-sa 3.0 licence
--see: http://creativecommons.org/licenses/by-sa/3.0/ --see: http://creativecommons.org/licenses/by-sa/3.0/
arrow_signs={} arrow_signs={}
arrow_signs.formspec = "field[text;Sign text:;${text}]"; arrow_signs.formspec = "field[text;Sign text:;${text}]";
arrow_signs_on_place = function(itemstack, placer, pointed_thing) arrow_signs_on_place = function(itemstack, placer, pointed_thing)
local posabove = pointed_thing.above local posabove = pointed_thing.above
local posunder = pointed_thing.under local posunder = pointed_thing.under
local vector = placer:get_look_dir() local vector = placer:get_look_dir()
local place = true local place = true
if posabove.y>posunder.y then if posabove.y>posunder.y then
if(vector.z>0.5 and vector.z<=1) then if(vector.z>0.5 and vector.z<=1) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 10}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 10})
elseif (vector.x>0.5 and vector.x<=1) then elseif (vector.x>0.5 and vector.x<=1) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 19}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 19})
elseif(-0.5>vector.z and -1<=vector.z) then elseif(-0.5>vector.z and -1<=vector.z) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 4}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 4})
elseif (-0.5>vector.x and -1<=vector.x) then elseif (-0.5>vector.x and -1<=vector.x) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 13}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 13})
else else
@ -33,7 +33,7 @@ arrow_signs_on_place = function(itemstack, placer, pointed_thing)
elseif (vector.x>0.5 and vector.x<=1) then elseif (vector.x>0.5 and vector.x<=1) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 17}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 17})
elseif(-0.5>vector.z and -1<=vector.z) then elseif(-0.5>vector.z and -1<=vector.z) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 6}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 6})
elseif (-0.5>vector.x and -1<=vector.x) then elseif (-0.5>vector.x and -1<=vector.x) then
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 15}) minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 15})
else else
@ -96,15 +96,15 @@ arrow_signs_on_place = function(itemstack, placer, pointed_thing)
else else
itemstack:take_item() itemstack:take_item()
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
return itemstack return itemstack
end end
end end
function arrow_signs:savetext(pos, formname, fields, sender) function arrow_signs:savetext(pos, formname, fields, sender)
if not minetest.get_player_privs(sender:get_player_name())["interact"] then if not minetest.get_player_privs(sender:get_player_name())["interact"] then
minetest.chat_send_player(sender:get_player_name(), "error: you don't have permission to edit the sign. you need the interact priv") minetest.chat_send_player(sender:get_player_name(), "error: you don't have permission to edit the sign. you need the interact priv")
return return
@ -140,8 +140,8 @@ minetest.override_item("default:sign_wall", {
minetest.register_node("arrow_signs:wall", { minetest.register_node("arrow_signs:wall", {
description = "Arrow signs", description = "Arrow signs",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ 0.25, -0.25, 0.5, -0.25, 0.5, 0.47}, { 0.25, -0.25, 0.5, -0.25, 0.5, 0.47},
{ 0.1875, -0.3125, 0.5, -0.1875, -0.25, 0.47}, { 0.1875, -0.3125, 0.5, -0.1875, -0.25, 0.47},
@ -150,7 +150,7 @@ minetest.register_node("arrow_signs:wall", {
} }
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ 0.25, -0.25, 0.5, -0.25, 0.5, 0.47}, { 0.25, -0.25, 0.5, -0.25, 0.5, 0.47},
{ 0.1875, -0.3125, 0.5, -0.1875, -0.25, 0.47}, { 0.1875, -0.3125, 0.5, -0.1875, -0.25, 0.47},
@ -166,7 +166,7 @@ minetest.register_node("arrow_signs:wall", {
walkable = false, walkable = false,
groups = {choppy=2,dig_immediate=2,sign=1}, groups = {choppy=2,dig_immediate=2,sign=1},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_place = arrow_signs_on_place, on_place = arrow_signs_on_place,
on_construct = function(pos) on_construct = function(pos)
--local n = minetest.get_node(pos) --local n = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -150,7 +150,7 @@ function awards.register_achievement(name,data_table)
if data_table.custom_announce == nil or data_table.custom_announce == "" then if data_table.custom_announce == nil or data_table.custom_announce == "" then
data_table.custom_announce = "Achievement Unlocked:" data_table.custom_announce = "Achievement Unlocked:"
end end
-- add the achievement to the definition table -- add the achievement to the definition table
data_table.name = name data_table.name = name
awards.def[name] = data_table awards.def[name] = data_table
@ -191,7 +191,7 @@ end
function awards.give_achievement(name, award) function awards.give_achievement(name, award)
-- Access Player Data -- Access Player Data
local data = awards.players[name] local data = awards.players[name]
-- Perform checks -- Perform checks
if not data then if not data then
return return
@ -277,7 +277,7 @@ function awards.give_achievement(name, award)
position = {x = 0.5, y = 0}, position = {x = 0.5, y = 0},
offset = {x = 0, y = 40}, offset = {x = 0, y = 40},
alignment = {x = 0, y = -1} alignment = {x = 0, y = -1}
}) })
local three = player:hud_add({ local three = player:hud_add({
hud_elem_type = "text", hud_elem_type = "text",
name = "award_title", name = "award_title",
@ -287,7 +287,7 @@ function awards.give_achievement(name, award)
position = {x = 0.5, y = 0}, position = {x = 0.5, y = 0},
offset = {x = 30, y = 100}, offset = {x = 30, y = 100},
alignment = {x = 0, y = -1} alignment = {x = 0, y = -1}
}) })
local four = player:hud_add({ local four = player:hud_add({
hud_elem_type = "image", hud_elem_type = "image",
name = "award_icon", name = "award_icon",
@ -304,10 +304,10 @@ function awards.give_achievement(name, award)
player:hud_remove(four) player:hud_remove(four)
end) end)
end end
-- record this in the log -- record this in the log
minetest.log("action", name.." has unlocked award "..title) minetest.log("action", name.." has unlocked award "..title)
-- save playertable -- save playertable
awards.save() awards.save()
minetest.sound_play("award_award_won", {to_player = name, gain = 0.5*soundset.get_gain(name,"other")}) minetest.sound_play("award_award_won", {to_player = name, gain = 0.5*soundset.get_gain(name,"other")})
@ -392,7 +392,7 @@ function awards.showto(name, to, sid, text)
local def = awards.def[str] local def = awards.def[str]
if def then if def then
if def.title then if def.title then
if def.description then if def.description then
minetest.chat_send_player(to, def.title..": "..def.description) minetest.chat_send_player(to, def.title..": "..def.description)
else else
minetest.chat_send_player(to, def.title) minetest.chat_send_player(to, def.title)
@ -406,9 +406,9 @@ function awards.showto(name, to, sid, text)
if sid == nil or sid < 1 then if sid == nil or sid < 1 then
sid = 1 sid = 1
end end
local formspec = "size[11,5]" local formspec = "size[11,5]"
local listofawards = awards._order_awards(name) local listofawards = awards._order_awards(name)
-- Sidebar -- Sidebar
if sid then if sid then
local item = listofawards[sid+0] local item = listofawards[sid+0]
@ -417,7 +417,7 @@ function awards.showto(name, to, sid, text)
formspec = formspec .. "label[1,2.75;Secret Award]".. formspec = formspec .. "label[1,2.75;Secret Award]"..
"image[1,0;3,3;unknown.png]" "image[1,0;3,3;unknown.png]"
if def and def.description then if def and def.description then
formspec = formspec .. "label[0,3.25;Unlock this award to find out what it is]" formspec = formspec .. "label[0,3.25;Unlock this award to find out what it is]"
end end
else else
local title = item.name local title = item.name
@ -435,13 +435,13 @@ function awards.showto(name, to, sid, text)
formspec = formspec .. "label[1,2.75;"..title..status.."]".. formspec = formspec .. "label[1,2.75;"..title..status.."]"..
"image[1,0;3,3;"..icon.."]" "image[1,0;3,3;"..icon.."]"
if def and def.description then if def and def.description then
formspec = formspec .. "label[0,3.25;"..def.description.."]" formspec = formspec .. "label[0,3.25;"..def.description.."]"
end end
end end
end end
-- Create list box -- Create list box
formspec = formspec .. "textlist[4.75,0;6,5;awards;" formspec = formspec .. "textlist[4.75,0;6,5;awards;"
local first = true local first = true
for _,award in pairs(listofawards) do for _,award in pairs(listofawards) do
local def = awards.def[award.name] local def = awards.def[award.name]
@ -450,14 +450,14 @@ function awards.showto(name, to, sid, text)
formspec = formspec .. "," formspec = formspec .. ","
end end
first = false first = false
if def.secret and not award.got then if def.secret and not award.got then
formspec = formspec .. "#ACACACSecret Award" formspec = formspec .. "#ACACACSecret Award"
else else
local title = award.name local title = award.name
if def and def.title then if def and def.title then
title = def.title title = def.title
end end
if award.got then if award.got then
formspec = formspec .. minetest.formspec_escape(title) formspec = formspec .. minetest.formspec_escape(title)
else else
@ -465,7 +465,7 @@ function awards.showto(name, to, sid, text)
end end
end end
end end
end end
formspec = formspec .. ";"..sid.."]" formspec = formspec .. ";"..sid.."]"
-- Show formspec to user -- Show formspec to user
@ -483,11 +483,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name() local name = player:get_player_name()
if fields.awards then if fields.awards then
local event = minetest.explode_textlist_event(fields.awards) local event = minetest.explode_textlist_event(fields.awards)
if event.type == "CHG" then if event.type == "CHG" then
awards.showto(name,name,event.index,false) awards.showto(name,name,event.index,false)
end end
end end
return true return true
end) end)

View File

@ -351,7 +351,7 @@ awards.register_onDeath(function(player,data)
local pos = player:getpos() local pos = player:getpos()
if pos and minetest.find_node_near(pos, 2, "fire:basic_flame") ~= nil then if pos and minetest.find_node_near(pos, 2, "fire:basic_flame") ~= nil then
return "award_burn" return "award_burn"
end end
return nil return nil
end) end)
@ -365,7 +365,7 @@ awards.register_onDeath(function(player,data)
local pos = player:getpos() local pos = player:getpos()
if pos and minetest.find_node_near(pos, 2, "default:lava_flowing") ~= nil then if pos and minetest.find_node_near(pos, 2, "default:lava_flowing") ~= nil then
return "award_in_the_flow" return "award_in_the_flow"
end end
return nil return nil
end) end)
@ -379,7 +379,7 @@ awards.register_onDeath(function(player,data)
local pos = player:getpos() local pos = player:getpos()
if pos and minetest.find_node_near(pos, 5, "default:stone_with_diamond") ~= nil then if pos and minetest.find_node_near(pos, 5, "default:stone_with_diamond") ~= nil then
return "award_this_is_sad" return "award_this_is_sad"
end end
return nil return nil
end) end)
@ -392,7 +392,7 @@ awards.register_onDeath(function(player,data)
local pos = player:getpos() local pos = player:getpos()
if pos and minetest.find_node_near(pos, 5, "bones:bones") ~= nil then if pos and minetest.find_node_near(pos, 5, "bones:bones") ~= nil then
return "award_the_stack" return "award_the_stack"
end end
return nil return nil
end) end)

View File

@ -128,14 +128,14 @@ minetest.register_on_dieplayer(function(player)
if not player or not name or name=="" then if not player or not name or name=="" then
return return
end end
-- Get player -- Get player
awards.assertPlayer(name) awards.assertPlayer(name)
local data = awards.players[name] local data = awards.players[name]
-- Increment counter -- Increment counter
data.deaths = data.deaths + 1 data.deaths = data.deaths + 1
-- Run callbacks and triggers -- Run callbacks and triggers
for _,trigger in pairs(awards.onDeath) do for _,trigger in pairs(awards.onDeath) do
local res = nil local res = nil
@ -160,14 +160,14 @@ minetest.register_on_joinplayer(function(player)
if not player or not name or name=="" then if not player or not name or name=="" then
return return
end end
-- Get player -- Get player
awards.assertPlayer(name) awards.assertPlayer(name)
local data = awards.players[name] local data = awards.players[name]
-- Increment counter -- Increment counter
data.joins = data.joins + 1 data.joins = data.joins + 1
-- Run callbacks and triggers -- Run callbacks and triggers
for _,trigger in pairs(awards.onJoin) do for _,trigger in pairs(awards.onJoin) do
local res = nil local res = nil
@ -197,11 +197,11 @@ minetest.register_on_chat_message(function(name, message)
awards.assertPlayer(name) awards.assertPlayer(name)
local data = awards.players[name] local data = awards.players[name]
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
-- Increment counter -- Increment counter
data.chats = data.chats + 1 data.chats = data.chats + 1
-- Run callbacks and triggers -- Run callbacks and triggers
for _,trigger in pairs(awards.onChat) do for _,trigger in pairs(awards.onChat) do
local res = nil local res = nil
if type(trigger) == "function" then if type(trigger) == "function" then

View File

@ -1,10 +1,10 @@
--[[ --[[
Beginners_chest mod Beginners_chest mod
Put some useful stuff in chests for the new players Put some useful stuff in chests for the new players
Version : 1.1 - 11/8/2014_14h48UTC Version : 1.1 - 11/8/2014_14h48UTC
Last modification by Mg on the : 14/3/2015 @ 14h48 UTC Last modification by Mg on the : 14/3/2015 @ 14h48 UTC
Mod ßý Mg, based on an idea of MinetestForFun/Darcidride Mod ßý Mg, based on an idea of MinetestForFun/Darcidride
]]-- ]]--
@ -118,7 +118,7 @@ local chests = {
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
local i = 1 local i = 1
while i < table.getn(chests)+1 do while i < table.getn(chests)+1 do
if not chests[i].stuff then if not chests[i].stuff then
chests[i].stuff = { chests[i].stuff = {
[1] = "default:wood", [1] = "default:wood",
@ -128,12 +128,12 @@ minetest.register_globalstep(function(dtime)
if not chests[i].interval_timer then if not chests[i].interval_timer then
chests[i].interval_timer = 0 chests[i].interval_timer = 0
end end
if not chests[i].interval_max then if not chests[i].interval_max then
chests[i].interval_max = 7200 -- Using default value : 2h chests[i].interval_max = 7200 -- Using default value : 2h
end end
chests[i].interval_timer = chests[i].interval_timer + dtime chests[i].interval_timer = chests[i].interval_timer + dtime
if chests[i].position.x and chests[i].position.y and chests[i].position.z and chests[i].interval_timer >= chests[i].interval_max then if chests[i].position.x and chests[i].position.y and chests[i].position.z and chests[i].interval_timer >= chests[i].interval_max then
chests[i].interval_timer = 0 chests[i].interval_timer = 0
local node = minetest.get_node(chests[i].position) local node = minetest.get_node(chests[i].position)
@ -160,7 +160,7 @@ minetest.register_globalstep(function(dtime)
inv:set_list("main", chests[i].stuff) inv:set_list("main", chests[i].stuff)
minetest.log("action","[b_chest]["..i.."] Chest reloaded at "..chests[i].position.x..", "..chests[i].position.y..", "..chests[i].position.z) minetest.log("action","[b_chest]["..i.."] Chest reloaded at "..chests[i].position.x..", "..chests[i].position.y..", "..chests[i].position.z)
else else
minetest.log("action","[b_chest]["..i.."] Cannot reload chest at "..chests[i].position.x..", "..chests[i].position.y..", "..chests[i].position.z.." : area not loaded.") minetest.log("action","[b_chest]["..i.."] Cannot reload chest at "..chests[i].position.x..", "..chests[i].position.y..", "..chests[i].position.z.." : area not loaded.")
end end

View File

@ -187,8 +187,8 @@ minetest.register_abm(
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
obj:set_hp(obj:get_hp()-100) obj:set_hp(obj:get_hp()-100)
minetest.sound_play("bobblocks_trap_fall", minetest.sound_play("bobblocks_trap_fall",
{pos = pos, gain = 1.0, max_hear_distance = 3,}) {pos = pos, gain = 1.0, max_hear_distance = 3,})
end end
end, end,
}) })

View File

@ -76,7 +76,7 @@ end
function generate_tree(pos, trunk, leaves) function generate_tree(pos, trunk, leaves)
pos.y = pos.y-1 pos.y = pos.y-1
local nodename = minetest.get_node(pos).name local nodename = minetest.get_node(pos).name
pos.y = pos.y+1 pos.y = pos.y+1
if not minetest.get_node_light(pos) then if not minetest.get_node_light(pos) then
return return
@ -210,7 +210,7 @@ elseif string.find(n.name, "farming:pumpkin_") ~= nil then
else else
minetest.set_node(pos, {name="farming:pumpkin"}) minetest.set_node(pos, {name="farming:pumpkin"})
end end
elseif n.name == "default:dirt_with_grass" then elseif n.name == "default:dirt_with_grass" then
for i = -2, 3, 1 do for i = -2, 3, 1 do
for j = -3, 2, 1 do for j = -3, 2, 1 do
@ -225,8 +225,8 @@ elseif n.name == "default:dirt_with_grass" then
else else
minetest.set_node(pos, {name=plant_tab[math.random(0, 5)]}) minetest.set_node(pos, {name=plant_tab[math.random(0, 5)]})
end end
end end
end end
end end

View File

@ -145,7 +145,7 @@ function add_protected_bukket_liquid(nameofbukket,liquidsourcename)
end end
-- Check if pointing to a buildable node -- Check if pointing to a buildable node
local n = minetest.get_node(pointed_thing.under) local n = minetest.get_node(pointed_thing.under)
if is_protected_area(pointed_thing.under, 4 ,user:get_player_name()) then if is_protected_area(pointed_thing.under, 4 ,user:get_player_name()) then
minetest.chat_send_player(user:get_player_name(),"You can't place here - Too short of a protected area. (less than or equal to 4 blocks)") minetest.chat_send_player(user:get_player_name(),"You can't place here - Too short of a protected area. (less than or equal to 4 blocks)")
if minetest.is_protected(pointed_thing.under,user:get_player_name()) then if minetest.is_protected(pointed_thing.under,user:get_player_name()) then
@ -153,7 +153,7 @@ function add_protected_bukket_liquid(nameofbukket,liquidsourcename)
end end
return itemstack return itemstack
end end
if minetest.registered_nodes[n.name].buildable_to then if minetest.registered_nodes[n.name].buildable_to then
-- buildable; replace the node -- buildable; replace the node
minetest.log("action", user:get_player_name().. " use "..nameofbukket.." at ".. minetest.pos_to_string(pointed_thing.under)) minetest.log("action", user:get_player_name().. " use "..nameofbukket.." at ".. minetest.pos_to_string(pointed_thing.under))

View File

@ -35,7 +35,7 @@ minetest.register_entity(":__builtin:falling_node", {
} }
self.object:set_properties(prop) self.object:set_properties(prop)
end, end,
set_owner = function(self, owner) set_owner = function(self, owner)
if owner ~= nil then if owner ~= nil then
self.owner = "falling" self.owner = "falling"
@ -181,7 +181,7 @@ if PROTECT_LAVA_REALTIME == 1 then
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_string("owner") ~= nil and minetest.is_protected(pos, meta:get_string("owner")) then if meta:get_string("owner") ~= nil and minetest.is_protected(pos, meta:get_string("owner")) then
minetest.add_node(pos,{name="air"}) minetest.add_node(pos,{name="air"})
end end
@ -196,7 +196,7 @@ if PROTECT_WATER_REALTIME == 1 then
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_string("owner") ~= nil and minetest.is_protected(pos, meta:get_string("owner")) then if meta:get_string("owner") ~= nil and minetest.is_protected(pos, meta:get_string("owner")) then
minetest.add_node(pos,{name="air"}) minetest.add_node(pos,{name="air"})
end end
@ -224,7 +224,7 @@ end
-- local meta = minetest.get_meta(area:position(p_pos)) -- local meta = minetest.get_meta(area:position(p_pos))
-- if minetest.get_name_from_content_id(data[p_pos])== "default:lava_source" and meta:get_string("owner") ~= nil and minetest.is_protected(area:position(p_pos), meta:get_string("owner")) then -- if minetest.get_name_from_content_id(data[p_pos])== "default:lava_source" and meta:get_string("owner") ~= nil and minetest.is_protected(area:position(p_pos), meta:get_string("owner")) then
-- data[p_pos] = c_air -- data[p_pos] = c_air
-- end -- end
-- vm:set_data(data) -- vm:set_data(data)
-- vm:write_to_map() -- vm:write_to_map()
-- vm:update_map() -- vm:update_map()

View File

@ -18,7 +18,7 @@ minetest.register_entity(":__builtin:item", {
is_visible = false, is_visible = false,
timer = 0, timer = 0,
}, },
itemstring = "", itemstring = "",
physical_state = true, physical_state = true,
@ -83,7 +83,7 @@ minetest.register_entity(":__builtin:item", {
self.object:setacceleration({x=0, y=-10, z=0}) self.object:setacceleration({x=0, y=-10, z=0})
self:set_item(self.itemstring) self:set_item(self.itemstring)
end, end,
on_step = function(self, dtime) on_step = function(self, dtime)
if not self.timer then if not self.timer then
self.timer = 0 self.timer = 0
@ -92,16 +92,16 @@ minetest.register_entity(":__builtin:item", {
if time ~= 0 and (self.timer > time) then if time ~= 0 and (self.timer > time) then
self.object:remove() self.object:remove()
end end
local p = self.object:getpos() local p = self.object:getpos()
local name = minetest.get_node(p).name local name = minetest.get_node(p).name
if (minetest.registered_nodes[name] and minetest.registered_nodes[name].damage_per_second > 0) or name == "maptools:igniter" then if (minetest.registered_nodes[name] and minetest.registered_nodes[name].damage_per_second > 0) or name == "maptools:igniter" then
minetest.sound_play("builtin_item_lava", {pos = self.object:getpos(), gain = 0.5}) minetest.sound_play("builtin_item_lava", {pos = self.object:getpos(), gain = 0.5})
self.object:remove() self.object:remove()
return return
end end
--[[ if name == "default:water_source" then --[[ if name == "default:water_source" then
self.object:setacceleration({x = 0, y = 4, z = 0}) self.object:setacceleration({x = 0, y = 4, z = 0})
else else
@ -119,13 +119,13 @@ minetest.register_entity(":__builtin:item", {
else else
pos.z = pos.z+d pos.z = pos.z+d
end end
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
local par2 = minetest.get_node(pos).param2 local par2 = minetest.get_node(pos).param2
if name == "default:water_flowing" and par2 < param2 then if name == "default:water_flowing" and par2 < param2 then
return pos return pos
end end
if i<3 then if i<3 then
pos.x = pos.x-d pos.x = pos.x-d
else else
@ -133,7 +133,7 @@ minetest.register_entity(":__builtin:item", {
end end
end end
end end
local vec = get_flowing_dir(self) local vec = get_flowing_dir(self)
if vec then if vec then
local v = self.object:getvelocity() local v = self.object:getvelocity()
@ -159,7 +159,7 @@ minetest.register_entity(":__builtin:item", {
return return
end end
end end
p.y = p.y - 0.3 p.y = p.y - 0.3
local nn = minetest.get_node(p).name local nn = minetest.get_node(p).name
-- If node is not registered or node is walkably solid. -- If node is not registered or node is walkably solid.

View File

@ -106,7 +106,7 @@ chesttools.on_receive_fields = function(pos, formname, fields, player)
selected = 'main'; selected = 'main';
end end
local inv_list = 'main'; local inv_list = 'main';
if( selected == 'main' ) then if( selected == 'main' ) then
inv_list = 'main'; inv_list = 'main';
elseif( selected == 'craft' ) then elseif( selected == 'craft' ) then
inv_list = 'craft'; inv_list = 'craft';
@ -254,8 +254,8 @@ chesttools.update_chest = function(pos, formname, fields, player)
elseif( fields.shared ) then elseif( fields.shared ) then
price = 1; price = 1;
end end
elseif( node.name=='chesttools:shared_chest') then elseif( node.name=='chesttools:shared_chest') then
if( fields.shared) then if( fields.shared) then
return; return;
end end
@ -321,7 +321,7 @@ chesttools.update_chest = function(pos, formname, fields, player)
minetest.swap_node( pos, { name = target, param2 = node.param2 }); minetest.swap_node( pos, { name = target, param2 = node.param2 });
minetest.chat_send_player( pname, 'Chest changed to '..tostring( minetest.registered_nodes[ target].description ).. minetest.chat_send_player( pname, 'Chest changed to '..tostring( minetest.registered_nodes[ target].description )..
' for '..tostring( price )..' steel ingots.'); ' for '..tostring( price )..' steel ingots.');
end end
@ -334,7 +334,7 @@ chesttools.form_input_handler = function( player, formname, fields)
elseif( formname == "chesttools:update") then elseif( formname == "chesttools:update") then
chesttools.update_chest( pos, formname, fields, player); chesttools.update_chest( pos, formname, fields, player);
end end
return; return;
end end
end end
@ -435,9 +435,9 @@ minetest.register_node( 'chesttools:shared_chest', {
return nil; return nil;
end end
if( node.name=='default:chest' if( node.name=='default:chest'
or node.name=='default:chest_locked' or node.name=='default:chest_locked'
or node.name=='chesttools:shared_chest') then or node.name=='chesttools:shared_chest') then
local formspec = "size[8,4]".. local formspec = "size[8,4]"..
"label[2,0.4;Change chest type:]".. "label[2,0.4;Change chest type:]"..
@ -464,7 +464,7 @@ minetest.register_node( 'chesttools:shared_chest', {
formspec = formspec..'item_image[5,1;1.5,1.5;chesttools:shared_chest]'.. formspec = formspec..'item_image[5,1;1.5,1.5;chesttools:shared_chest]'..
'label[5,2.5;shared]'; 'label[5,2.5;shared]';
end end
minetest.show_formspec( name, "chesttools:update", formspec ); minetest.show_formspec( name, "chesttools:update", formspec );
end end
return nil; return nil;
end, end,

View File

@ -136,7 +136,7 @@ minetest.register_craft({
}) })
-------------------------- --------------------------
-- presents - -- presents -
-------------------------- --------------------------
-- paper colour craft -- -- paper colour craft --

View File

@ -11,7 +11,7 @@ minetest.register_node("christmas_craft:snowman", {
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {crumbly=3}, groups = {crumbly=3},
sounds = default.node_sound_sand_defaults(), sounds = default.node_sound_sand_defaults(),
}) })
@ -30,7 +30,7 @@ minetest.register_node("christmas_craft:christmas_lights", {
selection_box = { selection_box = {
type = "wallmounted", type = "wallmounted",
}, },
groups = {oddly_breakable_by_hand = 3}, groups = {oddly_breakable_by_hand = 3},
}) })
minetest.register_node("christmas_craft:christmas_wreath", { minetest.register_node("christmas_craft:christmas_wreath", {
@ -46,7 +46,7 @@ minetest.register_node("christmas_craft:christmas_wreath", {
selection_box = { selection_box = {
type = "wallmounted", type = "wallmounted",
}, },
groups = {oddly_breakable_by_hand = 3}, groups = {oddly_breakable_by_hand = 3},
}) })
minetest.register_node("christmas_craft:christmas_star", { minetest.register_node("christmas_craft:christmas_star", {
@ -92,9 +92,9 @@ minetest.register_node("christmas_craft:red_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -119,9 +119,9 @@ minetest.register_node("christmas_craft:yellow_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -146,9 +146,9 @@ minetest.register_node("christmas_craft:green_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -174,9 +174,9 @@ minetest.register_node("christmas_craft:blue_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -201,9 +201,9 @@ minetest.register_node("christmas_craft:orange_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -228,9 +228,9 @@ minetest.register_node("christmas_craft:violet_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -255,9 +255,9 @@ minetest.register_node("christmas_craft:pink_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -282,9 +282,9 @@ minetest.register_node("christmas_craft:silver_baubles", {
fixed = { fixed = {
{-0.25, 0.438, -0.25, 0.25, -0.05, 0.25}, {-0.25, 0.438, -0.25, 0.25, -0.05, 0.25},
{-0.08, 0.5, -0.08, 0.08, -0.0, 0.08}, {-0.08, 0.5, -0.08, 0.08, -0.0, 0.08},
-- side , top , side , side , bottom, side, -- side , top , side , side , bottom, side,
}, },
}, },
selection_box = { selection_box = {
@ -298,9 +298,9 @@ minetest.register_node("christmas_craft:silver_baubles", {
------------ ------------
--nodes-- --nodes--
-- presents -- -- presents --
minetest.register_node("christmas_craft:present_box", { minetest.register_node("christmas_craft:present_box", {
description = "Present Box", description = "Present Box",
tiles = {"christmas_craft_present_box.png"}, tiles = {"christmas_craft_present_box.png"},
@ -309,7 +309,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
groups = {crumbly=3}, groups = {crumbly=3},
sounds = default.node_sound_sand_defaults(), sounds = default.node_sound_sand_defaults(),
}) })
minetest.register_node("christmas_craft:Christmas_present", { minetest.register_node("christmas_craft:Christmas_present", {
description = "Christmas Present", description = "Christmas Present",
tiles = {"christmas_craft_present_wh.png^christmas_craft_bow_top.png", "christmas_craft_present_wh.png^christmas_craft_bow_bottom.png", "christmas_craft_present_wh.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_wh.png^christmas_craft_bow_top.png", "christmas_craft_present_wh.png^christmas_craft_bow_bottom.png", "christmas_craft_present_wh.png^christmas_craft_bow_side.png"},
@ -334,13 +334,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 90,}, {items = {'fake_fire:flint_and_steel'}, rarity = 90,},
{items = {'default:chest_locked'}, rarity = 80,}, {items = {'default:chest_locked'}, rarity = 80,},
{items = {'default:brick'}, rarity = 80,}, {items = {'default:brick'}, rarity = 80,},
{items = {'default:dirt_with_grass'}, rarity = 80,}, {items = {'default:dirt_with_grass'}, rarity = 80,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_green", { minetest.register_node("christmas_craft:Christmas_present_green", {
description = "Christmas Present Green ", description = "Christmas Present Green ",
tiles = {"christmas_craft_present_gr.png^christmas_craft_bow_top.png", "christmas_craft_present_gr.png^christmas_craft_bow_bottom.png", "christmas_craft_present_gr.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_gr.png^christmas_craft_bow_top.png", "christmas_craft_present_gr.png^christmas_craft_bow_bottom.png", "christmas_craft_present_gr.png^christmas_craft_bow_side.png"},
@ -365,13 +365,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_red", { minetest.register_node("christmas_craft:Christmas_present_red", {
description = "Christmas Present Red ", description = "Christmas Present Red ",
tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"},
@ -396,7 +396,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
@ -427,13 +427,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_yellow", { minetest.register_node("christmas_craft:Christmas_present_yellow", {
description = "Christmas Present Yellow ", description = "Christmas Present Yellow ",
tiles = {"christmas_craft_present_ye.png^christmas_craft_bow_top.png", "christmas_craft_present_ye.png^christmas_craft_bow_bottom.png", "christmas_craft_present_ye.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_ye.png^christmas_craft_bow_top.png", "christmas_craft_present_ye.png^christmas_craft_bow_bottom.png", "christmas_craft_present_ye.png^christmas_craft_bow_side.png"},
@ -458,13 +458,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_red", { minetest.register_node("christmas_craft:Christmas_present_red", {
description = "Christmas Present Red ", description = "Christmas Present Red ",
tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"},
@ -489,13 +489,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_violet", { minetest.register_node("christmas_craft:Christmas_present_violet", {
description = "Christmas Present Violet ", description = "Christmas Present Violet ",
tiles = {"christmas_craft_present_vi.png^christmas_craft_bow_top.png", "christmas_craft_present_vi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_vi.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_vi.png^christmas_craft_bow_top.png", "christmas_craft_present_vi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_vi.png^christmas_craft_bow_side.png"},
@ -520,13 +520,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_orange", { minetest.register_node("christmas_craft:Christmas_present_orange", {
description = "Christmas Present Orange ", description = "Christmas Present Orange ",
tiles = {"christmas_craft_present_or.png^christmas_craft_bow_top.png", "christmas_craft_present_or.png^christmas_craft_bow_bottom.png", "christmas_craft_present_or.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_or.png^christmas_craft_bow_top.png", "christmas_craft_present_or.png^christmas_craft_bow_bottom.png", "christmas_craft_present_or.png^christmas_craft_bow_side.png"},
@ -551,13 +551,13 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
minetest.register_node("christmas_craft:Christmas_present_pink", { minetest.register_node("christmas_craft:Christmas_present_pink", {
description = "Christmas Present Pink ", description = "Christmas Present Pink ",
tiles = {"christmas_craft_present_pi.png^christmas_craft_bow_top.png", "christmas_craft_present_pi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_pi.png^christmas_craft_bow_side.png"}, tiles = {"christmas_craft_present_pi.png^christmas_craft_bow_top.png", "christmas_craft_present_pi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_pi.png^christmas_craft_bow_side.png"},
@ -582,8 +582,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
{items = {'fake_fire:flint_and_steel'}, rarity = 15,}, {items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,}, {items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,}, {items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,}, {items = {'default:dirt_with_grass'}, rarity = 30,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
@ -643,32 +643,32 @@ minetest.register_node("christmas_craft:silver_baubles", {
stack_max = 99, stack_max = 99,
liquids_pointable = false, liquids_pointable = false,
}) })
-- string -- -- string --
minetest.register_craftitem("christmas_craft:red_ribbon", { minetest.register_craftitem("christmas_craft:red_ribbon", {
description = "Red Ribbon", description = "Red Ribbon",
inventory_image = "christmas_craft_red_ribbon.png", inventory_image = "christmas_craft_red_ribbon.png",
stack_max = 99, stack_max = 99,
liquids_pointable = false, liquids_pointable = false,
}) })
-- wish list -- -- wish list --
minetest.register_craftitem("christmas_craft:wish_list", { minetest.register_craftitem("christmas_craft:wish_list", {
description = "Wish list", description = "Wish list",
inventory_image = "christmas_craft_which_list.png", inventory_image = "christmas_craft_which_list.png",
stack_max = 99, stack_max = 99,
liquids_pointable = false, liquids_pointable = false,
}) })
------------ ------------
-- minetest.register_craftitem("christmas_craft:snow_ball", { -- minetest.register_craftitem("christmas_craft:snow_ball", {
-- description = "Snow ball", -- description = "Snow ball",
-- inventory_image = "snow_ball.png", -- inventory_image = "snow_ball.png",
-- stack_max = 16, -- stack_max = 16,
-- liquids_pointable = false, -- liquids_pointable = false,
--}) --})
@ -705,7 +705,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
}) })
--]] --]]
-- complex node -- -- complex node --
snowball_DAMAGE=0.5 snowball_DAMAGE=0.5
snowball_GRAVITY=9 snowball_GRAVITY=9
@ -734,7 +734,7 @@ snow_snowball_ENTITY={
textures = {"snowball.png"}, textures = {"snowball.png"},
lastpos={}, lastpos={},
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25}, collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
} }
@ -743,7 +743,7 @@ snow_snowball_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:getpos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
--Become item when hitting a node. --Become item when hitting a node.
if self.lastpos.x~=nil then --If there is no lastpos for some reason. if self.lastpos.x~=nil then --If there is no lastpos for some reason.
if node.name ~= "air" then if node.name ~= "air" then
@ -754,10 +754,10 @@ snow_snowball_ENTITY.on_step = function(self, dtime)
{pos = pos, gain = 1.0, max_hear_distance = 32,}) {pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove() self.object:remove()
end end
end end
self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node
end end
minetest.register_entity("christmas_craft:snowball_entity", snow_snowball_ENTITY) minetest.register_entity("christmas_craft:snowball_entity", snow_snowball_ENTITY)

View File

@ -1,6 +1,6 @@
print (" ---- mods override is Loading! ---- ") print (" ---- mods override is Loading! ---- ")
-- leaves -- -- leaves --
--minetest.register_node(":4seasons:leaves_winter", { --minetest.register_node(":4seasons:leaves_winter", {
@ -29,7 +29,7 @@ minetest.register_node(":4seasons:grass_winter", {
drop = { drop = {
max_items = 2, items = { max_items = 2, items = {
{items = {'default:dirt'}, rarity = 0,}, {items = {'default:dirt'}, rarity = 0,},
{items = {'christmas_craft:snowball'}, rarity = 0,}, {items = {'christmas_craft:snowball'}, rarity = 0,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
@ -45,7 +45,7 @@ minetest.register_node(":4seasons:sand_winter", {
drop = {'default:sand', drop = {'default:sand',
max_items = 2, items = { max_items = 2, items = {
{items = {'default:sand'}, rarity = 0,}, {items = {'default:sand'}, rarity = 0,},
{items = {'christmas_craft:snowball'}, rarity = 0,}, {items = {'christmas_craft:snowball'}, rarity = 0,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
@ -61,7 +61,7 @@ minetest.register_node(":4seasons:desertsand_winter", {
drop = {'default:desert_sand', drop = {'default:desert_sand',
max_items = 2, items = { max_items = 2, items = {
{items = {'default:desert_sand'}, rarity = 0,}, {items = {'default:desert_sand'}, rarity = 0,},
{items = {'christmas_craft:snowball'}, rarity = 0,}, {items = {'christmas_craft:snowball'}, rarity = 0,},
}}, }},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
@ -78,7 +78,7 @@ minetest.register_node(":4seasons:cactus_winter", {
drop = {'default:cactus', drop = {'default:cactus',
max_items = 2, items = { max_items = 2, items = {
{items = {'default:cactus'}, rarity = 0,}, {items = {'default:cactus'}, rarity = 0,},
{items = {'christmas_craft:snowball'}, rarity = 0,}, {items = {'christmas_craft:snowball'}, rarity = 0,},
}}, }},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })

View File

@ -52,10 +52,10 @@ minetest.register_node(":default:leaves", {
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}, },
}, },
}) })
-- remplace jungleleaves -- remplace jungleleaves
minetest.register_node(":default:jungleleaves", { minetest.register_node(":default:jungleleaves", {
description = "Jungle Leaves", description = "Jungle Leaves",
@ -90,7 +90,7 @@ minetest.register_node(":default:jungleleaves", {
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}, },
}, },
}) })

View File

@ -37,7 +37,7 @@ for shade = 1, 3 do
drawtype = "fencelike", drawtype = "fencelike",
description = nodedesc, description = nodedesc,
tiles = { pngname }, tiles = { pngname },
inventory_image = pngnameinv, inventory_image = pngnameinv,
wield_image = pngnameinv, wield_image = pngnameinv,
sunlight_propagates = colored_block_sunlight, sunlight_propagates = colored_block_sunlight,
paramtype = "light", paramtype = "light",
@ -54,7 +54,7 @@ for shade = 1, 3 do
drawtype = "fencelike", drawtype = "fencelike",
description = s50nodedesc, description = s50nodedesc,
tiles = { s50pngname }, tiles = { s50pngname },
inventory_image = s50pngnameinv, inventory_image = s50pngnameinv,
wield_image = s50pngnameinv, wield_image = s50pngnameinv,
sunlight_propagates = colored_block_sunlight, sunlight_propagates = colored_block_sunlight,
paramtype = "light", paramtype = "light",
@ -151,7 +151,7 @@ for hue = 1, 12 do
drawtype = "fencelike", drawtype = "fencelike",
description = nodedesc, description = nodedesc,
tiles = { pngname }, tiles = { pngname },
inventory_image = pngnameinv, inventory_image = pngnameinv,
wield_image = pngnameinv, wield_image = pngnameinv,
sunlight_propagates = colored_block_sunlight, sunlight_propagates = colored_block_sunlight,
paramtype = "light", paramtype = "light",
@ -252,7 +252,7 @@ for grey = 1,5 do
drawtype = "fencelike", drawtype = "fencelike",
description = nodedesc, description = nodedesc,
tiles = { pngname }, tiles = { pngname },
inventory_image = pngnameinv, inventory_image = pngnameinv,
wield_image = pngnameinv, wield_image = pngnameinv,
sunlight_propagates = colored_block_sunlight, sunlight_propagates = colored_block_sunlight,
paramtype = "light", paramtype = "light",

View File

@ -98,7 +98,7 @@ for hue = 1, 12 do
} }
}) })
end end
-- ============================================================ -- ============================================================
-- The 5 levels of greyscale. -- The 5 levels of greyscale.

View File

@ -20,7 +20,7 @@ local colored_block_sound = "default.node_sound_wood_defaults()"
-- Show the wood planks in the crafting guide: -- Show the wood planks in the crafting guide:
-- Value copy the groups table to another one to pass to stairsplus:register_all() -- Value copy the groups table to another one to pass to stairsplus:register_all()
-- oherwise stairsplus:register_all() will add the ["not_in_creative_inventory"] = 1 key/value to the groups -- oherwise stairsplus:register_all() will add the ["not_in_creative_inventory"] = 1 key/value to the groups
-- of the original table and force the coloredwood planks to be removed from the crafting guide. -- of the original table and force the coloredwood planks to be removed from the crafting guide.
local stairsplus_groups = {} local stairsplus_groups = {}
if coloredwood.enable_stairsplus then if coloredwood.enable_stairsplus then
for k, v in pairs(colored_block_groups) do for k, v in pairs(colored_block_groups) do
@ -179,7 +179,7 @@ for hue = 1, 12 do
}, },
}) })
end end
-- ============================================================ -- ============================================================
-- The 5 levels of greyscale. -- The 5 levels of greyscale.

View File

@ -22,7 +22,7 @@
-- Version 0.6 -- Version 0.6
-- Changelog: -- Changelog:
-- 23.05.15 As all dyes can be crafted into other dyes, only white dye is consumed - provided the -- 23.05.15 As all dyes can be crafted into other dyes, only white dye is consumed - provided the
-- other dyes needed for the crafting chain are stored. -- other dyes needed for the crafting chain are stored.
-- 22.05.15 Added support for new homedecor meshnodes. -- 22.05.15 Added support for new homedecor meshnodes.
@ -61,7 +61,7 @@
-- Added some more labels in the main menu to make it easier to understand. -- Added some more labels in the main menu to make it easier to understand.
-- 22.07.13 Added textures provided by Vanessae -- 22.07.13 Added textures provided by Vanessae
-- fixed a bug concerning normal dyes (when unifieddyes is not installed) -- fixed a bug concerning normal dyes (when unifieddyes is not installed)
-- adds a function to check ownership of a node; taken from VanessaEs homedecor mod -- adds a function to check ownership of a node; taken from VanessaEs homedecor mod
colormachine = {}; colormachine = {};
@ -86,14 +86,14 @@ local stained_glass_exception = 0;
-- the names of suitable sources of that color (note: this does not work by group!); -- the names of suitable sources of that color (note: this does not work by group!);
-- you can add your own color sources here if you want -- you can add your own color sources here if you want
colormachine.basic_dye_sources = { "flowers:rose", "flowers:tulip", "flowers:dandelion_yellow", colormachine.basic_dye_sources = { "flowers:rose", "flowers:tulip", "flowers:dandelion_yellow",
"", "default:cactus", "", "", "", -- no lime, no aqua, no cyan, no skyblue "", "default:cactus", "", "", "", -- no lime, no aqua, no cyan, no skyblue
"flowers:geranium", "flowers:viola", "", "", -- no magenta, no redviolet "flowers:geranium", "flowers:viola", "", "", -- no magenta, no redviolet
"default:clay_lump", "", "", "", "default:coal_lump" }; "default:clay_lump", "", "", "", "default:coal_lump" };
-- if flowers is not installed -- if flowers is not installed
colormachine.alternate_basic_dye_sources = { colormachine.alternate_basic_dye_sources = {
"default:apple", "default:desert_stone", "default:sand", "default:apple", "default:desert_stone", "default:sand",
"", "default:cactus", "", "", "", "", "default:cactus", "", "", "",
"default:leaves", "", "", "" , "default:leaves", "", "", "" ,
"default:clay_lump", "", "", "", "default:coal_lump" }; "default:clay_lump", "", "", "", "default:coal_lump" };
@ -115,11 +115,11 @@ colormachine.dye_mixes = { red = {}, -- base color
white = {}, -- base color white = {}, -- base color
lightgrey = {13,15}, -- white + grey lightgrey = {13,15}, -- white + grey
grey = {13,17}, -- black + white grey = {13,17}, -- black + white
darkgrey = {15,17}, -- grey + black darkgrey = {15,17}, -- grey + black
black = {}, -- base color black = {}, -- base color
} }
-- construct the formspec for the color selector -- construct the formspec for the color selector
@ -140,7 +140,7 @@ end
-- defines the order in which blocks are shown -- defines the order in which blocks are shown
-- nr: the diffrent block types need to be ordered by some system; the number defines that order -- nr: the diffrent block types need to be ordered by some system; the number defines that order
-- modname: some mods define more than one type of colored blocks; the modname is needed -- modname: some mods define more than one type of colored blocks; the modname is needed
-- for checking if the mod is installed and for creating colored blocks -- for checking if the mod is installed and for creating colored blocks
-- shades: some mods (or parts thereof) do not support all possible shades -- shades: some mods (or parts thereof) do not support all possible shades
-- grey_shades: some mods support only some shades of grey (or none at all) -- grey_shades: some mods support only some shades of grey (or none at all)
@ -166,7 +166,7 @@ colormachine.data = {
hardenedclay_ = { nr=3.5, modname='hardenedclay', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="hclay", block="hardenedclay:hardened_clay_white", add="hardened_clay_", p=16}, hardenedclay_ = { nr=3.5, modname='hardenedclay', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="hclay", block="hardenedclay:hardened_clay_white", add="hardened_clay_", p=16},
colouredstonebricks_ = { nr=3.6, modname='colouredstonebricks', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="cbrick", block="default:stonebrick", add="", p=1}, colouredstonebricks_ = { nr=3.6, modname='colouredstonebricks', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="cbrick", block="default:stonebrick", add="", p=1},
clstone_stone_ = { nr=3.7, modname='clstone', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="clstone",block="default:stone", add="", p=1, obj_postfix='_stone' }, clstone_stone_ = { nr=3.7, modname='clstone', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="clstone",block="default:stone", add="", p=1, obj_postfix='_stone' },
colorcubes_1_ = { nr=3.8, modname='colorcubes', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="ccubes",block="default:stone", add="", p=1, obj_postfix='_single' }, colorcubes_1_ = { nr=3.8, modname='colorcubes', shades={1,0,1,0,0,0,1,0}, grey_shades={1,0,1,1,1}, u=0, descr="ccubes",block="default:stone", add="", p=1, obj_postfix='_single' },
@ -403,7 +403,7 @@ colormachine.generate_form = function( m_prefix )
"label[0.3,1;light]"; "label[0.3,1;light]";
-- not all mods offer all shades (and some offer even more) -- not all mods offer all shades (and some offer even more)
local supported = colormachine.data[ m_prefix ].shades; local supported = colormachine.data[ m_prefix ].shades;
if( supported[2]==0 ) then if( supported[2]==0 ) then
form = form.. form = form..
@ -510,7 +510,7 @@ colormachine.decode_color_name = function( meta, new_color )
table.remove( liste, 1 ); -- the color has been selected table.remove( liste, 1 ); -- the color has been selected
end end
end end
-- the color was not found! error! keep the old color -- the color was not found! error! keep the old color
if( selected_color == -1 ) then if( selected_color == -1 ) then
if( meta ) then if( meta ) then
@ -595,8 +595,8 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
if( meta ~= nil ) then if( meta ~= nil ) then
c = tonumber(meta:get_string('selected_color')); c = tonumber(meta:get_string('selected_color'));
s = tonumber(meta:get_string('selected_shade')); s = tonumber(meta:get_string('selected_shade'));
g = tonumber(meta:get_string('selected_grey_shade')); g = tonumber(meta:get_string('selected_grey_shade'));
end end
@ -608,7 +608,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
local k_orig = k; local k_orig = k;
-- unifieddyes_ does not supply all colors -- unifieddyes_ does not supply all colors
if( k == 'unifieddyes_' if( k == 'unifieddyes_'
and ( (g==-1 and s==3 and (as_obj_name==1 or not(c==4 or c==6 or c==8 or c==12 or c==13 ))) and ( (g==-1 and s==3 and (as_obj_name==1 or not(c==4 or c==6 or c==8 or c==12 or c==13 )))
or (g==-1 and s==1 and c==1 ) -- pink or (g==-1 and s==1 and c==1 ) -- pink
or (g==-1 and s==7 and c==5 ) -- dark brown or (g==-1 and s==7 and c==5 ) -- dark brown
@ -646,7 +646,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
return 'homedecor:'..colormachine.data[k].add..'brown'..(colormachine.data[k].postfix or ''); return 'homedecor:'..colormachine.data[k].add..'brown'..(colormachine.data[k].postfix or '');
end end
end end
if( k=='homedecor_table_' and as_obj_name==1 and new_color=='dark_orange' ) then if( k=='homedecor_table_' and as_obj_name==1 and new_color=='dark_orange' ) then
return 'homedecor:'..colormachine.data[k].add..'mahogany'..(colormachine.data[k].postfix or ''); return 'homedecor:'..colormachine.data[k].add..'mahogany'..(colormachine.data[k].postfix or '');
end end
@ -661,8 +661,8 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
end end
-- beds and sofas are available in less colors -- beds and sofas are available in less colors
if( g==-1 if( g==-1
and (c==7 or c==11) and (c==7 or c==11)
and (k=='beds_bed_top_top_' or k=='lrfurn_sofa_right_front_' or k=='lrfurn_armchair_front_' or k=='lrfurn_longsofa_middle_front_' )) then and (k=='beds_bed_top_top_' or k=='lrfurn_sofa_right_front_' or k=='lrfurn_armchair_front_' or k=='lrfurn_longsofa_middle_front_' )) then
return nil; return nil;
@ -674,7 +674,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
local color_used = ""; local color_used = "";
if( s==1 and c==1 ) then if( s==1 and c==1 ) then
color_used = 'pink'; -- in blox, this is called "pink"; normally "light_red" color_used = 'pink'; -- in blox, this is called "pink"; normally "light_red"
elseif( g>-1 ) then elseif( g>-1 ) then
color_used = colormachine.grey_names[ g ]; color_used = colormachine.grey_names[ g ];
elseif( s ~= 3 ) then elseif( s ~= 3 ) then
return nil; -- only normal saturation supported return nil; -- only normal saturation supported
@ -692,7 +692,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
return 'blox_'..( color_used )..( colormachine.data[k].add )..'.png'; return 'blox_'..( color_used )..( colormachine.data[k].add )..'.png';
end end
end end
local postfix = '.png'; local postfix = '.png';
local prefix = k; local prefix = k;
@ -709,12 +709,12 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
return nil; -- no grey values for them return nil; -- no grey values for them
end end
local h_trans = {yellow=1, lime=2, green=3, aqua=4, cyan=5, skyblue=6, blue=7, violet=8, magenta=9, redviolet=10, red=11,orange=12}; local h_trans = {yellow=1, lime=2, green=3, aqua=4, cyan=5, skyblue=6, blue=7, violet=8, magenta=9, redviolet=10, red=11,orange=12};
local h = h_trans[ colormachine.colors[c] ]; local h = h_trans[ colormachine.colors[c] ];
local b = ""; local b = "";
local sat = ""; local sat = "";
if( k == 'stained_glass_' ) then if( k == 'stained_glass_' ) then
prefix = "stained_glass:"..(colormachine.colors[c]).."_"; prefix = "stained_glass:"..(colormachine.colors[c]).."_";
if( s==1 or s==2) then b = "8"; -- light if( s==1 or s==2) then b = "8"; -- light
@ -723,7 +723,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
elseif( s==7 or s==8) then b = "3"; -- dark elseif( s==7 or s==8) then b = "3"; -- dark
end end
prefix = prefix.."_"; prefix = prefix.."_";
sat = "7"; sat = "7";
if( s==2 or s==4 or s==6 or s==8 ) then -- saturation if( s==2 or s==4 or s==6 or s==8 ) then -- saturation
sat = "6"; sat = "6";
@ -747,7 +747,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
if( s==1 and new_color=='light_blue' ) then -- only light blue is supported if( s==1 and new_color=='light_blue' ) then -- only light blue is supported
return prefix..'light_blue'..postfix; return prefix..'light_blue'..postfix;
elseif( new_color=='dark_green' ) then elseif( new_color=='dark_green' ) then
return prefix..'forest_green'..postfix; return prefix..'forest_green'..postfix;
@ -760,14 +760,14 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
elseif( new_color=='orange' ) then elseif( new_color=='orange' ) then
return prefix..'oak'..postfix; return prefix..'oak'..postfix;
end end
end end
if( k=='cotton_' and new_color=='grey') then if( k=='cotton_' and new_color=='grey') then
new_color = 'mediumgrey'; new_color = 'mediumgrey';
end end
if( k=='framedglass_' and as_obj_name ~= 1) then if( k=='framedglass_' and as_obj_name ~= 1) then
postfix = 'glass.png'; postfix = 'glass.png';
@ -791,7 +791,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
end end
-- those have split textures... -- those have split textures...
if( colormachine.data[k].modname == 'coloredblocks') then if( colormachine.data[k].modname == 'coloredblocks') then
@ -818,7 +818,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
return 'coloredblocks_'..new_color..postfix; return 'coloredblocks_'..new_color..postfix;
elseif( new_color..'_' == colormachine.data[k].add ) then elseif( new_color..'_' == colormachine.data[k].add ) then
prefix = 'coloredblocks:'; prefix = 'coloredblocks:';
--]] --]]
@ -827,7 +827,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
end end
if( colormachine.data[k].modname == 'plasticbox' if( colormachine.data[k].modname == 'plasticbox'
and new_color == 'dark_green') then and new_color == 'dark_green') then
return prefix..'darkgreen'..postfix; return prefix..'darkgreen'..postfix;
end end
@ -835,11 +835,11 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
if( as_obj_name == 1 and colormachine.data[k].obj_postfix ) then if( as_obj_name == 1 and colormachine.data[k].obj_postfix ) then
postfix = (colormachine.data[k].obj_postfix) ..postfix; postfix = (colormachine.data[k].obj_postfix) ..postfix;
end end
-- normal dyes (also used for wool) use a diffrent naming scheme -- normal dyes (also used for wool) use a diffrent naming scheme
if( colormachine.data[k].u == 0) then if( colormachine.data[k].u == 0) then
if( new_color == 'darkgrey' and k ~= 'framedglass_') then if( new_color == 'darkgrey' and k ~= 'framedglass_') then
return prefix..'dark_grey'..postfix; return prefix..'dark_grey'..postfix;
elseif( new_color == 'dark_orange' ) then elseif( new_color == 'dark_orange' ) then
return prefix..'brown'..postfix; return prefix..'brown'..postfix;
elseif( new_color == 'dark_green' ) then elseif( new_color == 'dark_green' ) then
@ -847,7 +847,7 @@ colormachine.translate_color_name = function( meta, k, new_color, c, s, g, as_ob
elseif( new_color == 'light_red' ) then elseif( new_color == 'light_red' ) then
return prefix..'pink'..postfix; return prefix..'pink'..postfix;
-- lime, aqua, skyblue and redviolet do not exist as standard wool/dye colors -- lime, aqua, skyblue and redviolet do not exist as standard wool/dye colors
elseif( g == -1 and (c==4 or c==6 or c==8 or c==12) and k_orig ~= 'unifieddyes_') then elseif( g == -1 and (c==4 or c==6 or c==8 or c==12) and k_orig ~= 'unifieddyes_') then
return nil; return nil;
-- all other colors of normal dye/wool exist only in normal shade -- all other colors of normal dye/wool exist only in normal shade
elseif( g == -1 and s~= 3 and k_orig ~= 'unifieddyes_') then elseif( g == -1 and s~= 3 and k_orig ~= 'unifieddyes_') then
@ -872,16 +872,16 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
if( mod_name == v.modname ) then if( mod_name == v.modname ) then
table.insert( found, k ); table.insert( found, k );
end end
end end
if( #found < 1 ) then if( #found < 1 ) then
return { error_code ="Sorry, this block is not supported by the spray booth.", return { error_code ="Sorry, this block is not supported by the spray booth.",
found_name = "", found_name = "",
blocktype = ""}; blocktype = ""};
end end
-- another case of special treatment needed; at least the color is given in the tiles -- another case of special treatment needed; at least the color is given in the tiles
if( mod_name =='stained_glass' and stained_glass_exception==1) then if( mod_name =='stained_glass' and stained_glass_exception==1) then
local original_node = minetest.registered_items[ bname ]; local original_node = minetest.registered_items[ bname ];
if( original_node ~= nil ) then if( original_node ~= nil ) then
@ -891,7 +891,7 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
end end
end end
-- this mod does not seperate modname and objectname well enough :-( Naming scheme:- steel_framed_obsidian_glassCOLOR -- this mod does not seperate modname and objectname well enough :-( Naming scheme:- steel_framed_obsidian_glassCOLOR
if( mod_name =='framedglass' ) then if( mod_name =='framedglass' ) then
block_name = string.sub( block_name, 28 ); block_name = string.sub( block_name, 28 );
end end
@ -909,13 +909,13 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
local bloxdescr = original_node.description; local bloxdescr = original_node.description;
-- bloxparts[1] will be filled with the name of the color: -- bloxparts[1] will be filled with the name of the color:
local bloxparts = string.split( bloxdescr, " "); local bloxparts = string.split( bloxdescr, " ");
-- now extract the blocktype information -- now extract the blocktype information
if( bloxparts ~= nil and #bloxparts > 0 ) then if( bloxparts ~= nil and #bloxparts > 0 ) then
-- we split with the color name -- we split with the color name
local found_name = bloxparts[1]; local found_name = bloxparts[1];
local blocktype = 'blox_'..string.sub( block_name, string.len( found_name )+1 )..'_'; local blocktype = 'blox_'..string.sub( block_name, string.len( found_name )+1 )..'_';
-- handle pink and purple -- handle pink and purple
if( found_name == 'pink' ) then if( found_name == 'pink' ) then
found_name = 'light_red'; found_name = 'light_red';
@ -931,7 +931,7 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
-- if this point is reached, the decoding of the blox-block-name has failed -- if this point is reached, the decoding of the blox-block-name has failed
return { error_code = "Error: Failed to decode color of this blox-block.", return { error_code = "Error: Failed to decode color of this blox-block.",
found_name = "", found_name = "",
blocktype = "" }; blocktype = "" };
end end
@ -944,9 +944,9 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
elseif( block_name == 'shutter_mahogany' ) then elseif( block_name == 'shutter_mahogany' ) then
block_name = 'shutter_dark_orange'; block_name = 'shutter_dark_orange';
-- this is the default, unpainted one..which can also be considered as "orange" in the menu -- this is the default, unpainted one..which can also be considered as "orange" in the menu
-- elseif( blockname == 'shutter_oak' ) then -- elseif( blockname == 'shutter_oak' ) then
-- block_name = 'shutter_orange'; -- block_name = 'shutter_orange';
end end
end end
@ -968,7 +968,7 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
if( colormachine.data[k].obj_postfix ) then if( colormachine.data[k].obj_postfix ) then
local l = string.len( colormachine.data[k].obj_postfix); local l = string.len( colormachine.data[k].obj_postfix);
if( string.len( block_name ) > l if( string.len( block_name ) > l
and string.sub( block_name, -1*l ) == colormachine.data[k].obj_postfix ) then and string.sub( block_name, -1*l ) == colormachine.data[k].obj_postfix ) then
block_name = string.sub( block_name, 1, (-1*l)-1 ); block_name = string.sub( block_name, 1, (-1*l)-1 );
@ -992,14 +992,14 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
liste[ curr_index ] = 'dark'; liste[ curr_index ] = 'dark';
table.insert( liste, 'orange' ); table.insert( liste, 'orange' );
curr_index = curr_index + 1; curr_index = curr_index + 1;
-- pink <=> light_red -- pink <=> light_red
elseif( #liste > 0 and liste[ curr_index ]=='pink' ) then elseif( #liste > 0 and liste[ curr_index ]=='pink' ) then
liste[ curr_index ] = 'light'; liste[ curr_index ] = 'light';
table.insert( liste, 'red' ); table.insert( liste, 'red' );
curr_index = curr_index + 1; curr_index = curr_index + 1;
end end
-- find out the saturation - either "s50" or omitted -- find out the saturation - either "s50" or omitted
local sat = 0; local sat = 0;
if( curr_index > 1 and liste[ curr_index ] == "s50" ) then if( curr_index > 1 and liste[ curr_index ] == "s50" ) then
@ -1060,7 +1060,7 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
-- for blocks that do not follow the naming scheme - the color cannot be decoded -- for blocks that do not follow the naming scheme - the color cannot be decoded
if( g==-1 and c==0 ) then if( g==-1 and c==0 ) then
return { error_code ="This is a colored block: "..tostring( bname )..".", return { error_code ="This is a colored block: "..tostring( bname )..".",
found_name = "", found_name = "",
blocktype = ""}; blocktype = ""};
end end
@ -1072,7 +1072,7 @@ colormachine.get_color_from_blockname = function( mod_name, block_name )
for k,v in pairs( colormachine.data ) do for k,v in pairs( colormachine.data ) do
-- prefix and postfix have to fit -- prefix and postfix have to fit
if( curr_index > 0 and add=="" and mod_name == v.modname and (liste[ curr_index ].."_") == v.add if( curr_index > 0 and add=="" and mod_name == v.modname and (liste[ curr_index ].."_") == v.add
-- if a postfix exists, we did check for that before and set blocktype accordingly -- if a postfix exists, we did check for that before and set blocktype accordingly
and( not( blocktype ) or blocktype=='' or blocktype==k)) then and( not( blocktype ) or blocktype=='' or blocktype==k)) then
add = v.add; add = v.add;
@ -1133,13 +1133,13 @@ colormachine.blocktype_menu = function( meta, new_color, page )
local y = 2; local y = 2;
for i,k in ipairs( colormachine.ordered ) do for i,k in ipairs( colormachine.ordered ) do
-- only installed mods are of intrest -- only installed mods are of intrest
if( k ~= nil and colormachine.data[ k ].installed == 1 and i > start_at_offset and i <= (start_at_offset + per_page)) then if( k ~= nil and colormachine.data[ k ].installed == 1 and i > start_at_offset and i <= (start_at_offset + per_page)) then
-- that particular mod may not offer this color -- that particular mod may not offer this color
form = form.."button["..tostring(x)..","..tostring(y-0.8).. ";1,1;"..k..";"..colormachine.data[k].descr.."]".. form = form.."button["..tostring(x)..","..tostring(y-0.8).. ";1,1;"..k..";"..colormachine.data[k].descr.."]"..
"item_image["..tostring(x)..","..tostring(y )..";1,1;"..colormachine.data[k].block.."]"; "item_image["..tostring(x)..","..tostring(y )..";1,1;"..colormachine.data[k].block.."]";
local button = colormachine.print_color_image( meta, k, new_color, nil, nil, nil, tostring(x), tostring(y+1), 1);-- translated_color as return value for button local button = colormachine.print_color_image( meta, k, new_color, nil, nil, nil, tostring(x), tostring(y+1), 1);-- translated_color as return value for button
if( button ~= "" ) then if( button ~= "" ) then
@ -1198,7 +1198,7 @@ colormachine.main_menu_formspec = function( pos, option )
"label[3,0.0;1. Input - Insert material to paint:]".. "label[3,0.0;1. Input - Insert material to paint:]"..
"list[current_name;input;4.5,0.5;1,1;]".. "list[current_name;input;4.5,0.5;1,1;]"..
"label[9.3,-0.5;Additional storage for dyes:]".. "label[9.3,-0.5;Additional storage for dyes:]"..
"list[current_name;extrastore;9.3,0;5,9]"; "list[current_name;extrastore;9.3,0;5,9]";
@ -1228,7 +1228,7 @@ colormachine.main_menu_formspec = function( pos, option )
if( bname == v.block and colormachine.data[ k ].installed==1) then if( bname == v.block and colormachine.data[ k ].installed==1) then
table.insert( found, k ); table.insert( found, k );
end end
end end
-- make sure all output fields are empty -- make sure all output fields are empty
for i = 1, inv:get_size( "output" ) do for i = 1, inv:get_size( "output" ) do
@ -1288,13 +1288,13 @@ colormachine.main_menu_formspec = function( pos, option )
end end
-- so that we can determine the factor when taking blocks from the output slots -- so that we can determine the factor when taking blocks from the output slots
meta:set_string('p_values', minetest.serialize( p_values )); meta:set_string('p_values', minetest.serialize( p_values ));
-- this color was not supported -- this color was not supported
if( anz_found == 0 ) then if( anz_found == 0 ) then
form = form.."label[2.2,3.0;Block is not available in that color.]"; form = form.."label[2.2,3.0;Block is not available in that color.]";
return form; return form;
end end
form = form.."label[3.0,1.2;2. Select color for any style:]".. form = form.."label[3.0,1.2;2. Select color for any style:]"..
"label[3.0,2.9;3. Take output (determines style):]".. "label[3.0,2.9;3. Take output (determines style):]"..
"list[current_name;output;"..tostring(out_offset+1)..",3.5;"..tostring( anz_found )..",1;]"; "list[current_name;output;"..tostring(out_offset+1)..",3.5;"..tostring( anz_found )..",1;]";
@ -1308,7 +1308,7 @@ colormachine.main_menu_formspec = function( pos, option )
form = form.."label[2.2,3.0;ERROR! Failed to analyze the name of this node: "..tostring(bname).."]"; form = form.."label[2.2,3.0;ERROR! Failed to analyze the name of this node: "..tostring(bname).."]";
return form; return form;
end end
-- it may be a dye source -- it may be a dye source
for i,v in ipairs( colormachine.basic_dye_sources ) do for i,v in ipairs( colormachine.basic_dye_sources ) do
@ -1330,7 +1330,7 @@ colormachine.main_menu_formspec = function( pos, option )
-- the previous analyse was necessary in order to determine which block we ought to use -- the previous analyse was necessary in order to determine which block we ought to use
if( option == 'remove_paint' ) then if( option == 'remove_paint' ) then
-- actually remove the paint from the -- actually remove the paint from the
inv:set_stack( "input", 1, colormachine.data[ found_color_data.blocktype ].block.." "..tostring( anz_blocks )); inv:set_stack( "input", 1, colormachine.data[ found_color_data.blocktype ].block.." "..tostring( anz_blocks ));
-- update display (we changed the input!) -- update display (we changed the input!)
return colormachine.main_menu_formspec(pos, "analyze"); return colormachine.main_menu_formspec(pos, "analyze");
@ -1353,7 +1353,7 @@ colormachine.main_menu_formspec = function( pos, option )
else else
form = form.."label[5.5,2.0;This is the selected color.]"; form = form.."label[5.5,2.0;This is the selected color.]";
end end
return form; return form;
end end
@ -1368,7 +1368,7 @@ colormachine.get_node_name_painted = function( old_node_name, dye_node_name )
table.insert( possible_blocks, k ); table.insert( possible_blocks, k );
unpainted_block = old_node_name; unpainted_block = old_node_name;
end end
end end
if( unpainted_block == "" ) then if( unpainted_block == "" ) then
local parts = string.split(old_node_name,":"); local parts = string.split(old_node_name,":");
@ -1399,7 +1399,7 @@ colormachine.get_node_name_painted = function( old_node_name, dye_node_name )
table.insert( possible_blocks, k ); table.insert( possible_blocks, k );
end end
end end
end end
-- remove paint -- remove paint
if( not( dye_node_name ) or dye_node_name == "") then if( not( dye_node_name ) or dye_node_name == "") then
@ -1429,7 +1429,7 @@ colormachine.get_node_name_painted = function( old_node_name, dye_node_name )
local new_block_name = colormachine.translate_color_name( nil, k, dye_name, cdata.c, cdata.s, cdata.g, 1 ); local new_block_name = colormachine.translate_color_name( nil, k, dye_name, cdata.c, cdata.s, cdata.g, 1 );
table.insert( found, new_block_name ); table.insert( found, new_block_name );
end end
if( #found < 1 ) then if( #found < 1 ) then
return; return;
end end
@ -1468,7 +1468,7 @@ colormachine.allow_inventory_access = function(pos, listname, index, stack, play
local stack_name = stack:get_name(); local stack_name = stack:get_name();
-- the dyes are a bit special - they accept only powder of the correct name -- the dyes are a bit special - they accept only powder of the correct name
if( listname == "dyes" if( listname == "dyes"
and stack_name ~= ("dye:".. colormachine.colors_and_greys[ index ]) and stack_name ~= ("dye:".. colormachine.colors_and_greys[ index ])
and stack_name ~= ("unifieddyes:"..colormachine.colors_and_greys[ index ]) and stack_name ~= ("unifieddyes:"..colormachine.colors_and_greys[ index ])
and (stack_name ~= "dye:light_grey" or colormachine.colors_and_greys[ index ]~="lightgrey" ) and (stack_name ~= "dye:light_grey" or colormachine.colors_and_greys[ index ]~="lightgrey" )
@ -1500,7 +1500,7 @@ end
colormachine.on_metadata_inventory_put = function( pos, listname, index, stack, player ) colormachine.on_metadata_inventory_put = function( pos, listname, index, stack, player )
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory(); local inv = meta:get_inventory();
@ -1558,7 +1558,7 @@ end
colormachine.on_metadata_inventory_take = function( pos, listname, index, stack, player ) colormachine.on_metadata_inventory_take = function( pos, listname, index, stack, player )
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory(); local inv = meta:get_inventory();
@ -1598,7 +1598,7 @@ colormachine.on_metadata_inventory_take = function( pos, listname, index, stack,
else else
inv:set_stack( "input", 1, inv:get_stack("input",1):get_name().." "..tostring( anz_present )); inv:set_stack( "input", 1, inv:get_stack("input",1):get_name().." "..tostring( anz_present ));
end end
-- the main menu needs to be updated as well -- the main menu needs to be updated as well
meta:set_string( 'formspec', colormachine.main_menu_formspec( pos, "analyze" )); meta:set_string( 'formspec', colormachine.main_menu_formspec( pos, "analyze" ));
return; return;
@ -1637,7 +1637,7 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
needed[ colormachine.colors[ c ]] = 1; needed[ colormachine.colors[ c ]] = 1;
-- handle saturation -- handle saturation
if( s==1 ) then needed[ "white" ]=1; -- light if( s==1 ) then needed[ "white" ]=1; -- light
-- elseif( s==3 ) then -- normal color - no changes needed -- elseif( s==3 ) then -- normal color - no changes needed
elseif( s==4 ) then needed[ "white" ]=2; needed[ "black" ] =1; -- normal, low saturation elseif( s==4 ) then needed[ "white" ]=2; needed[ "black" ] =1; -- normal, low saturation
elseif( s==5 ) then needed[ "black" ] =1; -- medium dark elseif( s==5 ) then needed[ "black" ] =1; -- medium dark
elseif( s==6 ) then needed[ "white" ]=1; needed[ "black" ] =1; -- medium dark, low saturation elseif( s==6 ) then needed[ "white" ]=1; needed[ "black" ] =1; -- medium dark, low saturation
@ -1651,7 +1651,7 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
anz_pigments = anz_pigments + v; anz_pigments = anz_pigments + v;
end end
-- n: portions of *mixtures* needed -- n: portions of *mixtures* needed
local n = 1; local n = 1;
-- if the colors are to be consumed, we need to calculate how many we actually need -- if the colors are to be consumed, we need to calculate how many we actually need
@ -1663,7 +1663,7 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
-- now we need to check how many pigments of each color we have -- now we need to check how many pigments of each color we have
for i,v in ipairs( colormachine.colors_and_greys ) do for i,v in ipairs( colormachine.colors_and_greys ) do
if( needed[ v ] and needed[ v ]> 0 ) then if( needed[ v ] and needed[ v ]> 0 ) then
-- find out how many blocks of this type we can actually color -- find out how many blocks of this type we can actually color
local stack = inv:get_stack( "dyes", i ); local stack = inv:get_stack( "dyes", i );
@ -1688,8 +1688,8 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
n = math.min( anz_white, need_white ); n = math.min( anz_white, need_white );
end end
-- return how many *could* be colored -- return how many *could* be colored
if( amount_needed > 0 and do_consume ~= 1 ) then if( amount_needed > 0 and do_consume ~= 1 ) then
return n*anz_pigments; return n*anz_pigments;
@ -1700,8 +1700,8 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
for i,v in ipairs( colormachine.colors_and_greys ) do for i,v in ipairs( colormachine.colors_and_greys ) do
if( needed[ v ] and needed[ v ]> 0 ) then if( needed[ v ] and needed[ v ]> 0 ) then
-- show how many pigments of this color are needed for the selected mixture -- show how many pigments of this color are needed for the selected mixture
-- normal color -- normal color
if( i <= #colormachine.colors ) then if( i <= #colormachine.colors ) then
@ -1717,9 +1717,9 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
if( amount_needed > 0 and n > 0 ) then if( amount_needed > 0 and n > 0 ) then
local stack = inv:get_stack( "dyes", i ); local stack = inv:get_stack( "dyes", i );
local found = stack:get_count(); local found = stack:get_count();
--print( ' CONSUMED '..math.floor( n * needed[ v ] )..' of '..tostring( stack:get_name())); --print( ' CONSUMED '..math.floor( n * needed[ v ] )..' of '..tostring( stack:get_name()));
if( found > math.floor( n * needed[ v ] )) then if( found > math.floor( n * needed[ v ] )) then
inv:set_stack( "dyes", i, stack:get_name()..' '..tostring( math.max( 1, found - math.floor( n * needed[ v ] )))); inv:set_stack( "dyes", i, stack:get_name()..' '..tostring( math.max( 1, found - math.floor( n * needed[ v ] ))));
else else
inv:set_stack( "dyes", i, "" ); inv:set_stack( "dyes", i, "" );
end end
@ -1730,7 +1730,7 @@ colormachine.calc_dyes_needed = function( meta, inv, amount_needed, do_consume )
-- in case pigments where consumed, return how many blocks where colored successfully -- in case pigments where consumed, return how many blocks where colored successfully
if( amount_needed > 0 and n > 0 ) then if( amount_needed > 0 and n > 0 ) then
--print('Successfully colored: '..tostring( n*anz_pigments )); --print('Successfully colored: '..tostring( n*anz_pigments ));
return n*anz_pigments; return n*anz_pigments;
end end
@ -1763,9 +1763,9 @@ colormachine.mix_colors = function( inv, i, sender )
local stack1 = inv:get_stack( "dyes", mix[1] ); local stack1 = inv:get_stack( "dyes", mix[1] );
local stack2 = inv:get_stack( "dyes", mix[2] ); local stack2 = inv:get_stack( "dyes", mix[2] );
local stack3 = inv:get_stack( "dyes", i ); local stack3 = inv:get_stack( "dyes", i );
if( stack3:get_free_space() > 1 -- we need space for two
if( stack3:get_free_space() > 1 -- we need space for two
and stack1:get_count() > 0 and stack1:get_count() > 0
and stack2:get_count() > 0 ) then and stack2:get_count() > 0 ) then
@ -1794,12 +1794,12 @@ colormachine.mix_colors = function( inv, i, sender )
elseif( stack3:get_free_space() > 1 ) then elseif( stack3:get_free_space() > 1 ) then
minetest.chat_send_player( sender:get_player_name(), 'Need '..colormachine.colors_and_greys[ mix[1] ]..' and '.. minetest.chat_send_player( sender:get_player_name(), 'Need '..colormachine.colors_and_greys[ mix[1] ]..' and '..
colormachine.colors_and_greys[ mix[2] ]..' in order to mix '..farbe..'.'); colormachine.colors_and_greys[ mix[2] ]..' in order to mix '..farbe..'.');
end end
end end
-- this generates the formspec for all supported mods and the general colormachine.dye_management_formspec -- this generates the formspec for all supported mods and the general colormachine.dye_management_formspec
colormachine.init = function() colormachine.init = function()
local liste = {}; local liste = {};
-- create formspecs for all machines -- create formspecs for all machines
@ -1820,7 +1820,7 @@ colormachine.init = function()
end end
end end
table.sort( liste, function(a,b) return colormachine.data[a].nr < colormachine.data[b].nr end); table.sort( liste, function(a,b) return colormachine.data[a].nr < colormachine.data[b].nr end);
colormachine.ordered = liste; colormachine.ordered = liste;
-- if no flowers are present, take dye sources from default (so we only have to depend on dyes) -- if no flowers are present, take dye sources from default (so we only have to depend on dyes)
@ -1854,7 +1854,7 @@ colormachine.init = function()
-- align colors horizontal -- align colors horizontal
for i,k in ipairs( colormachine.colors ) do for i,k in ipairs( colormachine.colors ) do
local prefix = 'dye:'; local prefix = 'dye:';
if( i==4 or i==6 or i==8 or i==12 or i==14 ) then if( i==4 or i==6 or i==8 or i==12 or i==14 ) then
if( colormachine.data[ 'unifieddyes_' ].installed == 1 ) then if( colormachine.data[ 'unifieddyes_' ].installed == 1 ) then
@ -1871,15 +1871,15 @@ colormachine.init = function()
form = form.."item_image["..tostring(i)..",1;1,1;"..source.."]"; form = form.."item_image["..tostring(i)..",1;1,1;"..source.."]";
-- even those colors may be additionally mixed -- even those colors may be additionally mixed
if( #colormachine.dye_mixes[ colormachine.colors_and_greys[ i ] ] == 2 ) then if( #colormachine.dye_mixes[ colormachine.colors_and_greys[ i ] ] == 2 ) then
form = form.. "button["..tostring(i-0.1)..",1.9;0.8,0.2;mix_"..colormachine.colors_and_greys[ i ]..";mix]"; form = form.. "button["..tostring(i-0.1)..",1.9;0.8,0.2;mix_"..colormachine.colors_and_greys[ i ]..";mix]";
end end
-- a color that can be mixed -- a color that can be mixed
elseif( #colormachine.dye_mixes[ colormachine.colors_and_greys[ i ] ] == 2 ) then elseif( #colormachine.dye_mixes[ colormachine.colors_and_greys[ i ] ] == 2 ) then
local mixes = colormachine.dye_mixes[ colormachine.colors_and_greys[ i ] ]; local mixes = colormachine.dye_mixes[ colormachine.colors_and_greys[ i ] ];
local source1 = 'dye:'..colormachine.colors_and_greys[ mixes[1] ]; local source1 = 'dye:'..colormachine.colors_and_greys[ mixes[1] ];
local source2 = 'dye:'..colormachine.colors_and_greys[ mixes[2] ]; local source2 = 'dye:'..colormachine.colors_and_greys[ mixes[2] ];
@ -1887,7 +1887,7 @@ colormachine.init = function()
"item_image["..tostring(i+0.3)..",1.3;1,1;"..source2.."]".. "item_image["..tostring(i+0.3)..",1.3;1,1;"..source2.."]"..
"button["..tostring(i-0.1)..",1.9;0.8,0.2;mix_"..colormachine.colors_and_greys[ i ]..";mix]"; "button["..tostring(i-0.1)..",1.9;0.8,0.2;mix_"..colormachine.colors_and_greys[ i ]..";mix]";
end end
form = form.. "item_image["..tostring(i)..",2;1,1;"..tostring( prefix..colormachine.colors[ i ] ).."]".. form = form.. "item_image["..tostring(i)..",2;1,1;"..tostring( prefix..colormachine.colors[ i ] ).."]"..
"label["..tostring(i)..",3.6;" ..tostring( colormachine.colors_and_greys[ i ] ).."]"; "label["..tostring(i)..",3.6;" ..tostring( colormachine.colors_and_greys[ i ] ).."]";
else else
@ -1897,14 +1897,14 @@ colormachine.init = function()
-- align grey-values vertical -- align grey-values vertical
for i,k in ipairs( colormachine.grey_names ) do for i,k in ipairs( colormachine.grey_names ) do
if( i ~= 2 or colormachine.data[ 'unifieddyes_' ].installed == 1 ) then if( i ~= 2 or colormachine.data[ 'unifieddyes_' ].installed == 1 ) then
local source = colormachine.basic_dye_sources[ #colormachine.colors + i ]; local source = colormachine.basic_dye_sources[ #colormachine.colors + i ];
if( source and source ~= "" ) then if( source and source ~= "" ) then
form = form.."item_image[10,"..tostring(i+4)..";1,1;"..source.."]"; form = form.."item_image[10,"..tostring(i+4)..";1,1;"..source.."]";
elseif( #colormachine.dye_mixes[ colormachine.colors_and_greys[ #colormachine.colors + i ] ] == 2 ) then elseif( #colormachine.dye_mixes[ colormachine.colors_and_greys[ #colormachine.colors + i ] ] == 2 ) then
local mixes = colormachine.dye_mixes[ colormachine.colors_and_greys[ #colormachine.colors + i ] ]; local mixes = colormachine.dye_mixes[ colormachine.colors_and_greys[ #colormachine.colors + i ] ];
@ -1915,7 +1915,7 @@ colormachine.init = function()
"item_image[10.3,"..tostring(i+4.3)..";1,1;"..source2.."]".. "item_image[10.3,"..tostring(i+4.3)..";1,1;"..source2.."]"..
"button[9.8," ..tostring(i+4.9)..";0.8,0.2;mix_"..colormachine.colors_and_greys[ #colormachine.colors + i ]..";mix]"; "button[9.8," ..tostring(i+4.9)..";0.8,0.2;mix_"..colormachine.colors_and_greys[ #colormachine.colors + i ]..";mix]";
end end
local dye_name = 'dye:'..k; local dye_name = 'dye:'..k;
-- lightgrey exists only in unifieddyes -- lightgrey exists only in unifieddyes
@ -1930,7 +1930,7 @@ colormachine.init = function()
elseif( i==4 ) then elseif( i==4 ) then
dye_name = 'dye:dark_grey'; dye_name = 'dye:dark_grey';
end end
if( dye_name ~= "" ) then if( dye_name ~= "" ) then
form = form.. "item_image[11,"..tostring(i+4)..";1,1;"..tostring( dye_name ).."]".. form = form.. "item_image[11,"..tostring(i+4)..";1,1;"..tostring( dye_name ).."]"..
"label[ 12.9,"..tostring(i+4)..";" ..tostring( colormachine.colors_and_greys[ #colormachine.colors + i ] ).."]"; "label[ 12.9,"..tostring(i+4)..";" ..tostring( colormachine.colors_and_greys[ #colormachine.colors + i ] ).."]";
@ -1939,8 +1939,8 @@ colormachine.init = function()
form = form.."label[12.2,"..tostring(i+4)..";n/a]"; form = form.."label[12.2,"..tostring(i+4)..";n/a]";
end end
end end
colormachine.dye_management_formspec = form; colormachine.dye_management_formspec = form;
end end
@ -1957,7 +1957,7 @@ minetest.after( 0, colormachine.init );
-- unifiedbricks: clay blocks, brick blocks (skip individual clay lumps and bricks!) -- unifiedbricks: clay blocks, brick blocks (skip individual clay lumps and bricks!)
-- multicolor: 3 shades, usual amount of colors -- multicolor: 3 shades, usual amount of colors
-- cotton: (by jordach) probably the same as coloredwood -- cotton: (by jordach) probably the same as coloredwood
-- --
-- stained_glass: 9 shades/intensities -- stained_glass: 9 shades/intensities
@ -2051,15 +2051,15 @@ minetest.register_node("colormachine:colormachine", {
return; return;
elseif( colormachine.data[ k ] ) then elseif( colormachine.data[ k ] ) then
-- remember the page we where at -- remember the page we where at
meta:set_string( 'formspec', colormachine.data[ k ].formspec.. meta:set_string( 'formspec', colormachine.data[ k ].formspec..
"field[20,20;0.1,0.1;page;;"..tostring(fields.page).."]" ); "field[20,20;0.1,0.1;page;;"..tostring(fields.page).."]" );
return; return;
elseif( k=='key_escape') then elseif( k=='key_escape') then
-- nothing to do -- nothing to do
else else
local inv = meta:get_inventory(); local inv = meta:get_inventory();
-- perhaps we ought to mix colors -- perhaps we ought to mix colors
for i,f in ipairs( colormachine.colors_and_greys ) do for i,f in ipairs( colormachine.colors_and_greys ) do
if( k==("mix_"..f )) then if( k==("mix_"..f )) then
colormachine.mix_colors( inv, i, sender ); colormachine.mix_colors( inv, i, sender );
@ -2083,8 +2083,8 @@ minetest.register_node("colormachine:colormachine", {
elseif( k=='last_page') then elseif( k=='last_page') then
fields.page = math.ceil(#colormachine.ordered/(3*13)-1); fields.page = math.ceil(#colormachine.ordered/(3*13)-1);
end end
meta:set_string( 'formspec', colormachine.blocktype_menu( meta, k, fields.page )); meta:set_string( 'formspec', colormachine.blocktype_menu( meta, k, fields.page ));
else else
@ -2102,7 +2102,7 @@ minetest.register_node("colormachine:colormachine", {
return 0; return 0;
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return colormachine.allow_inventory_access(pos, listname, index, stack, player, "put" ); return colormachine.allow_inventory_access(pos, listname, index, stack, player, "put" );
end, end,
@ -2131,13 +2131,13 @@ minetest.register_node("colormachine:colormachine", {
if( not( inv:is_empty("input")) if( not( inv:is_empty("input"))
or not( inv:is_empty("refill"))) then or not( inv:is_empty("refill"))) then
minetest.chat_send_player( player:get_player_name(), "Please remove the material in the input- and/or refill slot first!"); minetest.chat_send_player( player:get_player_name(), "Please remove the material in the input- and/or refill slot first!");
meta:set_string( 'formspec', colormachine.blocktype_menu( meta, meta:get_string('selected_name'), 0)); meta:set_string( 'formspec', colormachine.blocktype_menu( meta, meta:get_string('selected_name'), 0));
return false; return false;
end end
if( not( inv:is_empty("dyes"))) then if( not( inv:is_empty("dyes"))) then
minetest.chat_send_player( player:get_player_name(), "Please remove the stored dyes first!"); minetest.chat_send_player( player:get_player_name(), "Please remove the stored dyes first!");
meta:set_string( 'formspec', colormachine.blocktype_menu( meta, meta:get_string('selected_name'), 0 )); meta:set_string( 'formspec', colormachine.blocktype_menu( meta, meta:get_string('selected_name'), 0 ));
return false; return false;
end end

View File

@ -18,8 +18,8 @@ minetest.register_craft({
} }
}) })
-- Bracket -- Bracket
minetest.register_node("columnia:bracket", { minetest.register_node("columnia:bracket", {
description = 'Bracket (Column)', description = 'Bracket (Column)',
tiles = {"columnia_rusty.png",}, tiles = {"columnia_rusty.png",},
drawtype = "nodebox", drawtype = "nodebox",
@ -40,7 +40,7 @@ minetest.register_node("columnia:bracket", {
groups = {choppy=2, oddly_breakable_by_hand=2,}, groups = {choppy=2, oddly_breakable_by_hand=2,},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_craft({ minetest.register_craft({
output = 'columnia:bracket 4', output = 'columnia:bracket 4',
recipe = { recipe = {
@ -70,7 +70,7 @@ minetest.register_node("columnia:lamp_ceiling", {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.1875, 0.4375, -0.1875, 0.1875, 0.5, 0.1875}, {-0.1875, 0.4375, -0.1875, 0.1875, 0.5, 0.1875},
{-0.125, 0.375, -0.125, 0.125, 0.4375, 0.125}, {-0.125, 0.375, -0.125, 0.125, 0.4375, 0.125},
}, },
}, },
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
@ -189,7 +189,7 @@ function columnia.register_column_top(subname, recipeitem, groups, images, descr
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25}, {-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
{-0.5, 0.25, -0.5, 0.5, 0.5, 0.5}, {-0.5, 0.25, -0.5, 0.5, 0.5, 0.5},
{-0.375, 0, -0.375, 0.375, 0.5, 0.375}, {-0.375, 0, -0.375, 0.375, 0.5, 0.375},
}, },
}, },
@ -545,7 +545,7 @@ columnia.register_column_ia("stone", "default:stone",
"Stone Column Link", "Stone Column Link",
"Stone Column Linkdown", "Stone Column Linkdown",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
columnia.register_column_ia("stonebrick", "default:stonebrick", columnia.register_column_ia("stonebrick", "default:stonebrick",
{cracky=3}, {cracky=3},
{"default_stone_brick.png"}, {"default_stone_brick.png"},
@ -566,7 +566,7 @@ columnia.register_column_ia("desert_stonebrick", "default:desert_stonebrick",
"Desert Stone Brick Column Crosslink", "Desert Stone Brick Column Crosslink",
"Desert Stone Brick Column Link", "Desert Stone Brick Column Link",
"Desert Stone Brick Column Linkdown", "Desert Stone Brick Column Linkdown",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
columnia.register_column_ia("desert_stone", "default:desert_stone", columnia.register_column_ia("desert_stone", "default:desert_stone",
{cracky=3}, {cracky=3},
@ -577,8 +577,8 @@ columnia.register_column_ia("desert_stone", "default:desert_stone",
"Desert Stone Column Crosslink", "Desert Stone Column Crosslink",
"Desert Stone Column Link", "Desert Stone Column Link",
"Desert Stone Column Linkdown", "Desert Stone Column Linkdown",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
columnia.register_column_ia("cobble", "default:cobble", columnia.register_column_ia("cobble", "default:cobble",
{cracky=3}, {cracky=3},
{"default_cobble.png"}, {"default_cobble.png"},
@ -599,8 +599,8 @@ columnia.register_column_ia("brick", "default:brick",
"Brick Column Crosslink", "Brick Column Crosslink",
"Brick Column Link", "Brick Column Link",
"Brick Column Linkdown", "Brick Column Linkdown",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
columnia.register_column_ia("sandstone", "default:sandstone", columnia.register_column_ia("sandstone", "default:sandstone",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"default_sandstone.png"}, {"default_sandstone.png"},
@ -611,7 +611,7 @@ columnia.register_column_ia("sandstone", "default:sandstone",
"Sandstone Column Link", "Sandstone Column Link",
"Sandstone Column Linkdown", "Sandstone Column Linkdown",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
columnia.register_column_ia("sandstonebrick", "default:sandstonebrick", columnia.register_column_ia("sandstonebrick", "default:sandstonebrick",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"default_sandstone_brick.png"}, {"default_sandstone_brick.png"},
@ -622,7 +622,7 @@ columnia.register_column_ia("sandstonebrick", "default:sandstonebrick",
"Sandstone Brick Column Link", "Sandstone Brick Column Link",
"Sandstone Brick Column Linkdown", "Sandstone Brick Column Linkdown",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
columnia.register_column_ia("wood", "default:wood", columnia.register_column_ia("wood", "default:wood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"default_wood.png"}, {"default_wood.png"},

View File

@ -139,7 +139,7 @@ minetest.register_craftitem("compassgps:cgpsmap_marked", {
e:setyaw(yaw) e:setyaw(yaw)
local dist=math.abs(pos.x-x)+math.abs(pos.y-y)+math.abs(pos.z-z) local dist=math.abs(pos.x-x)+math.abs(pos.y-y)+math.abs(pos.z-z)
if growing_wall_maps == false then if growing_wall_maps == false then
e:set_properties({visual_size={x=0.85,y=0.85}}) e:set_properties({visual_size={x=0.85,y=0.85}})
elseif dist>30000 then elseif dist>30000 then
e:set_properties({visual_size={x=3.45,y=3.45}}) e:set_properties({visual_size={x=3.45,y=3.45}})
elseif dist>15000 then elseif dist>15000 then

View File

@ -100,7 +100,7 @@ if minetest.get_modpath("farming") == nil then
{"default:dry_shrub","default:dry_shrub"}, {"default:dry_shrub","default:dry_shrub"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "darkage:straw 2", output = "darkage:straw 2",
recipe = { recipe = {
@ -131,7 +131,7 @@ else
{"default:dry_shrub","default:dry_shrub"}, {"default:dry_shrub","default:dry_shrub"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "farming:straw 2", output = "farming:straw 2",
recipe = { recipe = {
@ -139,7 +139,7 @@ else
{"darkage:dry_leaves","darkage:dry_leaves"}, {"darkage:dry_leaves","darkage:dry_leaves"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "darkage:straw_bale", output = "darkage:straw_bale",
recipe = { recipe = {
@ -147,7 +147,7 @@ else
{"farming:straw","farming:straw"}, {"farming:straw","farming:straw"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "darkage:adobe 4", output = "darkage:adobe 4",
recipe = { recipe = {

View File

@ -155,7 +155,7 @@ local function generate_claylike(name, minp, maxp, seed, chance, minh, maxh, dir
end end
if num_water_around >= 3 then if num_water_around >= 3 then
is_shallow = false is_shallow = false
end end
if is_shallow then if is_shallow then
for x1=-divlen,divlen do for x1=-divlen,divlen do
for z1=-divlen,divlen do for z1=-divlen,divlen do

View File

@ -7,7 +7,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "marble", "darkage:marble", { stairsplus:register_all("darkage", "marble", "darkage:marble", {
description = "Marble", description = "Marble",
tiles = {"darkage_marble.png"}, tiles = {"darkage_marble.png"},
@ -15,7 +15,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "serpentine", "darkage:serpentine", { stairsplus:register_all("darkage", "serpentine", "darkage:serpentine", {
description = "Serpentine", description = "Serpentine",
tiles = {"darkage_serpentine.png"}, tiles = {"darkage_serpentine.png"},
@ -23,7 +23,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "ors", "darkage:ors", { stairsplus:register_all("darkage", "ors", "darkage:ors", {
description = "Old Red Sandstone", description = "Old Red Sandstone",
tiles = {"darkage_ors.png"}, tiles = {"darkage_ors.png"},
@ -31,7 +31,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "schist", "darkage:schist", { stairsplus:register_all("darkage", "schist", "darkage:schist", {
description = "Schist", description = "Schist",
tiles = {"darkage_schist.png"}, tiles = {"darkage_schist.png"},
@ -39,7 +39,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "slate", "darkage:slate", { stairsplus:register_all("darkage", "slate", "darkage:slate", {
description = "Slate", description = "Slate",
tiles = {"darkage_slate.png"}, tiles = {"darkage_slate.png"},
@ -47,7 +47,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "gneiss", "darkage:gneiss", { stairsplus:register_all("darkage", "gneiss", "darkage:gneiss", {
description = "Gneiss", description = "Gneiss",
tiles = {"darkage_gneiss.png"}, tiles = {"darkage_gneiss.png"},
@ -55,7 +55,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "chalk", "darkage:chalk", { stairsplus:register_all("darkage", "chalk", "darkage:chalk", {
description = "Chalk", description = "Chalk",
tiles = {"darkage_chalk.png"}, tiles = {"darkage_chalk.png"},
@ -63,7 +63,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "slate_cobble", "darkage:slate_cobble", { stairsplus:register_all("darkage", "slate_cobble", "darkage:slate_cobble", {
description = "Slate Cobble", description = "Slate Cobble",
tiles = {"darkage_slate_cobble.png"}, tiles = {"darkage_slate_cobble.png"},
@ -71,7 +71,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "ors_cobble", "darkage:ors_cobble", { stairsplus:register_all("darkage", "ors_cobble", "darkage:ors_cobble", {
description = "Old Red Sandstone Cobble", description = "Old Red Sandstone Cobble",
tiles = {"darkage_ors_cobble.png"}, tiles = {"darkage_ors_cobble.png"},
@ -79,7 +79,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "gneiss_cobble", "darkage:gneiss_cobble", { stairsplus:register_all("darkage", "gneiss_cobble", "darkage:gneiss_cobble", {
description = "Gneiss Cobble", description = "Gneiss Cobble",
tiles = {"darkage_gneiss_cobble.png"}, tiles = {"darkage_gneiss_cobble.png"},
@ -87,7 +87,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "basalt_cobble", "darkage:basalt_cobble", { stairsplus:register_all("darkage", "basalt_cobble", "darkage:basalt_cobble", {
description = "Basalt Cobble", description = "Basalt Cobble",
tiles = {"darkage_basalt_cobble.png"}, tiles = {"darkage_basalt_cobble.png"},
@ -113,7 +113,7 @@ if stairsplus then
sunlight_propagates = true, sunlight_propagates = true,
}) })
end end
stairsplus:register_all("darkage", "straw_bale", "darkage:straw_bale", { stairsplus:register_all("darkage", "straw_bale", "darkage:straw_bale", {
description = "Straw Bale", description = "Straw Bale",
tiles = {"darkage_straw_bale.png"}, tiles = {"darkage_straw_bale.png"},
@ -121,7 +121,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "slate_tile", "darkage:slate_tile", { stairsplus:register_all("darkage", "slate_tile", "darkage:slate_tile", {
description = "Slate Tile", description = "Slate Tile",
tiles = {"darkage_slate_tile.png"}, tiles = {"darkage_slate_tile.png"},
@ -129,7 +129,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "marble_tile", "darkage:marble_tile", { stairsplus:register_all("darkage", "marble_tile", "darkage:marble_tile", {
description = "Marble Tile", description = "Marble Tile",
tiles = {"darkage_marble_tile.png"}, tiles = {"darkage_marble_tile.png"},
@ -137,7 +137,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "stone_brick", "darkage:stone_brick", { stairsplus:register_all("darkage", "stone_brick", "darkage:stone_brick", {
description = "Stone Brick", description = "Stone Brick",
tiles = {"darkage_stone_brick.png"}, tiles = {"darkage_stone_brick.png"},
@ -145,7 +145,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "reinforced_chalk", "darkage:reinforced_chalk", { stairsplus:register_all("darkage", "reinforced_chalk", "darkage:reinforced_chalk", {
description = "Reinforced Chalk", description = "Reinforced Chalk",
tiles = {"darkage_chalk.png^darkage_reinforce.png"}, tiles = {"darkage_chalk.png^darkage_reinforce.png"},
@ -153,7 +153,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "glass", "darkage:glass", { stairsplus:register_all("darkage", "glass", "darkage:glass", {
description = "Medieval Glass", description = "Medieval Glass",
tiles = {"darkage_glass.png"}, tiles = {"darkage_glass.png"},
@ -161,7 +161,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "glow_glass", "darkage:glow_glass", { stairsplus:register_all("darkage", "glow_glass", "darkage:glow_glass", {
description = "Medieval Glow Glass", description = "Medieval Glow Glass",
tiles = {"darkage_glass.png"}, tiles = {"darkage_glass.png"},
@ -171,7 +171,7 @@ if stairsplus then
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
}) })
stairsplus:register_all("darkage", "reinforced_wood", "darkage:reinforced_wood", { stairsplus:register_all("darkage", "reinforced_wood", "darkage:reinforced_wood", {
description = "Reinforced Wood", description = "Reinforced Wood",
tiles = {"default_wood.png^darkage_reinforce.png"}, tiles = {"default_wood.png^darkage_reinforce.png"},
@ -189,7 +189,7 @@ elseif stairs then
"Basalt Slab", "Basalt Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("marble", "darkage:marble", stairs.register_stair_and_slab("marble", "darkage:marble",
{cracky=3}, {cracky=3},
{"darkage_marble.png"}, {"darkage_marble.png"},
@ -197,7 +197,7 @@ elseif stairs then
"Marble Slab", "Marble Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("marble", "darkage:serpentine", stairs.register_stair_and_slab("marble", "darkage:serpentine",
{cracky=3}, {cracky=3},
{"darkage_serpentine.png"}, {"darkage_serpentine.png"},
@ -205,7 +205,7 @@ elseif stairs then
"Serpentine Slab", "Serpentine Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("ors", "darkage:ors", stairs.register_stair_and_slab("ors", "darkage:ors",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"darkage_ors.png"}, {"darkage_ors.png"},
@ -213,7 +213,7 @@ elseif stairs then
"Old Red Sandstone Slab", "Old Red Sandstone Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("schist", "darkage:schist", stairs.register_stair_and_slab("schist", "darkage:schist",
{cracky=3}, {cracky=3},
{"darkage_schist.png"}, {"darkage_schist.png"},
@ -221,7 +221,7 @@ elseif stairs then
"Schist Slab", "Schist Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("slate", "darkage:slate", stairs.register_stair_and_slab("slate", "darkage:slate",
{cracky=2}, {cracky=2},
{"darkage_slate.png"}, {"darkage_slate.png"},
@ -229,7 +229,7 @@ elseif stairs then
"Slate Slab", "Slate Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("gneiss", "darkage:gneiss", stairs.register_stair_and_slab("gneiss", "darkage:gneiss",
{cracky=3}, {cracky=3},
{"darkage_gneiss.png"}, {"darkage_gneiss.png"},
@ -237,7 +237,7 @@ elseif stairs then
"Gneiss Slab", "Gneiss Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("chalk", "darkage:chalk", stairs.register_stair_and_slab("chalk", "darkage:chalk",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"darkage_chalk.png"}, {"darkage_chalk.png"},
@ -245,7 +245,7 @@ elseif stairs then
"Chalk Slab", "Chalk Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("slate_cobble", "darkage:slate_cobble", stairs.register_stair_and_slab("slate_cobble", "darkage:slate_cobble",
{cracky=2}, {cracky=2},
{"darkage_slate_cobble.png"}, {"darkage_slate_cobble.png"},
@ -253,7 +253,7 @@ elseif stairs then
"Slate Cobble Slab", "Slate Cobble Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("ors_cobble", "darkage:ors_cobble", stairs.register_stair_and_slab("ors_cobble", "darkage:ors_cobble",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"darkage_ors_cobble.png"}, {"darkage_ors_cobble.png"},
@ -261,7 +261,7 @@ elseif stairs then
"Old Red Sandstone Cobble Slab", "Old Red Sandstone Cobble Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("gneiss_cobble", "darkage:gneiss_cobble", stairs.register_stair_and_slab("gneiss_cobble", "darkage:gneiss_cobble",
{crumbly=2,cracky=2}, {crumbly=2,cracky=2},
{"darkage_gneiss_cobble.png"}, {"darkage_gneiss_cobble.png"},
@ -269,7 +269,7 @@ elseif stairs then
"Gneiss Cobble Slab", "Gneiss Cobble Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("basalt_cobble", "darkage:basalt_cobble", stairs.register_stair_and_slab("basalt_cobble", "darkage:basalt_cobble",
{cracky=3}, {cracky=3},
{"darkage_basalt_cobble.png"}, {"darkage_basalt_cobble.png"},
@ -302,7 +302,7 @@ elseif stairs then
"Straw Bale Slab", "Straw Bale Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("slate_tile", "darkage:slate_tile", stairs.register_stair_and_slab("slate_tile", "darkage:slate_tile",
{cracky=2}, {cracky=2},
{"darkage_slate_tile.png"}, {"darkage_slate_tile.png"},
@ -310,7 +310,7 @@ elseif stairs then
"Slate Tile Slab", "Slate Tile Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("marble_tile", "darkage:marble_tile", stairs.register_stair_and_slab("marble_tile", "darkage:marble_tile",
{cracky=2}, {cracky=2},
{"darkage_marble_tile.png"}, {"darkage_marble_tile.png"},
@ -318,7 +318,7 @@ elseif stairs then
"Marble Tile Slab", "Marble Tile Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("stone_brick", "darkage:stone_brick", stairs.register_stair_and_slab("stone_brick", "darkage:stone_brick",
{cracky=3}, {cracky=3},
{"darkage_stone_brick.png"}, {"darkage_stone_brick.png"},
@ -326,7 +326,7 @@ elseif stairs then
"Stone Brick Slab", "Stone Brick Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("reinforced_chalk", "darkage:reinforced_chalk", stairs.register_stair_and_slab("reinforced_chalk", "darkage:reinforced_chalk",
{cracky=3}, {cracky=3},
{"darkage_chalk.png^darkage_reinforce.png"}, {"darkage_chalk.png^darkage_reinforce.png"},
@ -334,7 +334,7 @@ elseif stairs then
"Reinforced Chalk Slab", "Reinforced Chalk Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("glass", "darkage:glass", stairs.register_stair_and_slab("glass", "darkage:glass",
{snappy=2,cracky=3,oddly_breakable_by_hand=3}, {snappy=2,cracky=3,oddly_breakable_by_hand=3},
{"darkage_glass.png"}, {"darkage_glass.png"},
@ -342,7 +342,7 @@ elseif stairs then
"Medieval Glass Slab", "Medieval Glass Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("glow_glass", "darkage:glow_glass", stairs.register_stair_and_slab("glow_glass", "darkage:glow_glass",
{snappy=2,cracky=3,oddly_breakable_by_hand=3}, {snappy=2,cracky=3,oddly_breakable_by_hand=3},
{"darkage_glass.png"}, {"darkage_glass.png"},
@ -350,7 +350,7 @@ elseif stairs then
"Medieval Glow Glass Slab", "Medieval Glow Glass Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
stairs.register_stair_and_slab("reinforced_wood", "darkage:reinforced_wood", stairs.register_stair_and_slab("reinforced_wood", "darkage:reinforced_wood",
{snappy=2,choppy=3,oddly_breakable_by_hand=3,flammable=3}, {snappy=2,choppy=3,oddly_breakable_by_hand=3,flammable=3},
{"default_wood.png^darkage_reinforce.png"}, {"default_wood.png^darkage_reinforce.png"},
@ -358,5 +358,5 @@ elseif stairs then
"Reinforced Wood Slab", "Reinforced Wood Slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
end end

View File

@ -115,7 +115,7 @@ if RANDOM_MESSAGES == true then
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player:get_player_name(),"other")}) minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player:get_player_name(),"other")})
sound_play_all(player:get_player_name()) sound_play_all(player:get_player_name())
end) end)
else else
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()

View File

@ -42,7 +42,7 @@ minetest.register_on_dieplayer(function(player)
-- Drop unified_inventory bags and their contents -- Drop unified_inventory bags and their contents
if minetest.get_modpath("unified_inventory") then if minetest.get_modpath("unified_inventory") then
local bag_id = {"bag1", "bag2", "bag3", "bag4"} local bag_id = {"bag1", "bag2", "bag3", "bag4"}
local contents_id = "" local contents_id = ""
local n = 0 local n = 0

View File

@ -60,7 +60,7 @@ minetest.register_node("eventobjects:surprise_node", {
end end
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
end, end,
on_punch = function(pos, node, puncher, pointed_things) on_punch = function(pos, node, puncher, pointed_things)
-- Spawn betweek 5 and 20 random nodes -- Spawn betweek 5 and 20 random nodes

View File

@ -31,14 +31,14 @@ function factions_chat.init()
give_to_singleplayer = true, give_to_singleplayer = true,
} }
) )
minetest.register_privilege("faction_admin", minetest.register_privilege("faction_admin",
{ {
description = "this user is allowed to create or delete factions", description = "this user is allowed to create or delete factions",
give_to_singleplayer = true, give_to_singleplayer = true,
} }
) )
minetest.register_chatcommand("factions", minetest.register_chatcommand("factions",
{ {
params = "<cmd> <parameter 1> .. <parameter n>", params = "<cmd> <parameter 1> .. <parameter n>",
@ -47,7 +47,7 @@ function factions_chat.init()
func = factions_chat.cmdhandler, func = factions_chat.cmdhandler,
} }
) )
minetest.register_chatcommand("af", minetest.register_chatcommand("af",
{ {
params = "text", params = "text",
@ -56,7 +56,7 @@ function factions_chat.init()
func = factions_chat.allfactions_chathandler, func = factions_chat.allfactions_chathandler,
} }
) )
minetest.register_chatcommand("f", minetest.register_chatcommand("f",
{ {
params = "<factionname> text", params = "<factionname> text",
@ -82,13 +82,13 @@ function factions_chat.cmdhandler(playername,parameter)
local player = minetest.get_player_by_name(playername) local player = minetest.get_player_by_name(playername)
local params = parameter:split(" ") local params = parameter:split(" ")
local cmd = params[1] local cmd = params[1]
--handle common commands --handle common commands
if parameter == nil or if parameter == nil or
parameter == "" then parameter == "" then
local playerfactions = factions.get_factions(player) local playerfactions = factions.get_factions(player)
local tosend = "Factions: " .. playername .. " factions:" local tosend = "Factions: " .. playername .. " factions:"
for i,v in ipairs(playerfactions) do for i,v in ipairs(playerfactions) do
if i ~= #playerfactions then if i ~= #playerfactions then
@ -96,33 +96,33 @@ function factions_chat.cmdhandler(playername,parameter)
else else
tosend = tosend .. " " .. v tosend = tosend .. " " .. v
end end
end end
minetest.chat_send_player(playername, tosend, false) minetest.chat_send_player(playername, tosend, false)
return return
end end
--list all known factions --list all known factions
if cmd == "list" then if cmd == "list" then
local list = factions.get_faction_list() local list = factions.get_faction_list()
local tosend = "Factions: current available factions:" local tosend = "Factions: current available factions:"
for i,v in ipairs(list) do for i,v in ipairs(list) do
if i ~= #list then if i ~= #list then
tosend = tosend .. " " .. v .. "," tosend = tosend .. " " .. v .. ","
else else
tosend = tosend .. " " .. v tosend = tosend .. " " .. v
end end
end end
minetest.chat_send_player(playername, tosend, false) minetest.chat_send_player(playername, tosend, false)
return return
end end
--show factions mod version --show factions mod version
if cmd == "version" then if cmd == "version" then
minetest.chat_send_player(playername, "Factions: version " .. factions_version , false) minetest.chat_send_player(playername, "Factions: version " .. factions_version , false)
return return
end end
--show description of faction --show description of faction
if cmd == "info" then if cmd == "info" then
if params[2] ~= nil then if params[2] ~= nil then
@ -132,7 +132,7 @@ function factions_chat.cmdhandler(playername,parameter)
return return
end end
end end
if cmd == "leave" then if cmd == "leave" then
if params[2] ~= nil then if params[2] ~= nil then
if params[3] ~= nil then if params[3] ~= nil then
@ -141,22 +141,22 @@ function factions_chat.cmdhandler(playername,parameter)
if minetest.check_player_privs(playername,{ faction_admin=true }) or if minetest.check_player_privs(playername,{ faction_admin=true }) or
factions.is_admin(params[2],playername) and factions.is_admin(params[2],playername) and
toremove ~= nil then toremove ~= nil then
factions.member_remove(params[2],toremove) factions.member_remove(params[2],toremove)
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: " .. params[3] .. " has been removed from " "Factions: " .. params[3] .. " has been removed from "
.. params[2], false) .. params[2], false)
return return
end end
else else
factions.member_remove(params[2],player) factions.member_remove(params[2],player)
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: You have left " .. params[2], false) "Factions: You have left " .. params[2], false)
return return
end end
end end
end end
--handle superadmin only commands --handle superadmin only commands
if minetest.check_player_privs(playername,{ faction_admin=true }) then if minetest.check_player_privs(playername,{ faction_admin=true }) then
--create new faction --create new faction
@ -176,14 +176,14 @@ function factions_chat.cmdhandler(playername,parameter)
end end
end end
end end
if cmd == "join" then if cmd == "join" then
if params[2] ~= nil then if params[2] ~= nil then
if params[3] ~= nil and if params[3] ~= nil and
minetest.check_player_privs(playername,{ faction_admin=true }) then minetest.check_player_privs(playername,{ faction_admin=true }) then
local toadd = minetest.get_player_by_name(params[3]) local toadd = minetest.get_player_by_name(params[3])
if toadd ~= nil then if toadd ~= nil then
if factions.member_add(params[2],toadd) then if factions.member_add(params[2],toadd) then
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
@ -219,16 +219,16 @@ function factions_chat.cmdhandler(playername,parameter)
"Factions: you are not allowed to join " .. params[2], "Factions: you are not allowed to join " .. params[2],
false) false)
return return
end end
end end
end end
end end
--all following commands require at least two parameters --all following commands require at least two parameters
if params[2] ~= nil then if params[2] ~= nil then
if minetest.check_player_privs(playername,{ faction_admin=true }) or if minetest.check_player_privs(playername,{ faction_admin=true }) or
factions.is_admin(params[2],playername) then factions.is_admin(params[2],playername) then
--delete faction --delete faction
if cmd == "delete" then if cmd == "delete" then
if factions.delete_faction(params[2]) then if factions.delete_faction(params[2]) then
@ -243,19 +243,19 @@ function factions_chat.cmdhandler(playername,parameter)
return return
end end
end end
if cmd == "set_free" then if cmd == "set_free" then
if params[3] ~= nil and if params[3] ~= nil and
(params[3] == "true" or params[3] == "false")then (params[3] == "true" or params[3] == "false")then
local value = false local value = false
if params[3] == "true" then if params[3] == "true" then
value = true value = true
end end
if factions.set_free(params[2],value) then if factions.set_free(params[2],value) then
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: free to join for " .. params[2] .. "Factions: free to join for " .. params[2] ..
" has been set to " .. params[3], " has been set to " .. params[3],
false) false)
else else
@ -266,20 +266,20 @@ function factions_chat.cmdhandler(playername,parameter)
end end
end end
end end
--set player admin status --set player admin status
if cmd == "admin" then if cmd == "admin" then
if params[3] ~= nil and params[4] ~= nil and if params[3] ~= nil and params[4] ~= nil and
(params[4] == "true" or params[4] == "false") then (params[4] == "true" or params[4] == "false") then
local value = false local value = false
if params[4] == "true" then if params[4] == "true" then
value = true value = true
end end
if factions.set_admin(params[2],params[3],value) then if factions.set_admin(params[2],params[3],value) then
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: adminstate of " .. params[3] .. "Factions: adminstate of " .. params[3] ..
" has been set to " .. params[4], " has been set to " .. params[4],
false) false)
else else
@ -291,40 +291,40 @@ function factions_chat.cmdhandler(playername,parameter)
end end
return return
end end
if cmd == "description" and if cmd == "description" and
params[2] ~= nil and params[2] ~= nil and
params[3] ~= nil then params[3] ~= nil then
local desc = params[3] local desc = params[3]
for i=4, #params, 1 do for i=4, #params, 1 do
desc = desc .. " " .. params[i] desc = desc .. " " .. params[i]
end end
if factions.set_description(params[2],desc) then if factions.set_description(params[2],desc) then
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: updated description of faction " .. "Factions: updated description of faction " ..
params[2], params[2],
false) false)
return return
else else
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: FAILED to update description of faction " .. "Factions: FAILED to update description of faction " ..
params[2], params[2],
false) false)
return return
end end
end end
if cmd == "invite" and if cmd == "invite" and
params[2] ~= nil and params[2] ~= nil and
params[3] ~= nil then params[3] ~= nil then
if factions.member_invite(params[2],params[3]) then if factions.member_invite(params[2],params[3]) then
minetest.chat_send_player(params[3], minetest.chat_send_player(params[3],
"Factions: " .. params[3] .. "Factions: " .. params[3] ..
" you have been invited to join faction " .. params[2], " you have been invited to join faction " .. params[2],
false) false)
minetest.chat_send_player(playername, minetest.chat_send_player(playername,
"Factions: " .. params[3] .. "Factions: " .. params[3] ..
" has been invited to join faction " .. params[2], " has been invited to join faction " .. params[2],
false) false)
return return
@ -353,22 +353,22 @@ end
--! @param parameter data supplied to command --! @param parameter data supplied to command
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function factions_chat.allfactions_chathandler(playername,parameter) function factions_chat.allfactions_chathandler(playername,parameter)
local player = minetest.get_player_by_name(playername) local player = minetest.get_player_by_name(playername)
if player ~= nil then if player ~= nil then
local recipients = {} local recipients = {}
for faction,value in pairs(factions.get_factions(player)) do for faction,value in pairs(factions.get_factions(player)) do
for name,value in pairs(factions.dynamic_data.membertable[faction]) do for name,value in pairs(factions.dynamic_data.membertable[faction]) do
local object_to_check = minetest.get_player_by_name(name) local object_to_check = minetest.get_player_by_name(name)
if object_to_check ~= nil then if object_to_check ~= nil then
recipients[name] = true recipients[name] = true
end end
end end
end end
for recipient,value in pairs(recipients) do for recipient,value in pairs(recipients) do
if recipient ~= playername then if recipient ~= playername then
minetest.chat_send_player(recipient,playername ..": " .. parameter,false) minetest.chat_send_player(recipient,playername ..": " .. parameter,false)
@ -390,26 +390,26 @@ end
--! @param parameter data supplied to command --! @param parameter data supplied to command
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function factions_chat.chathandler(playername,parameter) function factions_chat.chathandler(playername,parameter)
local player = minetest.get_player_by_name(playername) local player = minetest.get_player_by_name(playername)
if player ~= nil then if player ~= nil then
local line = parameter:split(" ") local line = parameter:split(" ")
local target_faction = line[1] local target_faction = line[1]
local text = line[2] local text = line[2]
for i=3,#line,1 do for i=3,#line,1 do
text = text .. " " .. line[i] text = text .. " " .. line[i]
end end
local valid_faction = false local valid_faction = false
for faction,value in pairs(factions.get_factions(player)) do for faction,value in pairs(factions.get_factions(player)) do
if target_faction == faction then if target_faction == faction then
valid_faction = true valid_faction = true
end end
end end
if faction ~= nil and valid_faction and if faction ~= nil and valid_faction and
factions.dynamic_data.membertable[faction] ~= nil then factions.dynamic_data.membertable[faction] ~= nil then
for name,value in pairs(factions.dynamic_data.membertable[faction]) do for name,value in pairs(factions.dynamic_data.membertable[faction]) do
@ -443,7 +443,7 @@ function factions_chat.show_help(playername)
local MSG = function(text) local MSG = function(text)
minetest.chat_send_player(playername,text,false) minetest.chat_send_player(playername,text,false)
end end
MSG("Factions mod") MSG("Factions mod")
MSG("Usage:") MSG("Usage:")
MSG("\tUser commands:") MSG("\tUser commands:")
@ -453,7 +453,7 @@ function factions_chat.show_help(playername)
MSG("\t\t/factions leave <factionname> -> leave specified faction") MSG("\t\t/factions leave <factionname> -> leave specified faction")
MSG("\t\t/factions join <factionname> -> join specified faction") MSG("\t\t/factions join <factionname> -> join specified faction")
MSG("\t\t/factions version -> show version number of mod") MSG("\t\t/factions version -> show version number of mod")
MSG("\tAdmin commands:") MSG("\tAdmin commands:")
MSG("\t\t/factions create <factionname> -> create a new faction") MSG("\t\t/factions create <factionname> -> create a new faction")
MSG("\t\t/factions delete <factionname> -> delete a faction faction") MSG("\t\t/factions delete <factionname> -> delete a faction faction")

View File

@ -53,11 +53,11 @@ function factions.add_faction(name)
factions.data.factions[name].base_reputation = {} factions.data.factions[name].base_reputation = {}
factions.data.factions[name].adminlist = {} factions.data.factions[name].adminlist = {}
factions.data.factions[name].invitations = {} factions.data.factions[name].invitations = {}
factions.dynamic_data.membertable[name] = {} factions.dynamic_data.membertable[name] = {}
factions.save() factions.save()
return true return true
end end
@ -81,7 +81,7 @@ function factions.set_base_reputation(faction1,faction2,value)
if factions.data.factions[faction1] ~= nil and if factions.data.factions[faction1] ~= nil and
factions.data.factions[faction2] ~= nil then factions.data.factions[faction2] ~= nil then
factions.data.factions[faction1].base_reputation[faction2] = value factions.data.factions[faction1].base_reputation[faction2] = value
factions.data.factions[faction2].base_reputation[faction1] = value factions.data.factions[faction2].base_reputation[faction1] = value
factions.save() factions.save()
@ -166,13 +166,13 @@ end
--! @return true/false --! @return true/false
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function factions.exists(name) function factions.exists(name)
for key,value in pairs(factions.data.factions) do for key,value in pairs(factions.data.factions) do
if key == name then if key == name then
return true return true
end end
end end
return false return false
end end
@ -188,11 +188,11 @@ end
function factions.get_faction_list() function factions.get_faction_list()
local retval = {} local retval = {}
for key,value in pairs(factions.data.factions) do for key,value in pairs(factions.data.factions) do
table.insert(retval,key) table.insert(retval,key)
end end
return retval return retval
end end
@ -210,9 +210,9 @@ end
function factions.delete_faction(name) function factions.delete_faction(name)
factions.data.factions[name] = nil factions.data.factions[name] = nil
factions.save() factions.save()
if factions.data.factions[name] == nil then if factions.data.factions[name] == nil then
return true return true
end end
@ -235,25 +235,25 @@ end
function factions.member_add(name, object) function factions.member_add(name, object)
local new_entry = {} local new_entry = {}
new_entry.factions = {} new_entry.factions = {}
if object.object ~= nil then if object.object ~= nil then
object = object.object object = object.object
end end
if not factions.exists(name) then if not factions.exists(name) then
print("Unable to add to NON existant faction >" .. name .. "<") print("Unable to add to NON existant faction >" .. name .. "<")
return false return false
end end
new_entry.name,new_entry.temporary = factions.get_name(object) new_entry.name,new_entry.temporary = factions.get_name(object)
factions.dbg_lvl2("Adding name=" .. dump(new_entry.name) .. " to faction: " .. name ) factions.dbg_lvl2("Adding name=" .. dump(new_entry.name) .. " to faction: " .. name )
if new_entry.name ~= nil then if new_entry.name ~= nil then
if factions.data.objects[new_entry.name] == nil then if factions.data.objects[new_entry.name] == nil then
factions.data.objects[new_entry.name] = new_entry factions.data.objects[new_entry.name] = new_entry
end end
if factions.data.objects[new_entry.name].factions[name] == nil then if factions.data.objects[new_entry.name].factions[name] == nil then
factions.data.objects[new_entry.name].factions[name] = true factions.data.objects[new_entry.name].factions[name] = true
factions.dynamic_data.membertable[name][new_entry.name] = true factions.dynamic_data.membertable[name][new_entry.name] = true
@ -262,7 +262,7 @@ function factions.member_add(name, object)
return true return true
end end
end end
--return false if no valid object or already member --return false if no valid object or already member
return false return false
end end
@ -287,7 +287,7 @@ function factions.member_invite(name, playername)
factions.save() factions.save()
return true return true
end end
--return false if not a valid faction or player already invited --return false if not a valid faction or player already invited
return false return false
end end
@ -307,9 +307,9 @@ end
function factions.member_remove(name,object) function factions.member_remove(name,object)
local id,type = factions.get_name(object) local id,type = factions.get_name(object)
factions.dbg_lvl2("removing name=" .. dump(id) .. " to faction: " .. name ) factions.dbg_lvl2("removing name=" .. dump(id) .. " to faction: " .. name )
if id ~= nil and if id ~= nil and
factions.data.objects[id] ~= nil and factions.data.objects[id] ~= nil and
factions.data.objects[id].factions[name] ~= nil then factions.data.objects[id].factions[name] ~= nil then
@ -318,7 +318,7 @@ function factions.member_remove(name,object)
factions.save() factions.save()
return true return true
end end
if id ~= nil and if id ~= nil and
factions.data.factions[name].invitations[id] ~= nil then factions.data.factions[name].invitations[id] ~= nil then
factions.data.factions[name].invitations[id] = nil factions.data.factions[name].invitations[id] = nil
@ -414,7 +414,7 @@ function factions.is_free(name)
factions.data.factions[name].open then factions.data.factions[name].open then
return true return true
end end
return false return false
end end
@ -436,7 +436,7 @@ function factions.is_admin(name,playername)
factions.data.factions[name].adminlist[playername] == true then factions.data.factions[name].adminlist[playername] == true then
return true return true
end end
return false return false
end end
@ -459,7 +459,7 @@ function factions.is_invited(name,playername)
factions.data.factions[name].open == true) then factions.data.factions[name].open == true) then
return true return true
end end
return false return false
end end
@ -477,7 +477,7 @@ end
function factions.get_factions(object) function factions.get_factions(object)
local id,type = factions.get_name(object) local id,type = factions.get_name(object)
local retval = {} local retval = {}
if id ~= nil and if id ~= nil and
factions.data.objects[id] ~= nil then factions.data.objects[id] ~= nil then
@ -485,7 +485,7 @@ function factions.get_factions(object)
table.insert(retval,key) table.insert(retval,key)
end end
end end
return retval return retval
end end
@ -504,7 +504,7 @@ end
function factions.is_member(name,object) function factions.is_member(name,object)
local retval = false local retval = false
local id,type = factions.get_name(object) local id,type = factions.get_name(object)
if id ~= nil and if id ~= nil and
@ -516,7 +516,7 @@ function factions.is_member(name,object)
end end
end end
end end
return retval return retval
end end
@ -536,14 +536,14 @@ end
function factions.get_reputation(name,object) function factions.get_reputation(name,object)
local id,type = factions.get_name(object) local id,type = factions.get_name(object)
factions.dbg_lvl3("get_reputation: " .. name .. "<-->" .. dump(id)) factions.dbg_lvl3("get_reputation: " .. name .. "<-->" .. dump(id))
if id ~= nil and if id ~= nil and
factions.data.factions[name] ~= nil then factions.data.factions[name] ~= nil then
factions.dbg_lvl3("get_reputation: object reputation: " .. dump(factions.data.factions[name].reputation[id])) factions.dbg_lvl3("get_reputation: object reputation: " .. dump(factions.data.factions[name].reputation[id]))
if factions.data.factions[name].reputation[id] == nil then if factions.data.factions[name].reputation[id] == nil then
factions.data.factions[name].reputation[id] factions.data.factions[name].reputation[id]
= factions.calc_base_reputation(name,object) = factions.calc_base_reputation(name,object)
@ -571,21 +571,21 @@ end
--! @return true/false --! @return true/false
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function factions.modify_reputation(name,object,delta) function factions.modify_reputation(name,object,delta)
local id,type = factions.get_name(object) local id,type = factions.get_name(object)
if factions.data.factions[name] ~= nil then if factions.data.factions[name] ~= nil then
if factions.data.factions[name].reputation[id] == nil then if factions.data.factions[name].reputation[id] == nil then
factions.data.factions[name].reputation[id] factions.data.factions[name].reputation[id]
= factions.calc_base_reputation(name,object) = factions.calc_base_reputation(name,object)
end end
factions.data.factions[name].reputation[id] factions.data.factions[name].reputation[id]
= factions.data.factions[name].reputation[id] + delta = factions.data.factions[name].reputation[id] + delta
factions.save() factions.save()
return true return true
end end
return false return false
end end
@ -604,21 +604,21 @@ function factions.get_name(object)
if object == nil then if object == nil then
return nil,true return nil,true
end end
if object.object ~= nil then if object.object ~= nil then
object = object.object object = object.object
end end
if object:is_player() then if object:is_player() then
return object:get_player_name(),false return object:get_player_name(),false
else else
local luaentity = object:get_luaentity() local luaentity = object:get_luaentity()
if luaentity ~= nil then if luaentity ~= nil then
return tostring(luaentity),true return tostring(luaentity),true
end end
end end
return nil,true return nil,true
end end
@ -639,9 +639,9 @@ function factions.calc_base_reputation(name,object)
--calculate initial reputation based uppon all groups --calculate initial reputation based uppon all groups
local object_factions = factions.get_factions(object) local object_factions = factions.get_factions(object)
local rep_value = 0 local rep_value = 0
factions.dbg_lvl3("calc_base_reputation: " .. name .. " <--> " .. tostring(object)) factions.dbg_lvl3("calc_base_reputation: " .. name .. " <--> " .. tostring(object))
if object_factions ~= nil then if object_factions ~= nil then
factions.dbg_lvl3("calc_base_reputation: " .. tostring(object) .. " is in " .. #object_factions .. " factions") factions.dbg_lvl3("calc_base_reputation: " .. tostring(object) .. " is in " .. #object_factions .. " factions")
for k,v in pairs(object_factions) do for k,v in pairs(object_factions) do
@ -655,10 +655,10 @@ function factions.calc_base_reputation(name,object)
end end
end end
end end
rep_value = rep_value / #object_factions rep_value = rep_value / #object_factions
end end
return rep_value return rep_value
end end
@ -675,16 +675,16 @@ function factions.save()
--due to figuring out which data to save and which is temporary only --due to figuring out which data to save and which is temporary only
--all data is saved here --all data is saved here
--this implies data needs to be cleant up on load --this implies data needs to be cleant up on load
local file,error = io.open(factions_worldid .. "/" .. "factions.conf","w") local file,error = io.open(factions_worldid .. "/" .. "factions.conf","w")
if file ~= nil then if file ~= nil then
file:write(minetest.serialize(factions.data)) file:write(minetest.serialize(factions.data))
file:close() file:close()
else else
minetest.log("error","MOD factions: unable to save factions world specific data!: " .. error) minetest.log("error","MOD factions: unable to save factions world specific data!: " .. error)
end end
end end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -698,23 +698,23 @@ end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function factions.load() function factions.load()
local file,error = io.open(factions_worldid .. "/" .. "factions.conf","r") local file,error = io.open(factions_worldid .. "/" .. "factions.conf","r")
if file ~= nil then if file ~= nil then
local raw_data = file:read("*a") local raw_data = file:read("*a")
file:close() file:close()
if raw_data ~= nil and if raw_data ~= nil and
raw_data ~= "" then raw_data ~= "" then
local raw_table = minetest.deserialize(raw_data) local raw_table = minetest.deserialize(raw_data)
--read object data --read object data
local temp_objects = {} local temp_objects = {}
if raw_table.objects ~= nil then if raw_table.objects ~= nil then
for key,value in pairs(raw_table.objects) do for key,value in pairs(raw_table.objects) do
if value.temporary == false then if value.temporary == false then
factions.data.objects[key] = value factions.data.objects[key] = value
else else
@ -722,7 +722,7 @@ function factions.load()
end end
end end
end end
if raw_table.factions ~= nil then if raw_table.factions ~= nil then
for key,value in pairs(raw_table.factions) do for key,value in pairs(raw_table.factions) do
factions.data.factions[key] = {} factions.data.factions[key] = {}
@ -730,18 +730,18 @@ function factions.load()
factions.data.factions[key].adminlist = value.adminlist factions.data.factions[key].adminlist = value.adminlist
factions.data.factions[key].open = value.open factions.data.factions[key].open = value.open
factions.data.factions[key].invitations = value.invitations factions.data.factions[key].invitations = value.invitations
factions.data.factions[key].reputation = {} factions.data.factions[key].reputation = {}
for repkey,repvalue in pairs(value.reputation) do for repkey,repvalue in pairs(value.reputation) do
if temp_objects[repkey] == nil then if temp_objects[repkey] == nil then
factions.data.factions[key].reputation[repkey] = repvalue factions.data.factions[key].reputation[repkey] = repvalue
end end
end end
factions.dynamic_data.membertable[key] = {} factions.dynamic_data.membertable[key] = {}
end end
end end
--populate dynamic faction member table --populate dynamic faction member table
for id,object in pairs(factions.data.objects) do for id,object in pairs(factions.data.objects) do
for name,value in pairs(factions.data.objects[id].factions) do for name,value in pairs(factions.data.objects[id].factions) do
@ -753,7 +753,7 @@ function factions.load()
end end
else else
local file,error = io.open(factions_worldid .. "/" .. "factions.conf","w") local file,error = io.open(factions_worldid .. "/" .. "factions.conf","w")
if file ~= nil then if file ~= nil then
file:close() file:close()
else else

View File

@ -24,7 +24,7 @@ end
minetest.log("action","[FailPoints] CooKies baked") minetest.log("action","[FailPoints] CooKies baked")
-- Global callbacks -- Global callbacks
minetest.register_on_shutdown(function() minetest.register_on_shutdown(function()
-- Stocking CooKies -- Stocking CooKies
pntf = io.open(data.oven,"w") pntf = io.open(data.oven,"w")
for i,v in pairs(data.cookies) do for i,v in pairs(data.cookies) do
@ -48,20 +48,20 @@ minetest.register_chatcommand("cookie", {
minetest.chat_send_player(name,"/cookie <subcommand> | <playername>") minetest.chat_send_player(name,"/cookie <subcommand> | <playername>")
minetest.chat_send_player(name,"Available subcommands :") minetest.chat_send_player(name,"Available subcommands :")
minetest.chat_send_player(name," - help : show this help") minetest.chat_send_player(name," - help : show this help")
minetest.chat_send_player(name," - view | view <playername> : View player's CooKies amount") minetest.chat_send_player(name," - view | view <playername> : View player's CooKies amount")
return return
elseif param == "settings" then elseif param == "settings" then
if not minetest.get_player_privs(name)["server"] then if not minetest.get_player_privs(name)["server"] then
minetest.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)") minetest.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)")
return return
end end
minetest.chat_send_player(name,"=== CK_DEBUG_LINES SENT ===") minetest.chat_send_player(name,"=== CK_DEBUG_LINES SENT ===")
print("=== CK_DEBUG_LINES ===") print("=== CK_DEBUG_LINES ===")
local send_admin = function(msg) local send_admin = function(msg)
minetest.chat_send_player(name,msg) minetest.chat_send_player(name,msg)
end end
send_admin("CK File") send_admin("CK File")
if pntf ~= nil then if pntf ~= nil then
send_admin("Found") send_admin("Found")
@ -69,7 +69,7 @@ minetest.register_chatcommand("cookie", {
send_admin("Missing!") send_admin("Missing!")
end end
table.foreach(data,print) table.foreach(data,print)
return return
elseif param == "view" then elseif param == "view" then
if param2 == "" or param2 == nil then if param2 == "" or param2 == nil then
@ -80,14 +80,14 @@ minetest.register_chatcommand("cookie", {
minetest.chat_send_player(name,"-CK- You own "..owncookies.." CooKies.") minetest.chat_send_player(name,"-CK- You own "..owncookies.." CooKies.")
return true return true
end end
if data.cookies[param2] ~= nil and data.cookies[param2] > 0 then if data.cookies[param2] ~= nil and data.cookies[param2] > 0 then
minetest.chat_send_player(name,"-CK- Player "..param2.." owns "..data.cookies[param2].." CooKies.") minetest.chat_send_player(name,"-CK- Player "..param2.." owns "..data.cookies[param2].." CooKies.")
else else
minetest.chat_send_player(name,"-CK- Player "..param2.." doesn't seem to own any CooKie.") minetest.chat_send_player(name,"-CK- Player "..param2.." doesn't seem to own any CooKie.")
end end
else else
-- If not any known command -- If not any known command
if name == param then if name == param then
if minetest.get_player_privs(name)["baker"] == true then if minetest.get_player_privs(name)["baker"] == true then
@ -100,7 +100,7 @@ minetest.register_chatcommand("cookie", {
end end
return false return false
end end
if param == "" then if param == "" then
minetest.chat_send_player(name,"-CK- You failed: Not enough parameters given, type /cookie help for help") minetest.chat_send_player(name,"-CK- You failed: Not enough parameters given, type /cookie help for help")
return false return false
@ -110,7 +110,7 @@ minetest.register_chatcommand("cookie", {
minetest.chat_send_player(name,"-CK- You failed: Sorry, "..param.." isn't online.") minetest.chat_send_player(name,"-CK- You failed: Sorry, "..param.." isn't online.")
return false return false
end end
-- Take, or not, cookies from name's account to give them to param -- Take, or not, cookies from name's account to give them to param
if minetest.get_player_privs(name)["baker"] ~= true then if minetest.get_player_privs(name)["baker"] ~= true then
if data.cookies[name] == nil or data.failpoints[name] == 0 then if data.cookies[name] == nil or data.failpoints[name] == 0 then
@ -122,14 +122,14 @@ minetest.register_chatcommand("cookie", {
else else
minetest.log("action","[FailPoints] "..name.." has baked a CooKie.") minetest.log("action","[FailPoints] "..name.." has baked a CooKie.")
end end
-- Give/Add the CooKie to param' account -- Give/Add the CooKie to param' account
if data.cookies[param] == nil then if data.cookies[param] == nil then
data.cookies[param] = 1 data.cookies[param] = 1
else else
data.cookies[param] = data.cookies[param]+1 data.cookies[param] = data.cookies[param]+1
end end
minetest.log("action","[FailPoints] "..name.." has given a CooKie to "..param) minetest.log("action","[FailPoints] "..name.." has given a CooKie to "..param)
minetest.log("action","[FailPoints] "..param.." now own "..data.cookies[param].."CKs") minetest.log("action","[FailPoints] "..param.." now own "..data.cookies[param].."CKs")
minetest.log("action","[FailPoints] "..name.." now own "..(data.cookies[name] or 0).."CKs") minetest.log("action","[FailPoints] "..name.." now own "..(data.cookies[name] or 0).."CKs")

View File

@ -1,6 +1,6 @@
-- Fails mod By Mg <mg[dot]minetest[at]gmail[dot]com> -- Fails mod By Mg <mg[dot]minetest[at]gmail[dot]com>
--[[ --[[
/-----\-\ /-----\-\
/ /--] \-\ / /--] \-\
| |-] |-| | |-] |-|
@ -48,7 +48,7 @@ end
data.is_player_available = minetest.get_player_by_name data.is_player_available = minetest.get_player_by_name
if data.STRICT_PLAYER_CHECK == false then if data.STRICT_PLAYER_CHECK == false then
data.is_player_available = function (name) data.is_player_available = function (name)
return (io.open(minetest.get_worldpath().."/players/"..name) ~= nil) return (io.open(minetest.get_worldpath().."/players/"..name) ~= nil)
end end
@ -68,7 +68,7 @@ end
minetest.log("action","[FailPoints] Loaded") minetest.log("action","[FailPoints] Loaded")
-- Global callbacks -- Global callbacks
minetest.register_on_shutdown(function() minetest.register_on_shutdown(function()
-- Saving failpoints -- Saving failpoints
pntf = io.open(data.fp_file,"w") pntf = io.open(data.fp_file,"w")
for i,v in pairs(data.failpoints) do for i,v in pairs(data.failpoints) do
@ -96,20 +96,20 @@ minetest.register_chatcommand("fail", {
minetest.chat_send_player(name,"Available subcommands :") minetest.chat_send_player(name,"Available subcommands :")
minetest.chat_send_player(name," - help : show this help") minetest.chat_send_player(name," - help : show this help")
minetest.chat_send_player(name," - version : show actual fail version") minetest.chat_send_player(name," - version : show actual fail version")
minetest.chat_send_player(name," - view | view <playername> : View player's failpoints amount") minetest.chat_send_player(name," - view | view <playername> : View player's failpoints amount")
return return
elseif param == "settings" then elseif param == "settings" then
if not minetest.get_player_privs(name)["server"] then if not minetest.get_player_privs(name)["server"] then
minetest.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)") minetest.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)")
return return
end end
minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===") minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===")
print("=== FP_DEBUG_LINES ===") print("=== FP_DEBUG_LINES ===")
local send_admin = function(msg) local send_admin = function(msg)
minetest.chat_send_player(name,msg) minetest.chat_send_player(name,msg)
end end
send_admin("FP File") send_admin("FP File")
if pntf ~= nil then if pntf ~= nil then
send_admin("Found") send_admin("Found")
@ -117,7 +117,7 @@ minetest.register_chatcommand("fail", {
send_admin("Missing!") send_admin("Missing!")
end end
table.foreach(data,print) table.foreach(data,print)
return return
elseif param == "view" then elseif param == "view" then
if param2 == "" or param2 == nil then if param2 == "" or param2 == nil then
@ -128,14 +128,14 @@ minetest.register_chatcommand("fail", {
minetest.chat_send_player(name,"-FP- You own "..ownfail.." FailPoints.") minetest.chat_send_player(name,"-FP- You own "..ownfail.." FailPoints.")
return true return true
end end
if data.failpoints[param2] ~= nil and data.failpoints[param2] > 0 then if data.failpoints[param2] ~= nil and data.failpoints[param2] > 0 then
minetest.chat_send_player(name,"-FP- Player "..param2.." owns "..data.failpoints[param2].." FailPoints.") minetest.chat_send_player(name,"-FP- Player "..param2.." owns "..data.failpoints[param2].." FailPoints.")
else else
minetest.chat_send_player(name,"-FP- Player "..param2.." doesn't seem to own any FailPoint.") minetest.chat_send_player(name,"-FP- Player "..param2.." doesn't seem to own any FailPoint.")
end end
else else
-- If not any known command -- If not any known command
if name == param then if name == param then
if minetest.get_player_privs(name)["fp_create"] == true then if minetest.get_player_privs(name)["fp_create"] == true then
@ -148,7 +148,7 @@ minetest.register_chatcommand("fail", {
end end
return false return false
end end
if param == "" then if param == "" then
minetest.chat_send_player(name,"-FP- You failed: Not enough parameters given, type /fail help for help") minetest.chat_send_player(name,"-FP- You failed: Not enough parameters given, type /fail help for help")
return false return false
@ -158,7 +158,7 @@ minetest.register_chatcommand("fail", {
minetest.chat_send_player(name,"-FP- You failed: Sorry, "..param.." isn't online.") minetest.chat_send_player(name,"-FP- You failed: Sorry, "..param.." isn't online.")
return false return false
end end
-- Take, or not, failpoints from name's account to give them to param -- Take, or not, failpoints from name's account to give them to param
if minetest.get_player_privs(name)["fp_create"] ~= true then if minetest.get_player_privs(name)["fp_create"] ~= true then
if data.failpoints[name] == nil or data.failpoints[name] == 0 then if data.failpoints[name] == nil or data.failpoints[name] == 0 then
@ -170,14 +170,14 @@ minetest.register_chatcommand("fail", {
else else
minetest.log("action","[FailPoints] "..name.." has created a FailPoint.") minetest.log("action","[FailPoints] "..name.." has created a FailPoint.")
end end
-- Give/Add the failpoint to param' account -- Give/Add the failpoint to param' account
if data.failpoints[param] == nil then if data.failpoints[param] == nil then
data.failpoints[param] = 1 data.failpoints[param] = 1
else else
data.failpoints[param] = data.failpoints[param]+1 data.failpoints[param] = data.failpoints[param]+1
end end
minetest.log("action","[FailPoints] "..name.." has given a failpoint to "..param) minetest.log("action","[FailPoints] "..name.." has given a failpoint to "..param)
minetest.log("action","[FailPoints] "..param.." now own "..data.failpoints[param].."FPs") minetest.log("action","[FailPoints] "..param.." now own "..data.failpoints[param].."FPs")
minetest.log("action","[FailPoints] "..name.." now own "..(data.failpoints[name] or 0).."FPs") minetest.log("action","[FailPoints] "..name.." now own "..(data.failpoints[name] or 0).."FPs")

View File

@ -8,9 +8,9 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
if not pt and pt.type ~= "node" then if not pt and pt.type ~= "node" then
return return
end end
local under = minetest.get_node(pt.under) local under = minetest.get_node(pt.under)
-- return if any of the nodes is not registered -- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then if not minetest.registered_nodes[under.name] then
return return
@ -20,7 +20,7 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
if under.name ~= "default:jungletree" then if under.name ~= "default:jungletree" then
return return
end end
-- add the node and remove 1 item from the itemstack -- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname}) minetest.add_node(pt.above, {name=plantname})
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
@ -144,7 +144,7 @@ minetest.register_abm({
elseif dir == 4 then pos.z = pos.z -1 elseif dir == 4 then pos.z = pos.z -1
else return else return
end end
if minetest.get_node(pos).name == "air" and minetest.get_node_light(pos) > 12 then if minetest.get_node(pos).name == "air" and minetest.get_node_light(pos) > 12 then
-- print ("COCOA", pos.x, pos.y, pos.z) -- print ("COCOA", pos.x, pos.y, pos.z)
minetest.set_node(pos,{name="farming:cocoa_"..tostring(math.random(1,3))}) minetest.set_node(pos,{name="farming:cocoa_"..tostring(math.random(1,3))})

View File

@ -28,7 +28,7 @@ minetest.register_craft({
--= Ethanol (Thanks to JKMurray for this idea) --= Ethanol (Thanks to JKMurray for this idea)
minetest.register_craftitem("farming:bottle_ethanol", { minetest.register_craftitem("farming:bottle_ethanol", {
description = "Bottle of Ethanol", description = "Bottle of Ethanol",
inventory_image = "farming_bottle_ethanol.png", inventory_image = "farming_bottle_ethanol.png",
}) })

View File

@ -66,7 +66,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
if not pt or pt.type ~= "node" then if not pt or pt.type ~= "node" then
return return
end end
local under = minetest.get_node(pt.under) local under = minetest.get_node(pt.under)
local upos = pointed_thing.under local upos = pointed_thing.under
@ -77,23 +77,23 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local above = minetest.get_node(p) local above = minetest.get_node(p)
-- return if any of the nodes is not registered -- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] if not minetest.registered_nodes[under.name]
or not minetest.registered_nodes[above.name] then or not minetest.registered_nodes[above.name] then
return return
end end
-- check if the node above the pointed thing is air -- check if the node above the pointed thing is air
if above.name ~= "air" then if above.name ~= "air" then
return return
end end
-- check if pointing at dirt -- check if pointing at dirt
if minetest.get_item_group(under.name, "soil") ~= 1 then if minetest.get_item_group(under.name, "soil") ~= 1 then
return return
end end
-- turn the node into soil, wear out item and play sound -- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name="farming:soil"}) minetest.set_node(pt.under, {name="farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,}) minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,})

View File

@ -404,7 +404,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
-- can I replace above node, and am I pointing at soil -- can I replace above node, and am I pointing at soil
if not minetest.registered_nodes[above.name].buildable_to if not minetest.registered_nodes[above.name].buildable_to
or minetest.get_item_group(under.name, "soil") < 2 or minetest.get_item_group(under.name, "soil") < 2
or minetest.get_item_group(above.name, "plant") ~= 0 then -- ADDED this line for multiple seed placement bug or minetest.get_item_group(above.name, "plant") ~= 0 then -- ADDED this line for multiple seed placement bug
return return
end end
@ -471,7 +471,7 @@ farming.register_plant = function(name, def)
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2}, {items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2},
} }
} }
local g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, growing = 1} local g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, growing = 1}
-- Last step doesn't need growing=1 so Abm never has to check these -- Last step doesn't need growing=1 so Abm never has to check these
if i == def.steps then if i == def.steps then

View File

@ -48,15 +48,15 @@ local function find_dock(pos, second)
local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2} local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2}
if second > 0 then if second > 0 then
local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2} local tmp_node = {name=tmp_name, param1=me.param1, param2=me.param2}
minetest.set_node(pos, tmp_node) minetest.set_node(pos, tmp_node)
end end
elseif code == 0 then elseif code == 0 then
if second == 2 then if second == 2 then
local tmp_node = {name="fences:fence_wood", param1=me.param1, param2=me.param2} local tmp_node = {name="fences:fence_wood", param1=me.param1, param2=me.param2}
minetest.set_node(pos, tmp_node) minetest.set_node(pos, tmp_node)
end end
end end
end end
local function punch(pos, puncher) local function punch(pos, puncher)
@ -576,7 +576,7 @@ minetest.register_craft({
local meta2 local meta2
local state2 = 0 local state2 = 0
local function update_gate(pos, node) local function update_gate(pos, node)
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end

View File

@ -39,17 +39,17 @@ minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed") -- exception
local PLaNTS = { local PLaNTS = {
-- MoD* iTeM MeSSaGe ("You caught "..) -- MoD* iTeM MeSSaGe ("You caught "..)
{"flowers", "waterlily", "a Waterlily." }, {"flowers", "waterlily", "a Waterlily." },
{"flowers", "waterlily_225", "a Waterlily." }, {"flowers", "waterlily_225", "a Waterlily." },
{"flowers", "waterlily_45", "a Waterlily." }, {"flowers", "waterlily_45", "a Waterlily." },
{"flowers", "waterlily_675", "a Waterlily." }, {"flowers", "waterlily_675", "a Waterlily." },
{"flowers", "waterlily_s1", "a Waterlily." }, {"flowers", "waterlily_s1", "a Waterlily." },
{"flowers", "waterlily_s2", "a Waterlily." }, {"flowers", "waterlily_s2", "a Waterlily." },
{"flowers", "waterlily_s3", "a Waterlily." }, {"flowers", "waterlily_s3", "a Waterlily." },
{"flowers", "waterlily_s4", "a Waterlily." }, {"flowers", "waterlily_s4", "a Waterlily." },
{"flowers", "seaweed", "some Seaweed."}, {"flowers", "seaweed", "some Seaweed."},
{"flowers", "seaweed_2", "some Seaweed."}, {"flowers", "seaweed_2", "some Seaweed."},
{"flowers", "seaweed_3", "some Seaweed."}, {"flowers", "seaweed_3", "some Seaweed."},
{"flowers", "seaweed_4", "some Seaweed."}, {"flowers", "seaweed_4", "some Seaweed."},
{"trunks", "twig_1", "a Twig." }, {"trunks", "twig_1", "a Twig." },
{"trunks", "twig_2", "a Twig." }, {"trunks", "twig_2", "a Twig." },
@ -89,7 +89,7 @@ minetest.register_node("fishing:bobber_box", {
"fishing_bobber.png", "fishing_bobber.png",
"fishing_bobber.png", "fishing_bobber.png",
"fishing_bobber.png^[transformFX" "fishing_bobber.png^[transformFX"
}, -- }, --
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
}) })
@ -123,7 +123,7 @@ local FISHING_BOBBER_ENTITY={
}) })
self.object:remove() self.object:remove()
end, end,
-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE) -- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)
on_rightclick = function (self, clicker) on_rightclick = function (self, clicker)
local item = clicker:get_wielded_item() local item = clicker:get_wielded_item()
local player = clicker:get_player_name() local player = clicker:get_player_name()
@ -141,7 +141,7 @@ local FISHING_BOBBER_ENTITY={
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"}) minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then
inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""}) inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""})
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
@ -176,13 +176,13 @@ local FISHING_BOBBER_ENTITY={
iTeM = "fish_blue_white" iTeM = "fish_blue_white"
WeaR = 0 WeaR = 0
MeSSaGe = S("a Blue white fish.") MeSSaGe = S("a Blue white fish.")
obj:remove() obj:remove()
end end
end end
-- add (in)visible fish to inventory -- add (in)visible fish to inventory
if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then
inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""})
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin' if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin'
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
if GeTBaiTBack == true then if GeTBaiTBack == true then
@ -211,12 +211,12 @@ local FISHING_BOBBER_ENTITY={
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
end end
end end
end end
end end
end end
end end
-- weither player has fishing pole or not -- weither player has fishing pole or not
-- make sound and remove bobber -- make sound and remove bobber
minetest.sound_play("fishing_bobber1", { minetest.sound_play("fishing_bobber1", {
@ -240,7 +240,7 @@ local FISHING_BOBBER_ENTITY={
end end
end end
end end
if math.random(1, 4) == 1 then if math.random(1, 4) == 1 then
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi)) self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
end end
@ -259,9 +259,9 @@ local FISHING_BOBBER_ENTITY={
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,}) minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
self.object:remove() self.object:remove()
end end
if self.object:get_hp() > 310 then if self.object:get_hp() > 310 then
local find_fish = minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 1) local find_fish = minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 1)
for k, obj in pairs(find_fish) do for k, obj in pairs(find_fish) do
@ -274,8 +274,8 @@ local FISHING_BOBBER_ENTITY={
end end
end end
end end
local do_env_damage = function(self) local do_env_damage = function(self)
self.object:set_hp(self.object:get_hp()-self.water_damage) self.object:set_hp(self.object:get_hp()-self.water_damage)
if self.object:get_hp() == 600 then if self.object:get_hp() == 600 then
@ -306,7 +306,7 @@ local FISHING_BOBBER_ENTITY={
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z}) self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
elseif self.object:get_hp() == 285 then elseif self.object:get_hp() == 285 then
self.object:moveto({x=pos.x,y=pos.y-0.1,z=pos.z}) self.object:moveto({x=pos.x,y=pos.y-0.1,z=pos.z})
elseif self.object:get_hp() < 284 then elseif self.object:get_hp() < 284 then
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))}) self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/1440*math.pi)) self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/1440*math.pi))
elseif self.object:get_hp() == 0 then elseif self.object:get_hp() == 0 then

View File

@ -34,17 +34,17 @@ local CaTCH_BiG = {
local PLaNTS = { local PLaNTS = {
-- MoD* iTeM MeSSaGe ("You caught "..) -- MoD* iTeM MeSSaGe ("You caught "..)
{"flowers", "waterlily", "a Waterlily." }, {"flowers", "waterlily", "a Waterlily." },
{"flowers", "waterlily_225", "a Waterlily." }, {"flowers", "waterlily_225", "a Waterlily." },
{"flowers", "waterlily_45", "a Waterlily." }, {"flowers", "waterlily_45", "a Waterlily." },
{"flowers", "waterlily_675", "a Waterlily." }, {"flowers", "waterlily_675", "a Waterlily." },
{"flowers", "waterlily_s1", "a Waterlily." }, {"flowers", "waterlily_s1", "a Waterlily." },
{"flowers", "waterlily_s2", "a Waterlily." }, {"flowers", "waterlily_s2", "a Waterlily." },
{"flowers", "waterlily_s3", "a Waterlily." }, {"flowers", "waterlily_s3", "a Waterlily." },
{"flowers", "waterlily_s4", "a Waterlily." }, {"flowers", "waterlily_s4", "a Waterlily." },
{"flowers", "seaweed", "some Seaweed."}, {"flowers", "seaweed", "some Seaweed."},
{"flowers", "seaweed_2", "some Seaweed."}, {"flowers", "seaweed_2", "some Seaweed."},
{"flowers", "seaweed_3", "some Seaweed."}, {"flowers", "seaweed_3", "some Seaweed."},
{"flowers", "seaweed_4", "some Seaweed."}, {"flowers", "seaweed_4", "some Seaweed."},
{"trunks", "twig_1", "a Twig." }, {"trunks", "twig_1", "a Twig." },
{"trunks", "twig_2", "a Twig." }, {"trunks", "twig_2", "a Twig." },
@ -83,7 +83,7 @@ local FISHING_BOBBER_ENTITY_SHARK={
}) })
self.object:remove() self.object:remove()
end, end,
-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE) -- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)
on_rightclick = function (self, clicker) on_rightclick = function (self, clicker)
local item = clicker:get_wielded_item() local item = clicker:get_wielded_item()
local player = clicker:get_player_name() local player = clicker:get_player_name()
@ -101,7 +101,7 @@ local FISHING_BOBBER_ENTITY_SHARK={
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"}) minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then
inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""}) inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""})
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
@ -129,7 +129,7 @@ local FISHING_BOBBER_ENTITY_SHARK={
if minetest.get_modpath(MoD) ~= nil then if minetest.get_modpath(MoD) ~= nil then
if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then
inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""})
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin' if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin'
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
if GeTBaiTBack == true then if GeTBaiTBack == true then
@ -146,20 +146,20 @@ local FISHING_BOBBER_ENTITY_SHARK={
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
end end
end end
if self.object:get_hp() > 300 and minetest.get_node(pos).name == "air" then if self.object:get_hp() > 300 and minetest.get_node(pos).name == "air" then
if MESSAGES == true then say(player, S("You didn't catch any fish."), false) end -- fish escaped if MESSAGES == true then say(player, S("You didn't catch any fish."), false) end -- fish escaped
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
if math.random(1, 3) == 1 then if math.random(1, 3) == 1 then
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
end end
end end
end end
end end
--end --end
else else
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
end end
minetest.sound_play("fishing_bobber1", { minetest.sound_play("fishing_bobber1", {
pos = self.object:getpos(), pos = self.object:getpos(),
@ -230,7 +230,7 @@ local FISHING_BOBBER_ENTITY_SHARK={
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z}) self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
elseif self.object:get_hp() == 285 then elseif self.object:get_hp() == 285 then
self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z}) self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
elseif self.object:get_hp() < 284 then elseif self.object:get_hp() < 284 then
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))}) self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/720*math.pi)) self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/720*math.pi))
elseif self.object:get_hp() == 0 then elseif self.object:get_hp() == 0 then

View File

@ -14,7 +14,7 @@
-- Wooden Fishing Pole -- Wooden Fishing Pole
minetest.register_craft({ minetest.register_craft({
output = "fishing:pole", output = "fishing:pole",
recipe = { recipe = {
{"", "", "group:stick" }, {"", "", "group:stick" },
{"", "group:stick", "farming:string"}, {"", "group:stick", "farming:string"},
{"group:stick", "", "farming:string"}, {"group:stick", "", "farming:string"},
@ -24,7 +24,7 @@ minetest.register_craft({
if minetest.get_modpath("moreblocks") ~= nil then if minetest.get_modpath("moreblocks") ~= nil then
minetest.register_craft({ minetest.register_craft({
output = "fishing:pole", output = "fishing:pole",
recipe = { recipe = {
{"", "", "group:stick" }, {"", "", "group:stick" },
{"", "group:stick", "moreblocks:rope" }, {"", "group:stick", "moreblocks:rope" },
{"group:stick", "", "moreblocks:rope" }, {"group:stick", "", "moreblocks:rope" },
@ -35,7 +35,7 @@ end
if minetest.get_modpath("ropes") ~= nil then if minetest.get_modpath("ropes") ~= nil then
minetest.register_craft({ minetest.register_craft({
output = "fishing:pole", output = "fishing:pole",
recipe = { recipe = {
{"", "", "group:stick" }, {"", "", "group:stick" },
{"", "group:stick", "ropes:rope" }, {"", "group:stick", "ropes:rope" },
{"group:stick", "", "ropes:rope" }, {"group:stick", "", "ropes:rope" },
@ -47,7 +47,7 @@ end
if minetest.get_modpath("moreores") ~= nil then if minetest.get_modpath("moreores") ~= nil then
minetest.register_craft({ minetest.register_craft({
output = "fishing:pole_perfect", output = "fishing:pole_perfect",
recipe = { recipe = {
{"", "", "moreores:mithril_ingot" }, {"", "", "moreores:mithril_ingot" },
{"", "moreores:mithril_ingot", "mobs:spider_cobweb" }, {"", "moreores:mithril_ingot", "mobs:spider_cobweb" },
{"moreores:mithril_ingot", "", "mobs:spider_cobweb" }, {"moreores:mithril_ingot", "", "mobs:spider_cobweb" },
@ -86,7 +86,7 @@ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "fishing:sushi", output = "fishing:sushi",
recipe = {"fishing:fish_raw", "farming:seed_wheat", "seaplants:kelpgreen" }, recipe = {"fishing:fish_raw", "farming:seed_wheat", "seaplants:kelpgreen" },
}) })
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------

View File

@ -58,7 +58,7 @@ minetest.register_craftitem("fishing:shark", {
inventory_image = "fishing_shark_cooked.png", inventory_image = "fishing_shark_cooked.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
}) })
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- Pike -- Pike
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------

View File

@ -77,10 +77,10 @@ minetest.register_tool("fishing:pole", {
gain = 0.5, gain = 0.5,
}) })
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity") minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity")
if WEAR_OUT == true if WEAR_OUT == true
and not minetest.setting_getbool("creative_mode") then and not minetest.setting_getbool("creative_mode") then
return rod_wear(itemstack, user, pointed_thing, 30) return rod_wear(itemstack, user, pointed_thing, 30)
else else
return {name="fishing:pole", count=1, wear=0, metadata=""} return {name="fishing:pole", count=1, wear=0, metadata=""}
end end
@ -94,10 +94,10 @@ minetest.register_tool("fishing:pole", {
gain = 0.5, gain = 0.5,
}) })
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark") minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark")
if WEAR_OUT == true if WEAR_OUT == true
and not minetest.setting_getbool("creative_mode") then and not minetest.setting_getbool("creative_mode") then
return rod_wear(itemstack, user, pointed_thing, 30) return rod_wear(itemstack, user, pointed_thing, 30)
else else
return {name="fishing:pole", count=1, wear=0, metadata=""} return {name="fishing:pole", count=1, wear=0, metadata=""}
end end
@ -150,10 +150,10 @@ minetest.register_tool("fishing:pole_perfect", {
gain = 0.5, gain = 0.5,
}) })
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity") minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity")
if WEAR_OUT == true if WEAR_OUT == true
and not minetest.setting_getbool("creative_mode") then and not minetest.setting_getbool("creative_mode") then
return rod_wear(itemstack, user, pointed_thing, 1500) return rod_wear(itemstack, user, pointed_thing, 1500)
else else
return {name="fishing:pole_perfect", count=1, wear=0, metadata=""} return {name="fishing:pole_perfect", count=1, wear=0, metadata=""}
end end
@ -167,10 +167,10 @@ minetest.register_tool("fishing:pole_perfect", {
gain = 0.5, gain = 0.5,
}) })
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark") minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark")
if WEAR_OUT == true if WEAR_OUT == true
and not minetest.setting_getbool("creative_mode") then and not minetest.setting_getbool("creative_mode") then
return rod_wear(itemstack, user, pointed_thing, 1500) return rod_wear(itemstack, user, pointed_thing, 1500)
else else
return {name="fishing:pole_perfect", count=1, wear=0, metadata=""} return {name="fishing:pole_perfect", count=1, wear=0, metadata=""}
end end
@ -240,7 +240,7 @@ if SIMPLE_DECO_FISHING_POLE == true then
minetest.remove_node(pos) minetest.remove_node(pos)
end, end,
}) })
--Canne à pêche parfaite deco --Canne à pêche parfaite deco
minetest.register_node("fishing:pole_perfect_deco", { minetest.register_node("fishing:pole_perfect_deco", {
description = S("Perfect Fishing Pole"), description = S("Perfect Fishing Pole"),
@ -348,7 +348,7 @@ else
minetest.remove_node(pos) minetest.remove_node(pos)
end, end,
}) })
--Canne à pêche parfaite deco --Canne à pêche parfaite deco
minetest.register_node("fishing:pole_perfect_deco", { minetest.register_node("fishing:pole_perfect_deco", {
description = S("Perfect Fishing Pole"), description = S("Perfect Fishing Pole"),
@ -455,11 +455,11 @@ else
if pt.type ~= "node" then if pt.type ~= "node" then
return return
end end
local under = minetest.get_node(pt.under) local under = minetest.get_node(pt.under)
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local above = minetest.get_node(p) local above = minetest.get_node(p)
-- return if any of the nodes is not registered -- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then if not minetest.registered_nodes[under.name] then
return return
@ -467,24 +467,24 @@ else
if not minetest.registered_nodes[above.name] then if not minetest.registered_nodes[above.name] then
return return
end end
-- check if the node above the pointed thing is air -- check if the node above the pointed thing is air
if above.name ~= "air" then if above.name ~= "air" then
return return
end end
-- check if pointing at dirt -- check if pointing at dirt
if minetest.get_item_group(under.name, "soil") ~= 1 then if minetest.get_item_group(under.name, "soil") ~= 1 then
return return
end end
-- turn the node into soil, play sound, get worm and wear out item -- turn the node into soil, play sound, get worm and wear out item
minetest.set_node(pt.under, {name="farming:soil"}) minetest.set_node(pt.under, {name="farming:soil"})
minetest.sound_play("default_dig_crumbly", { minetest.sound_play("default_dig_crumbly", {
pos = pt.under, pos = pt.under,
gain = 0.5, gain = 0.5,
}) })
if math.random(1, 100) < WORM_CHANCE then if math.random(1, 100) < WORM_CHANCE then
if WORM_IS_MOB == true then if WORM_IS_MOB == true then
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity") minetest.add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")

View File

@ -80,11 +80,11 @@ for i in pairs(TRoPHY) do
return has_trophy_privilege(meta, player) return has_trophy_privilege(meta, player)
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "fishing:trophy_"..iTeM, output = "fishing:trophy_"..iTeM,
recipe = {MoD..":"..iTeM, "default:sign_wall"}, recipe = {MoD..":"..iTeM, "default:sign_wall"},
}) })
end end

View File

@ -69,16 +69,16 @@ minetest.register_entity("fishing:bait_worm_entity", {
if n.name == "air" then -- fall when in air if n.name == "air" then -- fall when in air
self.object:moveto({x=pos.x,y=pos.y-0.5,z=pos.z}) self.object:moveto({x=pos.x,y=pos.y-0.5,z=pos.z})
self.object:set_hp(self.object:get_hp()-75) self.object:set_hp(self.object:get_hp()-75)
--if n.name == "snappy" then -- fall when leaves or similar --if n.name == "snappy" then -- fall when leaves or similar
elseif minetest.get_item_group(n.name, "snappy") ~= 0 then elseif minetest.get_item_group(n.name, "snappy") ~= 0 then
self.object:moveto({x=pos.x+(0.001*(math.random(-32, 32))),y=pos.y-(0.001*(math.random(0, 64))),z=pos.z+(0.001*(math.random(-32, 32)))}) self.object:moveto({x=pos.x+(0.001*(math.random(-32, 32))),y=pos.y-(0.001*(math.random(0, 64))),z=pos.z+(0.001*(math.random(-32, 32)))})
elseif string.find(n.name, "default:water") then -- sink when in water elseif string.find(n.name, "default:water") then -- sink when in water
self.object:moveto({x=pos.x,y=pos.y-0.25,z=pos.z}) self.object:moveto({x=pos.x,y=pos.y-0.25,z=pos.z})
self.object:set_hp(self.object:get_hp()-37) self.object:set_hp(self.object:get_hp()-37)
elseif minetest.get_item_group(n.name, "soil") ~= 0 then elseif minetest.get_item_group(n.name, "soil") ~= 0 then
if minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then if minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then
self.object:set_hp(199) self.object:set_hp(199)
@ -95,24 +95,24 @@ minetest.register_entity("fishing:bait_worm_entity", {
local goal_02 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil") local goal_02 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil")
local goal_03 = check_group(minetest.get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil") local goal_03 = check_group(minetest.get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil")
local goal_04 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil") local goal_04 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil")
local goal_1a = check_group(minetest.get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil") local goal_1a = check_group(minetest.get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil")
local goal_2a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil") local goal_2a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil")
local goal_3a = check_group(minetest.get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil") local goal_3a = check_group(minetest.get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil")
local goal_4a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil") local goal_4a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil")
-- if there's dirt nearby, go there -- if there's dirt nearby, go there
if goal_01 ~= 0 or goal_1a ~= 0 then if goal_01 ~= 0 or goal_1a ~= 0 then
self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))}) self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
elseif goal_02 ~= 0 or goal_2a ~= 0 then elseif goal_02 ~= 0 or goal_2a ~= 0 then
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z+0.002}) self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z+0.002})
elseif goal_03 ~= 0 or goal_3a ~= 0 then elseif goal_03 ~= 0 or goal_3a ~= 0 then
self.object:moveto({x=pos.x-0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))}) self.object:moveto({x=pos.x-0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
elseif goal_04 ~= 0 or goal_4a ~= 0 then elseif goal_04 ~= 0 or goal_4a ~= 0 then
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z-0.002}) self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z-0.002})
else -- I'm lost, no dirt else -- I'm lost, no dirt
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))}) self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
end end
end end
end end
look_whats_up(self) look_whats_up(self)
end, end,

View File

@ -24,7 +24,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
end end
end end
for i = 1, #blocks do for i = 1, #blocks do
if not minetest.forceload_block(blocks[i]) then if not minetest.forceload_block(blocks[i]) then
minetest.log("error", "Failed to load block " .. minetest.pos_to_string(blocks[i])) minetest.log("error", "Failed to load block " .. minetest.pos_to_string(blocks[i]))
end end
end end
@ -40,7 +40,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
end, end,
unload = function(self, pos) unload = function(self, pos)
for i = 1, #self._blocks do for i = 1, #self._blocks do
if vector.equals(pos, self._blocks[i]) then if vector.equals(pos, self._blocks[i]) then
minetest.forceload_free_block(pos) minetest.forceload_free_block(pos)
table.remove(self._blocks, i) table.remove(self._blocks, i)
return true return true
@ -56,16 +56,16 @@ function ForceloadManager(filetoopen, hide_file_errors)
end end
end, end,
verify = function(self) verify = function(self)
return self:verify_each(function(pos, block) return self:verify_each(function(pos, block)
local name = "ignore" local name = "ignore"
if block ~= nil then if block ~= nil then
name = block.name name = block.name
end end
if name == "ignore" then if name == "ignore" then
if not pos.last or elapsed_time > pos.last + 15 then if not pos.last or elapsed_time > pos.last + 15 then
pos.last = elapsed_time pos.last = elapsed_time
if not minetest.forceload_block(pos) then if not minetest.forceload_block(pos) then
minetest.log("error", "Failed to force load " .. minetest.pos_to_string(pos)) minetest.log("error", "Failed to force load " .. minetest.pos_to_string(pos))
pos.remove = true pos.remove = true
end end
@ -74,15 +74,15 @@ function ForceloadManager(filetoopen, hide_file_errors)
elseif name == "forceload:anchor" then elseif name == "forceload:anchor" then
pos.last = elapsed_time pos.last = elapsed_time
return true return true
else else
minetest.log("error", minetest.pos_to_string(pos) .. " shouldn't be loaded") minetest.log("error", minetest.pos_to_string(pos) .. " shouldn't be loaded")
pos.remove = true pos.remove = true
return false return false
end end
end) end)
end, end,
verify_each = function(self, func) verify_each = function(self, func)
local not_loaded = {} local not_loaded = {}
for i = 1, #self._blocks do for i = 1, #self._blocks do
local res = minetest.get_node(self._blocks[i]) local res = minetest.get_node(self._blocks[i])
if not func(self._blocks[i], res) then if not func(self._blocks[i], res) then
@ -125,10 +125,10 @@ minetest.register_node("forceload:anchor",{
if not minetest.check_player_privs(placer:get_player_name(), if not minetest.check_player_privs(placer:get_player_name(),
{forceload = true}) then {forceload = true}) then
minetest.chat_send_player(placer:get_player_name(), "The forceload privilege is required to do that.") minetest.chat_send_player(placer:get_player_name(), "The forceload privilege is required to do that.")
elseif flm:load(pos) then elseif flm:load(pos) then
flm:save(minetest.get_worldpath().."/flm.json") flm:save(minetest.get_worldpath().."/flm.json")
return return
end end
minetest.set_node(pos, {name="air"}) minetest.set_node(pos, {name="air"})
return true return true
end end

View File

@ -87,7 +87,7 @@ function add_coloured_framedglass(name, desc, dye)
use_texture_alpha = true, use_texture_alpha = true,
groups = {cracky=3}, groups = {cracky=3},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",

View File

@ -12,7 +12,7 @@ local hp_bar = {
function hp_bar:on_step(dtime) function hp_bar:on_step(dtime)
local wielder = self.wielder local wielder = self.wielder
if wielder == nil then if wielder == nil then
self.object:remove() self.object:remove()
return return
elseif minetest.get_player_by_name(wielder:get_player_name()) == nil then elseif minetest.get_player_by_name(wielder:get_player_name()) == nil then

View File

@ -572,14 +572,14 @@ minetest.register_craft({
} }
}) })
if not minetest.get_modpath("technic") then if not minetest.get_modpath("technic") then
minetest.register_node( ":technic:granite", { minetest.register_node( ":technic:granite", {
description = "Granite", description = "Granite",
tiles = { "technic_granite.png" }, tiles = { "technic_granite.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1}, groups = {cracky=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_craft({ minetest.register_craft({
output = "technic:granite 9", output = "technic:granite 9",

View File

@ -1,6 +1,6 @@
local shapes = { local shapes = {
{ { x = {0, 1, 0, 1}, y = {0, 0, 1, 1} } }, { { x = {0, 1, 0, 1}, y = {0, 0, 1, 1} } },
{ { x = {1, 1, 1, 1}, y = {0, 1, 2, 3} }, { { x = {1, 1, 1, 1}, y = {0, 1, 2, 3} },
{ x = {0, 1, 2, 3}, y = {1, 1, 1, 1} } }, { x = {0, 1, 2, 3}, y = {1, 1, 1, 1} } },
@ -70,7 +70,7 @@ end
local function step(pos, fields) local function step(pos, fields)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local t = minetest.deserialize(meta:get_string("tetris")) local t = minetest.deserialize(meta:get_string("tetris"))
local function new_game(pos) local function new_game(pos)
local nex = math.random(7) local nex = math.random(7)
@ -81,7 +81,7 @@ local function step(pos, fields)
score = 0, score = 0,
cur = math.random(7), cur = math.random(7),
nex = nex, nex = nex,
x=4, y=0, rot=1 x=4, y=0, rot=1
} }
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
@ -99,7 +99,7 @@ local function step(pos, fields)
i*sizey+boardy, semi, i*sizey+boardy, semi,
size, comma, size, semi, size, comma, size, semi,
colors[tile[2]], close } colors[tile[2]], close }
ins = ins + 1 ins = ins + 1
scr[ins] = concat(tmp) scr[ins] = concat(tmp)
end end
@ -138,9 +138,9 @@ local function step(pos, fields)
for i=1,4 do for i=1,4 do
local cx, cy = d.x[i]+x, d.y[i]+y local cx, cy = d.x[i]+x, d.y[i]+y
if cx < 0 or cx > 9 or cy < 0 or cy > 19 then if cx < 0 or cx > 9 or cy < 0 or cy > 19 then
return false return false
end end
for _, tile in pairs(t.board[ cy ] or {}) do for _, tile in pairs(t.board[ cy ] or {}) do
@ -157,7 +157,7 @@ local function step(pos, fields)
end end
local function tick() local function tick()
if stuck() then if stuck() then
if t.y <= 0 then if t.y <= 0 then
return false end return false end
add() add()
@ -170,7 +170,7 @@ local function step(pos, fields)
t.y = t.y + 1 t.y = t.y + 1
end end
return true return true
end end
local function move(dx, dy) local function move(dx, dy)
local newx, newy = t.x+dx, t.y+dy local newx, newy = t.x+dx, t.y+dy
@ -225,10 +225,10 @@ local function step(pos, fields)
end end
if t then if t then
local scr = { formsize, background, local scr = { formsize, background,
t.boardstring, t.previewstring, t.boardstring, t.previewstring,
draw_shape(t.cur, t.x, t.y, t.rot, boardx, boardy), draw_shape(t.cur, t.x, t.y, t.rot, boardx, boardy),
"label[3.8,0.1;Next...]label[3.8,2.7;Score: ", "label[3.8,0.1;Next...]label[3.8,2.7;Score: ",
t.score, close, buttons } t.score, close, buttons }

View File

@ -37,7 +37,7 @@ local function start_smoke(pos, node, clicker, chimney)
s_handle = minetest.sound_play("fire_small", { s_handle = minetest.sound_play("fire_small", {
pos = pos, pos = pos,
max_hear_distance = 5, max_hear_distance = 5,
loop = true loop = true
}) })
this_spawner_meta:set_int("smoky", id) this_spawner_meta:set_int("smoky", id)
this_spawner_meta:set_int("sound", s_handle) this_spawner_meta:set_int("sound", s_handle)
@ -81,7 +81,7 @@ for _, f in ipairs(flame_types) do
light_source = 14, light_source = 14,
waving = 1, waving = 1,
tiles = { tiles = {
{name=f.."_fire_animated.png", animation={type="vertical_frames", {name=f.."_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}}, aspect_w=16, aspect_h=16, length=1.5}},
}, },
on_rightclick = function (pos, node, clicker) on_rightclick = function (pos, node, clicker)
@ -111,7 +111,7 @@ minetest.register_node("fake_fire:fancy_fire", {
damage_per_second = 4, damage_per_second = 4,
on_rotate = screwdriver.rotate_simple, on_rotate = screwdriver.rotate_simple,
tiles = { tiles = {
{name="fake_fire_animated.png", {name="fake_fire_animated.png",
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}}, animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}},
on_rightclick = function (pos, node, clicker) on_rightclick = function (pos, node, clicker)
start_smoke(pos, node, clicker) start_smoke(pos, node, clicker)
@ -169,7 +169,7 @@ for _, m in ipairs(materials) do
stop_smoke(pos) stop_smoke(pos)
end end
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = 'fake_fire:chimney_top_'..m, output = 'fake_fire:chimney_top_'..m,

View File

@ -7,7 +7,7 @@ local toilet_sbox = {
local toilet_cbox = { local toilet_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-6/16, -8/16, -8/16, 6/16, 1/16, 8/16 }, {-6/16, -8/16, -8/16, 6/16, 1/16, 8/16 },
{-6/16, -8/16, 4/16, 6/16, 9/16, 8/16 } {-6/16, -8/16, 4/16, 6/16, 9/16, 8/16 }
} }

View File

@ -19,7 +19,7 @@ local bed_sbox = {
local bed_cbox = { local bed_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.05, 1.5 }, { -0.5, -0.5, -0.5, 0.5, -0.05, 1.5 },
{ -0.5, -0.5, 1.44, 0.5, 0.5, 1.5 }, { -0.5, -0.5, 1.44, 0.5, 0.5, 1.5 },
{ -0.5, -0.5, -0.5, 0.5, 0.18, -0.44 }, { -0.5, -0.5, -0.5, 0.5, 0.18, -0.44 },
@ -33,7 +33,7 @@ local kbed_sbox = {
local kbed_cbox = { local kbed_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -0.5, -0.5, -0.5, 1.5, -0.05, 1.5 }, { -0.5, -0.5, -0.5, 1.5, -0.05, 1.5 },
{ -0.5, -0.5, 1.44, 1.5, 0.5, 1.5 }, { -0.5, -0.5, 1.44, 1.5, 0.5, 1.5 },
{ -0.5, -0.5, -0.5, 1.5, 0.18, -0.44 }, { -0.5, -0.5, -0.5, 1.5, 0.18, -0.44 },

View File

@ -137,7 +137,7 @@ local door_model_list = {
tiles = { tiles = {
"homedecor_door_exterior_fancy.png", "homedecor_door_exterior_fancy.png",
"homedecor_door_exterior_fancy_insert.png" "homedecor_door_exterior_fancy_insert.png"
}, },
usealpha = true usealpha = true
}, },

View File

@ -52,7 +52,7 @@ local kc_cbox = {
local ac_cbox = { local ac_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5 }, {-0.5, -0.5, -0.5, 0.5, 0, 0.5 },
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
} }

View File

@ -93,7 +93,7 @@ local wl_cbox = {
homedecor.register("wall_lamp", { homedecor.register("wall_lamp", {
description = S("Wall Lamp"), description = S("Wall Lamp"),
mesh = "homedecor_wall_lamp.obj", mesh = "homedecor_wall_lamp.obj",
tiles = {"homedecor_generic_metal_black.png^[brighten", "homedecor_generic_wood_luxury.png^[colorize:#000000:30", tiles = {"homedecor_generic_metal_black.png^[brighten", "homedecor_generic_wood_luxury.png^[colorize:#000000:30",
"homedecor_light.png", "homedecor_generic_metal_wrought_iron.png"}, "homedecor_light.png", "homedecor_generic_metal_wrought_iron.png"},
use_texture_alpha = true, use_texture_alpha = true,
inventory_image = "homedecor_wall_lamp_inv.png", inventory_image = "homedecor_wall_lamp_inv.png",

View File

@ -143,7 +143,7 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color)
return true return true
end end
if minetest.is_protected(forwardpos, placer_name) then if minetest.is_protected(forwardpos, placer_name) then
minetest.chat_send_player( placer:get_player_name(), "Someone already owns the spot where the headboard goes." ) minetest.chat_send_player( placer:get_player_name(), "Someone already owns the spot where the headboard goes." )
return true return true
end end
@ -169,7 +169,7 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color)
minetest.set_node(rightpos, {name = "air"}) minetest.set_node(rightpos, {name = "air"})
minetest.set_node(pos, { name = newname, param2 = fdir}) minetest.set_node(pos, { name = newname, param2 = fdir})
end end
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
local bottomnode = minetest.get_node({x=pos.x, y=pos.y-1.0, z=pos.z}) local bottomnode = minetest.get_node({x=pos.x, y=pos.y-1.0, z=pos.z})
@ -202,7 +202,7 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
if def.on_rightclick then if def.on_rightclick then
return def.on_rightclick(pointed_thing.under, minetest.get_node(pos), placer, itemstack) return def.on_rightclick(pointed_thing.under, minetest.get_node(pos), placer, itemstack)
end end
local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local fdir = minetest.dir_to_facedir(placer:get_look_dir())
@ -217,7 +217,7 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
return return
end end
if minetest.is_protected(abovepos, placer_name) then if minetest.is_protected(abovepos, placer_name) then
minetest.chat_send_player(placer_name, "Someone already owns that spot." ) minetest.chat_send_player(placer_name, "Someone already owns that spot." )
return return
end end
@ -242,7 +242,7 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
local right_fwd_below_pos = { x=pos.x+rxd+fxd, y=pos.y-1, z=pos.z+rzd+fzd } local right_fwd_below_pos = { x=pos.x+rxd+fxd, y=pos.y-1, z=pos.z+rzd+fzd }
local left_fwd_below_pos = { x=pos.x+lxd+fxd, y=pos.y-1, z=pos.z+lzd+fzd } local left_fwd_below_pos = { x=pos.x+lxd+fxd, y=pos.y-1, z=pos.z+lzd+fzd }
local below_node = minetest.get_node(below_pos) local below_node = minetest.get_node(below_pos)
local fwd_node = minetest.get_node(fwd_pos) local fwd_node = minetest.get_node(fwd_pos)
local left_node = minetest.get_node(left_pos) local left_node = minetest.get_node(left_pos)
local right_node = minetest.get_node(right_pos) local right_node = minetest.get_node(right_pos)
@ -280,12 +280,12 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
-- try to place a horizontal in-line with the nearest diagonal, at the top -- try to place a horizontal in-line with the nearest diagonal, at the top
elseif left_fwd_below_node and string.find(left_fwd_below_node.name, "homedecor:banister_.*_diagonal") elseif left_fwd_below_node and string.find(left_fwd_below_node.name, "homedecor:banister_.*_diagonal")
and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then
fdir = left_fwd_below_node.param2 fdir = left_fwd_below_node.param2
pos = fwd_pos pos = fwd_pos
new_place_name = string.gsub(left_fwd_below_node.name, "_diagonal_.-$", "_horizontal") new_place_name = string.gsub(left_fwd_below_node.name, "_diagonal_.-$", "_horizontal")
elseif right_fwd_below_node and string.find(right_fwd_below_node.name, "homedecor:banister_.*_diagonal") elseif right_fwd_below_node and string.find(right_fwd_below_node.name, "homedecor:banister_.*_diagonal")
and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then
fdir = right_fwd_below_node.param2 fdir = right_fwd_below_node.param2
pos = fwd_pos pos = fwd_pos
new_place_name = string.gsub(right_fwd_below_node.name, "_diagonal_.-$", "_horizontal") new_place_name = string.gsub(right_fwd_below_node.name, "_diagonal_.-$", "_horizontal")
@ -299,13 +299,13 @@ function homedecor.place_banister(itemstack, placer, pointed_thing)
new_place_name = string.gsub(right_node.name, "_diagonal_.-$", "_horizontal") new_place_name = string.gsub(right_node.name, "_diagonal_.-$", "_horizontal")
-- try to place a horizontal in-line with the nearest diagonal, at the bottom -- try to place a horizontal in-line with the nearest diagonal, at the bottom
elseif left_fwd_node and string.find(left_fwd_node.name, "homedecor:banister_.*_diagonal") elseif left_fwd_node and string.find(left_fwd_node.name, "homedecor:banister_.*_diagonal")
and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then
fdir = left_fwd_node.param2 fdir = left_fwd_node.param2
pos = fwd_pos pos = fwd_pos
new_place_name = string.gsub(left_fwd_node.name, "_diagonal_.-$", "_horizontal") new_place_name = string.gsub(left_fwd_node.name, "_diagonal_.-$", "_horizontal")
elseif right_fwd_node and string.find(right_fwd_node.name, "homedecor:banister_.*_diagonal") elseif right_fwd_node and string.find(right_fwd_node.name, "homedecor:banister_.*_diagonal")
and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then and is_buildable_to(placer_name, fwd_pos, nil, fwd_pos) then
fdir = right_fwd_node.param2 fdir = right_fwd_node.param2
pos = fwd_pos pos = fwd_pos
new_place_name = string.gsub(right_fwd_node.name, "_diagonal_.-$", "_horizontal") new_place_name = string.gsub(right_fwd_node.name, "_diagonal_.-$", "_horizontal")

View File

@ -158,7 +158,7 @@ homedecor.register("plasma_ball", {
"homedecor_plasma_ball_glass.png" "homedecor_plasma_ball_glass.png"
}, },
inventory_image = "homedecor_plasma_ball_inv.png", inventory_image = "homedecor_plasma_ball_inv.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.1875, -0.5, -0.1875, 0.1875, 0, 0.1875 } fixed = { -0.1875, -0.5, -0.1875, 0.1875, 0, 0.1875 }
}, },
@ -357,7 +357,7 @@ homedecor.register("ceiling_lantern", {
use_texture_alpha = true, use_texture_alpha = true,
inventory_image = "homedecor_ceiling_lantern_inv.png", inventory_image = "homedecor_ceiling_lantern_inv.png",
description = "Ceiling Lantern", description = "Ceiling Lantern",
groups = {snappy=3}, groups = {snappy=3},
light_source = 11, light_source = 11,
selection_box = cl_cbox, selection_box = cl_cbox,
walkable = false walkable = false
@ -508,7 +508,7 @@ local dlamp_cbox = {
local dlamp_colors = { "red","blue","green","violet" } local dlamp_colors = { "red","blue","green","violet" }
for _, color in ipairs(dlamp_colors) do for _, color in ipairs(dlamp_colors) do
homedecor.register("desk_lamp_"..color, { homedecor.register("desk_lamp_"..color, {
description = S("Desk Lamp ("..color..")"), description = S("Desk Lamp ("..color..")"),
mesh = "homedecor_desk_lamp.obj", mesh = "homedecor_desk_lamp.obj",

View File

@ -41,7 +41,7 @@ for i in ipairs(rug_types) do
if type(m) == "table" then if type(m) == "table" then
mesh = nil mesh = nil
nodebox = { nodebox = {
type = "fixed", type = "fixed",
fixed = m fixed = m
} }
tiles = { tiles = {
@ -94,7 +94,7 @@ for i in ipairs(flowers_list) do
local flowerdesc = flowers_list[i][1] local flowerdesc = flowers_list[i][1]
local flower = flowers_list[i][2] local flower = flowers_list[i][2]
local craftwith = flowers_list[i][3] local craftwith = flowers_list[i][3]
homedecor.register("potted_"..flower, { homedecor.register("potted_"..flower, {
description = S("Potted flower ("..flowerdesc..")"), description = S("Potted flower ("..flowerdesc..")"),
mesh = "homedecor_flowerpot_small.obj", mesh = "homedecor_flowerpot_small.obj",

View File

@ -27,7 +27,7 @@ if minetest.get_modpath("vessels")
paramtype2 = "facedir", paramtype2 = "facedir",
use_texture_alpha = true use_texture_alpha = true
}) })
local sbox = { local sbox = {
type = "fixed", type = "fixed",
fixed = { -0.15, -0.5, -0.15, 0.15, -0.1, 0.15 } fixed = { -0.15, -0.5, -0.15, 0.15, -0.1, 0.15 }

View File

@ -1,6 +1,6 @@
local lavalamps_list = { local lavalamps_list = {
{ "Red Lava Lamp", "red"}, { "Red Lava Lamp", "red"},
{ "Orange Lava Lamp", "orange"}, { "Orange Lava Lamp", "orange"},
{ "Yellow Lava Lamp", "yellow"}, { "Yellow Lava Lamp", "yellow"},
{ "Green Lava Lamp", "green"}, { "Green Lava Lamp", "green"},
{ "Blue Lava Lamp", "blue"}, { "Blue Lava Lamp", "blue"},
@ -52,7 +52,7 @@ for i in ipairs(lavalamps_list) do
tiles = { tiles = {
"lavalamp_metal.png", "lavalamp_metal.png",
"lavalamp_lamp_off.png", "lavalamp_lamp_off.png",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
@ -78,5 +78,5 @@ for i in ipairs(lavalamps_list) do
{"", "wool:black", "", } {"", "wool:black", "", }
} }
}) })
end end

View File

@ -12,7 +12,7 @@ local armchairs_list = {
local armchair_cbox = { local armchair_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5 }, {-0.5, -0.5, -0.5, 0.5, 0, 0.5 },
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
} }

View File

@ -17,7 +17,7 @@ local longsofa_sbox = {
local longsofa_cbox = { local longsofa_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 2.5 }, {-0.5, -0.5, -0.5, 0.5, 0, 2.5 },
{-0.5, -0.5, 0.5, -0.4, 0.5, 2.5 } {-0.5, -0.5, 0.5, -0.4, 0.5, 2.5 }
} }

View File

@ -17,7 +17,7 @@ local sofa_sbox = {
local sofa_cbox = { local sofa_cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 1.5 }, {-0.5, -0.5, -0.5, 0.5, 0, 1.5 },
{-0.5, -0.5, 0.5, -0.4, 0.5, 1.5 } {-0.5, -0.5, 0.5, -0.4, 0.5, 1.5 }
} }

View File

@ -85,7 +85,7 @@ local function checkwall(pos)
end end
local node5 = minetest.get_node({x=pos.x+dxr, y=pos.y+1, z=pos.z+dzr}) local node5 = minetest.get_node({x=pos.x+dxr, y=pos.y+1, z=pos.z+dzr})
if not node5 or not minetest.registered_nodes[node5.name] if not node5 or not minetest.registered_nodes[node5.name]
or not minetest.registered_nodes[node5.name].buildable_to then or not minetest.registered_nodes[node5.name].buildable_to then
return false return false
end end

View File

@ -567,7 +567,7 @@ signs_lib.update_sign = function(pos, fields, owner)
elseif signnode.name == "signs:sign_hanging" then elseif signnode.name == "signs:sign_hanging" then
sign_info = signs_lib.hanging_sign_model.textpos[minetest.get_node(pos).param2 + 1] sign_info = signs_lib.hanging_sign_model.textpos[minetest.get_node(pos).param2 + 1]
elseif string.find(signnode.name, "sign_wall") then elseif string.find(signnode.name, "sign_wall") then
if signnode.name == "default:sign_wall" if signnode.name == "default:sign_wall"
or signnode.name == "locked_sign:sign_wall_locked" then or signnode.name == "locked_sign:sign_wall_locked" then
sign_info = signs_lib.regular_wall_sign_model.textpos[minetest.get_node(pos).param2 + 1] sign_info = signs_lib.regular_wall_sign_model.textpos[minetest.get_node(pos).param2 + 1]
else else

View File

@ -18,7 +18,7 @@ end
function hud.set_armor(player_name, ges_state, items) function hud.set_armor(player_name, ges_state, items)
local max_items = 4 local max_items = 4
if items == 5 then if items == 5 then
max_items = items max_items = items
end end
local max = max_items * 65535 local max = max_items * 65535

View File

@ -17,7 +17,7 @@ local function poisenp(tick, time, time_left, player)
if player:get_hp()-1 > 0 then if player:get_hp()-1 > 0 then
player:set_hp(player:get_hp()-1) player:set_hp(player:get_hp()-1)
end end
end end
function hud.item_eat(hunger_change, replace_with_item, poisen, heal) function hud.item_eat(hunger_change, replace_with_item, poisen, heal)
@ -301,7 +301,7 @@ if minetest.get_modpath("mobs") ~= nil then
overwrite("mobs:chicken_cooked", 4) overwrite("mobs:chicken_cooked", 4)
overwrite("mobs:egg", 1) overwrite("mobs:egg", 1)
overwrite("mobs:chicken_egg_fried", 2) overwrite("mobs:chicken_egg_fried", 2)
if minetest.get_modpath("bucket") then if minetest.get_modpath("bucket") then
overwrite("mobs:bucket_milk", 3, "bucket:bucket_empty") overwrite("mobs:bucket_milk", 3, "bucket:bucket_empty")
end end
end end

View File

@ -49,7 +49,7 @@ HUD_TICK = 0.1
--Some hunger settings --Some hunger settings
hud.exhaustion = {} -- Exhaustion is experimental! hud.exhaustion = {} -- Exhaustion is experimental!
HUD_HUNGER_TICK = 800 -- time in seconds after that 1 hunger point is taken HUD_HUNGER_TICK = 800 -- time in seconds after that 1 hunger point is taken
HUD_HUNGER_EXHAUST_DIG = 3 -- exhaustion increased this value after digged node HUD_HUNGER_EXHAUST_DIG = 3 -- exhaustion increased this value after digged node
HUD_HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed HUD_HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed
HUD_HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected HUD_HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected
@ -69,7 +69,7 @@ end
--load custom settings --load custom settings
local set = io.open(minetest.get_modpath("hud").."/hud.conf", "r") local set = io.open(minetest.get_modpath("hud").."/hud.conf", "r")
if set then if set then
dofile(minetest.get_modpath("hud").."/hud.conf") dofile(minetest.get_modpath("hud").."/hud.conf")
set:close() set:close()
else else
@ -243,7 +243,7 @@ hud.set_hunger = function(player)
if not inv or not value then return nil end if not inv or not value then return nil end
if value > 30 then value = 30 end if value > 30 then value = 30 end
if value < 0 then value = 0 end if value < 0 then value = 0 end
inv:set_stack("hunger", 1, ItemStack({name=":", count=value+1})) inv:set_stack("hunger", 1, ItemStack({name=":", count=value+1}))
return true return true
@ -321,7 +321,7 @@ minetest.after(2.5, function()
-- update all hud elements -- update all hud elements
update_hud(player) update_hud(player)
if HUD_ENABLE_HUNGER then if HUD_ENABLE_HUNGER then
local controls = player:get_player_control() local controls = player:get_player_control()
-- Determine if the player is walking -- Determine if the player is walking
@ -331,7 +331,7 @@ minetest.after(2.5, function()
end end
end end
end end
end end
if timer > 4 then timer = 0 end if timer > 4 then timer = 0 end
if timer2 > HUD_HUNGER_TICK then timer2 = 0 end if timer2 > HUD_HUNGER_TICK then timer2 = 0 end

View File

@ -30,6 +30,6 @@ minetest.register_chatcommand("inv", {
invlist = invlist..items.." | " invlist = invlist..items.." | "
end end
end end
minetest.chat_send_player(name, invlist) minetest.chat_send_player(name, invlist)
end, end,
}) })

View File

@ -156,7 +156,7 @@ tweak.sort = function(player, mode, con)
if inv then if inv then
local list = inv:get_list("main") local list = inv:get_list("main")
local tmp_list = {} local tmp_list = {}
--write whole list as table --write whole list as table
for _,stack in ipairs(list) do for _,stack in ipairs(list) do
local tbl_stack = stack:to_table() local tbl_stack = stack:to_table()

View File

@ -46,13 +46,13 @@ function irc:bot_command(msg, text)
cmd = text cmd = text
args = "" args = ""
end end
if not self.bot_commands[cmd] then if not self.bot_commands[cmd] then
self:reply("Unknown command '"..cmd.."'. Try 'list'." self:reply("Unknown command '"..cmd.."'. Try 'list'."
.." Or use @playername <message> to send a private message") .." Or use @playername <message> to send a private message")
return return
end end
local success, message = self.bot_commands[cmd].func(msg.user, args) local success, message = self.bot_commands[cmd].func(msg.user, args)
if message then if message then
self:reply(message) self:reply(message)

View File

@ -105,7 +105,7 @@ function msg_meta:fromRFC1459(line)
local pos local pos
self.command, pos = line:match("(%S+)()") self.command, pos = line:match("(%S+)()")
-- /MFF BEGIN -- /MFF BEGIN
if not pos then if not pos then
minetest.log("error", "[IRC] This crash message was intended to see the value of a breaking variable. line = " .. (line or "nil")) minetest.log("error", "[IRC] This crash message was intended to see the value of a breaking variable. line = " .. (line or "nil"))
return return
end end

View File

@ -13,7 +13,7 @@ end
function set:add(connection) function set:add(connection)
local socket = connection.socket local socket = connection.socket
insert(self.sockets, socket) insert(self.sockets, socket)
self.connections[socket] = connection self.connections[socket] = connection
insert(self.connections, connection) insert(self.connections, connection)
end end
@ -32,13 +32,13 @@ end
function set:select() function set:select()
local read, write, err = select(self.sockets, nil, self.timeout) local read, write, err = select(self.sockets, nil, self.timeout)
if read then if read then
for k, socket in ipairs(read) do for k, socket in ipairs(read) do
read[k] = self.connections[socket] read[k] = self.connections[socket]
end end
end end
return read, err return read, err
end end

View File

@ -10,7 +10,7 @@ function irc:player_part(name)
self.joined_players[name] = nil self.joined_players[name] = nil
minetest.chat_send_player(name, "IRC: You are now out of the channel.") minetest.chat_send_player(name, "IRC: You are now out of the channel.")
end end
function irc:player_join(name) function irc:player_join(name)
if self.joined_players[name] then if self.joined_players[name] then
minetest.chat_send_player(name, "IRC: You are already in the channel.") minetest.chat_send_player(name, "IRC: You are already in the channel.")
@ -28,7 +28,7 @@ minetest.register_chatcommand("join", {
irc:player_join(name) irc:player_join(name)
end end
}) })
minetest.register_chatcommand("part", { minetest.register_chatcommand("part", {
description = "Part the IRC channel", description = "Part the IRC channel",
privs = {shout=true}, privs = {shout=true},
@ -36,7 +36,7 @@ minetest.register_chatcommand("part", {
irc:player_part(name) irc:player_part(name)
end end
}) })
minetest.register_chatcommand("who", { minetest.register_chatcommand("who", {
description = "Tell who is currently on the channel", description = "Tell who is currently on the channel",
privs = {}, privs = {},
@ -49,13 +49,13 @@ minetest.register_chatcommand("who", {
end end
}) })
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
irc.joined_players[name] = irc.config.auto_join irc.joined_players[name] = irc.config.auto_join
end) end)
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
irc.joined_players[name] = nil irc.joined_players[name] = nil

View File

@ -7,7 +7,7 @@ minetest.register_globalstep(function(dtime)
if player:get_hp() > 0 or not enable_damage then if player:get_hp() > 0 or not enable_damage then
local pos = player:getpos() local pos = player:getpos()
local inv = player:get_inventory() local inv = player:get_inventory()
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
@ -20,7 +20,7 @@ minetest.register_globalstep(function(dtime)
end end
end end
end end
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
if object:get_luaentity().always_collect then if object:get_luaentity().always_collect then
@ -37,7 +37,7 @@ minetest.register_globalstep(function(dtime)
object:get_luaentity().object:set_properties({ object:get_luaentity().object:set_properties({
physical = false physical = false
}) })
minetest.after(1, function(args) minetest.after(1, function(args)
local lua = object:get_luaentity() local lua = object:get_luaentity()
if object == nil or lua == nil or lua.itemstring == nil then if object == nil or lua == nil or lua.itemstring == nil then
@ -58,7 +58,7 @@ minetest.register_globalstep(function(dtime)
}) })
end end
end, {player, object}) end, {player, object})
end end
end end
end end
@ -86,7 +86,7 @@ function minetest.handle_node_drops(pos, drops, digger)
local obj local obj
local x = math.random(1, 5) local x = math.random(1, 5)
if math.random(1,2) == 1 then x = -x end if math.random(1,2) == 1 then x = -x end
local z = math.random(1, 5) local z = math.random(1, 5)
if math.random(1,2) == 1 then z = -z end if math.random(1,2) == 1 then z = -z end

View File

@ -17,8 +17,8 @@ minetest.register_node("lantern:lantern", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
node_box = { node_box = {
type = "wallmounted", type = "wallmounted",
wall_top = {-1/6, 1/6, -1/6, 1/6, 0.5, 1/6}, wall_top = {-1/6, 1/6, -1/6, 1/6, 0.5, 1/6},
wall_bottom = {-1/6, -0.5, -1/6, 1/6, -1/6, 1/6}, wall_bottom = {-1/6, -0.5, -1/6, 1/6, -1/6, 1/6},
wall_side = {-1/6, -1/6, -1/6, -0.5, 1/6, 1/6}, wall_side = {-1/6, -1/6, -1/6, -0.5, 1/6, 1/6},
}, },
}) })
@ -44,7 +44,7 @@ minetest.register_node("lantern:candle", {
inventory_image = "candle_inv.png", inventory_image = "candle_inv.png",
tiles = { tiles = {
{name="candle.png", animation={type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 0.8}}, {name="candle.png", animation={type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 0.8}},
}, },
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
@ -184,16 +184,16 @@ minetest.register_node("lantern:lamp1", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -2.5, -0.5, 1.5, 1.5, 0.5}, fixed = {-0.5, -2.5, -0.5, 1.5, 1.5, 0.5},
}, },
after_dig_node = function(pos) after_dig_node = function(pos)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
minetest.remove_node({x = pos.x + 1, y = pos.y + 1, z = pos.z }) minetest.remove_node({x = pos.x + 1, y = pos.y + 1, z = pos.z })
minetest.remove_node({x = pos.x + 1, y = pos.y , z = pos.z }) minetest.remove_node({x = pos.x + 1, y = pos.y , z = pos.z })
minetest.remove_node({x = pos.x + 1, y = pos.y - 1, z = pos.z }) minetest.remove_node({x = pos.x + 1, y = pos.y - 1, z = pos.z })
minetest.remove_node({x = pos.x + 1, y = pos.y - 2, z = pos.z }) minetest.remove_node({x = pos.x + 1, y = pos.y - 2, z = pos.z })
end end
}) })
minetest.register_node("lantern:lamp2", { minetest.register_node("lantern:lamp2", {
description = "Lamp2", description = "Lamp2",
@ -207,16 +207,16 @@ minetest.register_node("lantern:lamp2", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -2.5, -0.5, 0.5, 1.5, 1.5}, fixed = {-0.5, -2.5, -0.5, 0.5, 1.5, 1.5},
}, },
after_dig_node = function(pos) after_dig_node = function(pos)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z + 1}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z + 1})
minetest.remove_node({x = pos.x, y = pos.y , z = pos.z + 1}) minetest.remove_node({x = pos.x, y = pos.y , z = pos.z + 1})
minetest.remove_node({x = pos.x, y = pos.y - 1, z = pos.z + 1}) minetest.remove_node({x = pos.x, y = pos.y - 1, z = pos.z + 1})
minetest.remove_node({x = pos.x, y = pos.y - 2, z = pos.z + 1}) minetest.remove_node({x = pos.x, y = pos.y - 2, z = pos.z + 1})
end end
}) })
minetest.register_node("lantern:lamp3", { minetest.register_node("lantern:lamp3", {
description = "Lamp3", description = "Lamp3",
@ -230,16 +230,16 @@ minetest.register_node("lantern:lamp3", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-1.5, -2.5, -0.5, 0.5, 1.5, 0.5}, fixed = {-1.5, -2.5, -0.5, 0.5, 1.5, 0.5},
}, },
after_dig_node = function(pos) after_dig_node = function(pos)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
minetest.remove_node({x = pos.x - 1, y = pos.y + 1, z = pos.z}) minetest.remove_node({x = pos.x - 1, y = pos.y + 1, z = pos.z})
minetest.remove_node({x = pos.x - 1, y = pos.y , z = pos.z}) minetest.remove_node({x = pos.x - 1, y = pos.y , z = pos.z})
minetest.remove_node({x = pos.x - 1, y = pos.y - 1, z = pos.z}) minetest.remove_node({x = pos.x - 1, y = pos.y - 1, z = pos.z})
minetest.remove_node({x = pos.x - 1, y = pos.y - 2, z = pos.z}) minetest.remove_node({x = pos.x - 1, y = pos.y - 2, z = pos.z})
end end
}) })
minetest.register_node("lantern:lamp4", { minetest.register_node("lantern:lamp4", {
description = "Lamp4", description = "Lamp4",
@ -253,16 +253,16 @@ minetest.register_node("lantern:lamp4", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -2.5, -1.5, 0.5, 1.5, 0.5}, fixed = {-0.5, -2.5, -1.5, 0.5, 1.5, 0.5},
}, },
after_dig_node = function(pos) after_dig_node = function(pos)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z - 1}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z - 1})
minetest.remove_node({x = pos.x, y = pos.y , z = pos.z - 1}) minetest.remove_node({x = pos.x, y = pos.y , z = pos.z - 1})
minetest.remove_node({x = pos.x, y = pos.y - 1, z = pos.z - 1}) minetest.remove_node({x = pos.x, y = pos.y - 1, z = pos.z - 1})
minetest.remove_node({x = pos.x, y = pos.y - 2, z = pos.z - 1}) minetest.remove_node({x = pos.x, y = pos.y - 2, z = pos.z - 1})
end end
}) })
-- --
-- register crafting recipes: -- register crafting recipes:

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