remove whitespaces: sed -i 's/[ \t]*$//'

This commit is contained in:
HybridDog 2015-05-29 12:24:29 +02:00
parent 01ad09036b
commit 3f16b559c4
25 changed files with 111 additions and 111 deletions

View file

@ -9,7 +9,7 @@
--- ---
- Add fancy bed model (based on jp's model) - Add fancy bed model (based on jp's model)
- Add API to register beds - Add API to register beds
- Allow players always to detach from bed (by donat-b) - Allow players always to detach from bed (by donat-b)
- If more than 50% of players want sleep they can skip the night - If more than 50% of players want sleep they can skip the night
- Don't show sleep dialog in singleplayer - Don't show sleep dialog in singleplayer

View file

@ -6,7 +6,7 @@ Version: 1.1.1
About About
~~~~~ ~~~~~
This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing
in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other
players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced
if more than 50% of the players are lying in bed and use this option. if more than 50% of the players are lying in bed and use this option.

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

@ -1,5 +1,5 @@
-- Minetest 0.4 mod: bones -- Minetest 0.4 mod: bones
-- See README.txt for licensing and other information. -- See README.txt for licensing and other information.
bones = {} bones = {}
@ -40,46 +40,46 @@ minetest.register_node("bones:bones", {
footstep = {name="default_gravel_footstep", gain=0.5}, footstep = {name="default_gravel_footstep", gain=0.5},
dug = {name="default_gravel_footstep", gain=1.0}, dug = {name="default_gravel_footstep", gain=1.0},
}), }),
can_dig = function(pos, player) can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
return is_owner(pos, player:get_player_name()) and inv:is_empty("main") return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if is_owner(pos, player:get_player_name()) then if is_owner(pos, player:get_player_name()) then
return count return count
end end
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 0 return 0
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if is_owner(pos, player:get_player_name()) then if is_owner(pos, player:get_player_name()) then
return stack:get_count() return stack:get_count()
end end
return 0 return 0
end, end,
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_inventory():is_empty("main") then if meta:get_inventory():is_empty("main") then
minetest.remove_node(pos) minetest.remove_node(pos)
end end
end, end,
on_punch = function(pos, node, player) on_punch = function(pos, node, player)
if(not is_owner(pos, player:get_player_name())) then if(not is_owner(pos, player:get_player_name())) then
return return
end end
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
local has_space = true local has_space = true
for i=1,inv:get_size("main") do for i=1,inv:get_size("main") do
local stk = inv:get_stack("main", i) local stk = inv:get_stack("main", i)
if player_inv:room_for_item("main", stk) then if player_inv:room_for_item("main", stk) then
@ -90,13 +90,13 @@ minetest.register_node("bones:bones", {
break break
end end
end end
-- remove bones if player emptied them -- remove bones if player emptied them
if has_space then if has_space then
minetest.remove_node(pos) minetest.remove_node(pos)
end end
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local time = meta:get_int("time") + elapsed local time = meta:get_int("time") + elapsed
@ -144,7 +144,7 @@ minetest.register_on_dieplayer(function(player)
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") then
return return
end end
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
if player_inv:is_empty("main") and if player_inv:is_empty("main") and
player_inv:is_empty("craft") then player_inv:is_empty("craft") then
@ -179,14 +179,14 @@ minetest.register_on_dieplayer(function(player)
return return
end end
end end
minetest.set_node(pos, {name="bones:bones", param2=param2}) minetest.set_node(pos, {name="bones:bones", param2=param2})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 8*4) inv:set_size("main", 8*4)
inv:set_list("main", player_inv:get_list("main")) inv:set_list("main", player_inv:get_list("main"))
for i=1,player_inv:get_size("craft") do for i=1,player_inv:get_size("craft") do
local stack = player_inv:get_stack("craft", i) local stack = player_inv:get_stack("craft", i)
if inv:room_for_item("main", stack) then if inv:room_for_item("main", stack) then
@ -196,13 +196,13 @@ minetest.register_on_dieplayer(function(player)
minetest.add_item(pos, stack) minetest.add_item(pos, stack)
end end
end end
player_inv:set_list("main", {}) player_inv:set_list("main", {})
player_inv:set_list("craft", {}) player_inv:set_list("craft", {})
meta:set_string("formspec", bones.bones_formspec) meta:set_string("formspec", bones.bones_formspec)
meta:set_string("owner", player_name) meta:set_string("owner", player_name)
if share_bones_time ~= 0 then if share_bones_time ~= 0 then
meta:set_string("infotext", player_name.."'s fresh bones") meta:set_string("infotext", player_name.."'s fresh bones")

View file

@ -15,7 +15,7 @@ http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds) License of media (textures and sounds)
-------------------------------------- --------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files Authors of media files

View file

@ -54,7 +54,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 true return true
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

@ -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_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
@ -98,9 +98,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,
@ -130,9 +130,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,
@ -163,7 +163,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
-- --
@ -180,24 +180,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
@ -215,7 +215,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
@ -224,10 +224,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
@ -236,7 +236,7 @@ minetest.register_abm({
src_time = 0 src_time = 0
end end
end end
-- --
-- Update formspec, infotext and node -- Update formspec, infotext and node
-- --
@ -253,7 +253,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
@ -268,9 +268,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
-- --

View file

@ -43,7 +43,7 @@ minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebr
-- Blob ore first to avoid other ores inside blobs -- Blob ore first to avoid other ores inside blobs
function default.register_ores() function default.register_ores()
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:clay", ore = "default:clay",
wherein = {"default:sand"}, wherein = {"default:sand"},
@ -62,7 +62,7 @@ function default.register_ores()
}, },
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:sand", ore = "default:sand",
wherein = {"default:stone"}, wherein = {"default:stone"},
@ -449,7 +449,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "flowers:rose", decoration = "flowers:rose",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -467,7 +467,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "flowers:tulip", decoration = "flowers:tulip",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -485,7 +485,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "flowers:dandelion_yellow", decoration = "flowers:dandelion_yellow",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -503,7 +503,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "flowers:geranium", decoration = "flowers:geranium",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -521,7 +521,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "flowers:viola", decoration = "flowers:viola",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -559,7 +559,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "default:grass_1", decoration = "default:grass_1",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -577,7 +577,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "default:grass_2", decoration = "default:grass_2",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -595,7 +595,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "default:grass_3", decoration = "default:grass_3",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -613,7 +613,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "default:grass_4", decoration = "default:grass_4",
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},

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

@ -30,7 +30,7 @@ following textures created by celeron55 (CC BY-SA 3.0):
door_trapdoor_side.png door_trapdoor_side.png
door_glass_a.png door_glass_a.png
door_glass_b.png door_glass_b.png
following Textures created by PenguinDad (CC BY-SA 4.0): following Textures created by PenguinDad (CC BY-SA 4.0):
door_glass.png door_glass.png
door_obsidian_glass.png door_obsidian_glass.png

View file

@ -25,8 +25,8 @@ 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,
@ -100,7 +100,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
@ -134,16 +134,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
@ -205,18 +205,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,
on_rotate = function(pos, node, user, mode, new_param2) on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_1", mode) return on_rotate(pos, node, 1, user, name.."_t_1", mode)
end, end,
@ -242,18 +242,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,
on_rotate = function(pos, node, user, mode, new_param2) on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_1", mode) return on_rotate(pos, node, -1, user, name.."_b_1", mode)
end, end,
@ -279,18 +279,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,
on_rotate = function(pos, node, user, mode, new_param2) on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_2", mode) return on_rotate(pos, node, 1, user, name.."_t_2", mode)
end, end,
@ -316,18 +316,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,
on_rotate = function(pos, node, user, mode, new_param2) on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_2", mode) return on_rotate(pos, node, -1, user, name.."_b_2", mode)
end, end,

View file

@ -1,6 +1,6 @@
farming.register_hoe(name, hoe definition) farming.register_hoe(name, hoe definition)
-> Register a new hoe, see [hoe definition] -> Register a new hoe, see [hoe definition]
farming.register_plant(name, Plant definition) farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [Plant definition] -> Register a new growing plant, see [Plant definition]

View file

@ -17,7 +17,7 @@ Copyright (C) 2014 webdesigner97
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO. 0. You just DO WHAT THE FUCK YOU WANT TO.
License of media (textures): License of media (textures):
---------------------------- ----------------------------

View file

@ -9,11 +9,11 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
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
@ -21,30 +21,30 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
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 soil -- check if pointing at soil
if minetest.get_item_group(under.name, "soil") ~= 1 then if minetest.get_item_group(under.name, "soil") ~= 1 then
return return
end end
-- check if (wet) soil defined -- check if (wet) soil defined
local regN = minetest.registered_nodes local regN = minetest.registered_nodes
if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil 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 = regN[under.name].soil.dry}) minetest.set_node(pt.under, {name = regN[under.name].soil.dry})
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 not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/(uses-1)) itemstack:add_wear(65535/(uses-1))
end end
@ -119,10 +119,10 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
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 above = minetest.get_node(pt.above) local above = minetest.get_node(pt.above)
-- 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
@ -130,22 +130,22 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
if not minetest.registered_nodes[above.name] then if not minetest.registered_nodes[above.name] then
return return
end end
-- check if pointing at the top of the node -- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then if pt.above.y ~= pt.under.y+1 then
return return
end end
-- check if you can replace the node above the pointed node -- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then if not minetest.registered_nodes[above.name].buildable_to then
return return
end end
-- check if pointing at soil -- check if pointing at soil
if minetest.get_item_group(under.name, "soil") < 2 then if minetest.get_item_group(under.name, "soil") < 2 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, param2 = 1}) minetest.add_node(pt.above, {name = plantname, param2 = 1})
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then

View file

@ -108,7 +108,7 @@ minetest.register_abm({
end end
local nn_def = minetest.registered_nodes[nn.name] or nil local nn_def = minetest.registered_nodes[nn.name] or nil
pos.y = pos.y - 1 pos.y = pos.y - 1
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
minetest.set_node(pos, {name = base}) minetest.set_node(pos, {name = base})
return return
@ -130,7 +130,7 @@ minetest.register_abm({
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
minetest.set_node(pos, {name = base}) minetest.set_node(pos, {name = base})
end end
-- if its wet turn it back into dry soil -- if its wet turn it back into dry soil
elseif wet_lvl == 1 then elseif wet_lvl == 1 then
minetest.set_node(pos, {name = dry}) minetest.set_node(pos, {name = dry})
@ -141,7 +141,7 @@ minetest.register_abm({
}) })
for i = 1, 5 do for i = 1, 5 do
minetest.override_item("default:grass_"..i, {drop = { minetest.override_item("default:grass_"..i, {drop = {
max_items = 1, max_items = 1,
items = { items = {
@ -150,7 +150,7 @@ for i = 1, 5 do
} }
}}) }})
end end
minetest.override_item("default:junglegrass", {drop = { minetest.override_item("default:junglegrass", {drop = {
max_items = 1, max_items = 1,
items = { items = {

View file

@ -14,7 +14,7 @@ http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds) License of media (textures and sounds)
-------------------------------------- --------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files Authors of media files

View file

@ -71,23 +71,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

@ -14,7 +14,7 @@ http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds) License of media (textures and sounds)
-------------------------------------- --------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/
Created by Gambit (WTFPL): Created by Gambit (WTFPL):

View file

@ -15,7 +15,7 @@ http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds) License of media (textures and sounds)
-------------------------------------- --------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files Authors of media files

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

@ -279,7 +279,7 @@ minetest.register_node("tnt:gunpowder", {
}, },
groups = {dig_immediate=2,attached_node=1}, groups = {dig_immediate=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then if puncher:get_wielded_item():get_name() == "default:torch" then
burn(pos) burn(pos)

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