Skip to content
Snippets Groups Projects
Commit de436820 authored by Milan's avatar Milan
Browse files

fix mergeconflicts

parents 93eed228 028c290c
No related branches found
No related tags found
No related merge requests found
Showing
with 103 additions and 48 deletions
......@@ -24,7 +24,7 @@ Go get it!
[DOWNLOAD IT NOW](https://github.com/minetest-mods/mesecons/archive/master.zip)
Now go ahead and install it like any other Minetest mod. Don't know how? Check out [the wonderful page about it](http://wiki.minetest.com/wiki/Mods) over at the Minetest Wiki. For your convenience, here's a quick summary:
Now go ahead and install it like any other Minetest mod. Don't know how? Check out [the wonderful page about it](https://wiki.minetest.net/Mods) over at the official Minetest Wiki. For your convenience, here's a quick summary:
1. If Mesecons is still in a ZIP file, extract the folder inside to somewhere on the computer.
2. Make sure that when you open the folder, you can directly find `README.md` in the listing. If you just see another folder, move that folder up one level and delete the old one.
......@@ -43,6 +43,8 @@ Or maybe a [comprehensive reference](http://mesecons.net/items.html) is your sty
An overview for the very newest of new beginners? How does [this one](http://uberi.mesecons.net/projects/MeseconsBasics/index.html) look?
There is also a [wiki page](https://wiki.minetest.net/Mods/Mesecons) dedicated to this mod.
Want to get more into building? Why not check out the [Mesecons Laboratory](http://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders?
Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)!
......
......@@ -30,7 +30,7 @@ minetest.register_node("mesecons:mesecon_on", {
},
groups = {dig_immediate=3, not_in_creaive_inventory=1, mesecon=1},
drop = "mesecons:mesecon_off 1",
light_source = default.LIGHT_MAX-11,
light_source = minetest.LIGHT_MAX-11,
mesecons = {conductor={
state = mesecon.state.on,
offstate = "mesecons:mesecon_off"
......
-- SETTINGS
function mesecon.setting(setting, default)
if type(default) == "boolean" then
local read = minetest.setting_getbool("mesecon."..setting)
local read = minetest.settings:get_bool("mesecon."..setting)
if read == nil then
return default
else
return read
end
elseif type(default) == "string" then
return minetest.setting_get("mesecon."..setting) or default
return minetest.settings:get("mesecon."..setting) or default
elseif type(default) == "number" then
return tonumber(minetest.setting_get("mesecon."..setting) or default)
return tonumber(minetest.settings:get("mesecon."..setting) or default)
end
end
......@@ -73,7 +73,7 @@ minetest.register_node("mesecons_button:button_on", {
legacy_wallmounted = true,
walkable = false,
on_rotate = false,
light_source = default.LIGHT_MAX-7,
light_source = minetest.LIGHT_MAX-7,
sunlight_propagates = true,
selection_box = {
type = "fixed",
......
......@@ -158,6 +158,7 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
end,
delayer_time = delaytime,
delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i),
sounds = default.node_sound_stone_defaults(),
mesecons = {
receptor =
{
......
......@@ -2,13 +2,14 @@ local screwdriver_exists = minetest.global_exists("screwdriver")
local corner_nodebox = {
type = "fixed",
-- ±0.001 is to prevent z-fighting
fixed = {{ -16/32-0.001, -17/32, -3/32, 0, -13/32, 3/32 },
{ -3/32, -17/32, -16/32+0.001, 3/32, -13/32, 3/32}}
}
local corner_selectionbox = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -16/32, 5/32, -12/32, 5/32 },
fixed = { -16/32, -16/32, -16/32, 5/32, -12/32, 5/32 },
}
local corner_get_rules = function (node)
......@@ -42,6 +43,7 @@ minetest.register_node("mesecons_extrawires:corner_on", {
node_box = corner_nodebox,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_extrawires:corner_off",
sounds = default.node_sound_defaults(),
mesecons = {conductor =
{
state = mesecon.state.on,
......@@ -71,6 +73,7 @@ minetest.register_node("mesecons_extrawires:corner_off", {
selection_box = corner_selectionbox,
node_box = corner_nodebox,
groups = {dig_immediate = 3},
sounds = default.node_sound_defaults(),
mesecons = {conductor =
{
state = mesecon.state.off,
......
......@@ -32,8 +32,9 @@ minetest.register_node("mesecons_extrawires:crossover_off", {
is_ground_content = false,
walkable = false,
stack_max = 99,
selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}},
selection_box = {type="fixed", fixed={-16/32, -16/32, -16/32, 16/32, -5/32, 16/32}},
groups = {dig_immediate=3, mesecon=3},
sounds = default.node_sound_defaults(),
mesecons = {
conductor = {
states = crossover_states,
......@@ -58,8 +59,9 @@ minetest.register_node("mesecons_extrawires:crossover_01", {
is_ground_content = false,
walkable = false,
stack_max = 99,
selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}},
selection_box = {type="fixed", fixed={-16/32, -16/32, -16/32, 16/32, -5/32, 16/32}},
groups = {dig_immediate=3, mesecon=3, not_in_creative_inventory=1},
sounds = default.node_sound_defaults(),
mesecons = {
conductor = {
states = crossover_states,
......@@ -84,8 +86,9 @@ minetest.register_node("mesecons_extrawires:crossover_10", {
is_ground_content = false,
walkable = false,
stack_max = 99,
selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}},
selection_box = {type="fixed", fixed={-16/32, -16/32, -16/32, 16/32, -5/32, 16/32}},
groups = {dig_immediate=3, mesecon=3, not_in_creative_inventory=1},
sounds = default.node_sound_defaults(),
mesecons = {
conductor = {
states = crossover_states,
......@@ -110,8 +113,9 @@ minetest.register_node("mesecons_extrawires:crossover_on", {
is_ground_content = false,
walkable = false,
stack_max = 99,
selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}},
selection_box = {type="fixed", fixed={-16/32, -16/32, -16/32, 16/32, -5/32, 16/32}},
groups = {dig_immediate=3, mesecon=3, not_in_creative_inventory=1},
sounds = default.node_sound_defaults(),
mesecons = {
conductor = {
states = crossover_states,
......
......@@ -2,13 +2,14 @@ local screwdriver_exists = minetest.global_exists("screwdriver")
local tjunction_nodebox = {
type = "fixed",
-- ±0.001 is to prevent z-fighting
fixed = {{ -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 },
{ -3/32, -17/32, -16/32+0.001, 3/32, -13/32, -3/32},}
}
local tjunction_selectionbox = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -16/32, 16/32+0.001, -12/32, 7/32 },
fixed = { -16/32, -16/32, -16/32, 16/32, -12/32, 7/32 },
}
local tjunction_get_rules = function (node)
......@@ -43,6 +44,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", {
node_box = tjunction_nodebox,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_extrawires:tjunction_off",
sounds = default.node_sound_defaults(),
mesecons = {conductor =
{
state = mesecon.state.on,
......@@ -72,6 +74,7 @@ minetest.register_node("mesecons_extrawires:tjunction_off", {
selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox,
groups = {dig_immediate = 3},
sounds = default.node_sound_defaults(),
mesecons = {conductor =
{
state = mesecon.state.off,
......
......@@ -88,7 +88,8 @@ mesecon.register_node("mesecons_extrawires:vertical", {
is_vertical_conductor = true,
drop = "mesecons_extrawires:vertical_off",
after_place_node = vertical_update,
after_dig_node = vertical_update
after_dig_node = vertical_update,
sounds = default.node_sound_defaults(),
},{
tiles = {"mesecons_wire_off.png"},
groups = {dig_immediate=3},
......@@ -121,7 +122,8 @@ mesecon.register_node("mesecons_extrawires:vertical_top", {
is_vertical_conductor = true,
drop = "mesecons_extrawires:vertical_off",
after_place_node = vertical_update,
after_dig_node = vertical_update
after_dig_node = vertical_update,
sounds = default.node_sound_defaults(),
},{
tiles = {"mesecons_wire_off.png"},
mesecons = {conductor = {
......@@ -152,7 +154,8 @@ mesecon.register_node("mesecons_extrawires:vertical_bottom", {
is_vertical_conductor = true,
drop = "mesecons_extrawires:vertical_off",
after_place_node = vertical_update,
after_dig_node = vertical_update
after_dig_node = vertical_update,
sounds = default.node_sound_defaults(),
},{
tiles = {"mesecons_wire_off.png"},
mesecons = {conductor = {
......
......@@ -22,7 +22,7 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 },
},
sounds = default.node_sound_stone_defaults(),
sounds = default.node_sound_metal_defaults(),
mesecons = {receptor = {
state = mesecon.state.off
}},
......@@ -51,7 +51,7 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 },
},
sounds = default.node_sound_stone_defaults(),
sounds = default.node_sound_metal_defaults(),
mesecons = {receptor = {
state = mesecon.state.on
}},
......
......@@ -27,14 +27,16 @@ minetest.register_node("mesecons_insulated:insulated_on", {
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 }
fixed = { -16/32, -16/32, -7/32, 16/32, -12/32, 7/32 }
},
node_box = {
type = "fixed",
-- ±0.001 is to prevent z-fighting
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_insulated:insulated_off",
sounds = default.node_sound_defaults(),
mesecons = {conductor = {
state = mesecon.state.on,
offstate = "mesecons_insulated:insulated_off",
......@@ -62,13 +64,15 @@ minetest.register_node("mesecons_insulated:insulated_off", {
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 }
fixed = { -16/32, -16/32, -7/32, 16/32, -12/32, 7/32 }
},
node_box = {
type = "fixed",
-- ±0.001 is to prevent z-fighting
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
groups = {dig_immediate = 3},
sounds = default.node_sound_defaults(),
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_insulated:insulated_on",
......
......@@ -198,7 +198,11 @@ end
-------------------------
local function safe_print(param)
local string_meta = getmetatable("")
local sandbox = string_meta.__index
string_meta.__index = string -- Leave string sandbox temporarily
print(dump(param))
string_meta.__index = sandbox -- Restore string sandbox
end
local function safe_date()
......@@ -548,6 +552,7 @@ local function save_memory(pos, meta, mem)
if (#memstring <= memsize_max) then
meta:set_string("lc_memory", memstring)
meta:mark_as_private("lc_memory")
else
print("Error: Luacontroller memory overflow. "..memsize_max.." bytes available, "
..#memstring.." required. Controller overheats.")
......@@ -611,6 +616,7 @@ end
local function reset_formspec(meta, code, errmsg)
meta:set_string("code", code)
meta:mark_as_private("code")
code = minetest.formspec_escape(code or "")
errmsg = minetest.formspec_escape(tostring(errmsg or ""))
meta:set_string("formspec", "size[12,10]"..
......@@ -718,7 +724,7 @@ local function on_receive_fields(pos, form_name, fields, sender)
local ok, err = set_program(pos, fields.code)
if not ok then
-- it's not an error from the server perspective
minetest.log("action", "Lua controller programming error: " .. err)
minetest.log("action", "Lua controller programming error: " .. tostring(err))
end
end
......
......@@ -103,6 +103,12 @@ minetest.register_node(nodename, {
meta:set_string("eeprom", r)
end,
on_receive_fields = function(pos, formanme, fields, sender)
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) and
not minetest.check_player_privs(player_name, {protection_bypass=true}) then
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
if fields.band then
fields.code = "sbi(C, A&B) :A and B are inputs, C is output"
......@@ -272,7 +278,7 @@ yc.parsecode = function(code, pos)
end
yc.parse_get_command = function(code, starti)
i = starti
local i = starti
local s
while s ~= "" do
s = string.sub(code, i, i)
......@@ -298,7 +304,7 @@ yc.parse_get_command = function(code, starti)
end
yc.parse_get_params = function(code, starti)
i = starti
local i = starti
local s
local params = {}
local is_string = false
......@@ -321,7 +327,7 @@ yc.parse_get_params = function(code, starti)
end
yc.parse_get_eeprom_param = function(cond, starti)
i = starti
local i = starti
local s
local addr
while s ~= "" do
......@@ -488,7 +494,7 @@ end
--Condition parsing
yc.command_if_getcondition = function(code, starti)
i = starti
local i = starti
local s
local brackets = 1 --1 Bracket to close
while s ~= "" do
......
......@@ -60,14 +60,16 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
minetest.get_node_timer(frontpos):start(timer_interval)
-- ### Step 3: If sticky, pull stack behind ###
if not is_sticky then
return
end
local backpos = vector.subtract(pos, direction)
success, stack, oldstack = mesecon.mvps_pull_all(backpos, direction, max_pull)
if success then
mesecon.mvps_move_objects(backpos, vector.multiply(direction, -1), oldstack, -1)
if is_sticky then
local backpos = vector.subtract(pos, direction)
success, stack, oldstack = mesecon.mvps_pull_all(backpos, direction, max_pull)
if success then
mesecon.mvps_move_objects(backpos, vector.multiply(direction, -1), oldstack, -1)
end
end
-- ### Step 4: Let things fall ###
minetest.check_for_falling(vector.add(pos, {x=0, y=1, z=0}))
end
def.is_ground_content = false
......@@ -141,12 +143,12 @@ mesecon.register_movestone("mesecons_movestones:movestone_vertical", {
mesecon.register_movestone("mesecons_movestones:sticky_movestone_vertical", {
tiles = {
"jeija_movestone_side.png",
"jeija_movestone_side.png",
"jeija_sticky_movestone.png^[transformFXR90",
"jeija_sticky_movestone.png^[transformR90",
"jeija_sticky_movestone.png^[transformFXR90",
"jeija_sticky_movestone.png^[transformR90",
"jeija_movestone_side.png^(mesecons_glue.png^[opacity:127)",
"jeija_movestone_side.png^(mesecons_glue.png^[opacity:127)",
"jeija_movestone_arrows.png^[transformFXR90",
"jeija_movestone_arrows.png^[transformR90",
"jeija_movestone_arrows.png^[transformFXR90",
"jeija_movestone_arrows.png^[transformR90",
},
groups = {cracky = 3},
description = "Vertical Sticky Movestone",
......
......@@ -45,7 +45,7 @@ local soundnames = {
local node_sounds = {
["default:glass"] = "mesecons_noteblock_hihat",
["default:stone"] = "mesecons_noteblock_kick",
["default:lava_source"] = "fire_large",
["default:lava_source"] = "fire_fire",
["default:chest"] = "mesecons_noteblock_snare",
["default:tree"] = "mesecons_noteblock_crash",
["default:wood"] = "mesecons_noteblock_litecrash",
......
......@@ -326,6 +326,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", {
node_box = piston_pusher_box,
on_rotate = piston_rotate_pusher,
drop = "",
sounds = default.node_sound_wood_defaults(),
})
-- Sticky ones
......@@ -403,6 +404,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", {
node_box = piston_pusher_box,
on_rotate = piston_rotate_pusher,
drop = "",
sounds = default.node_sound_wood_defaults(),
})
......
......@@ -10,7 +10,7 @@ minetest.register_node("mesecons_powerplant:power_plant", {
is_ground_content = false,
walkable = false,
groups = {dig_immediate=3, mesecon = 2},
light_source = default.LIGHT_MAX-9,
light_source = minetest.LIGHT_MAX-9,
description="Power Plant",
selection_box = {
type = "fixed",
......
......@@ -42,8 +42,18 @@ end
-- tiles_on: textures of the pressure plate when active
-- image: inventory and wield image of the pressure plate
-- recipe: crafting recipe of the pressure plate
-- groups: groups
-- sounds: sound table
function mesecon.register_pressure_plate(basename, description, textures_off, textures_on, image_w, image_i, recipe, groups, sounds)
local groups_off, groups_on
if not groups then
groups = {}
end
local groups_off = table.copy(groups)
local groups_on = table.copy(groups)
groups_on.not_in_creative_inventory = 1
function mesecon.register_pressure_plate(basename, description, textures_off, textures_on, image_w, image_i, recipe)
mesecon.register_node(basename, {
drawtype = "nodebox",
inventory_image = image_i,
......@@ -56,17 +66,18 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
on_construct = function(pos)
minetest.get_node_timer(pos):start(mesecon.setting("pplate_interval", 0.1))
end,
sounds = sounds,
},{
mesecons = {receptor = { state = mesecon.state.off, rules = mesecon.rules.pplate }},
node_box = pp_box_off,
selection_box = pp_box_off,
groups = {snappy = 2, oddly_breakable_by_hand = 3},
groups = groups_off,
tiles = textures_off
},{
mesecons = {receptor = { state = mesecon.state.on, rules = mesecon.rules.pplate }},
node_box = pp_box_on,
selection_box = pp_box_on,
groups = {snappy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
groups = groups_on,
tiles = textures_on
})
......@@ -83,7 +94,9 @@ mesecon.register_pressure_plate(
{"jeija_pressure_plate_wood_on.png","jeija_pressure_plate_wood_on.png","jeija_pressure_plate_wood_on_edges.png"},
"jeija_pressure_plate_wood_wield.png",
"jeija_pressure_plate_wood_inv.png",
{{"default:mese_crystal_fragment", "group:wood", "default:mese_crystal_fragment"}})
{{"default:mese_crystal_fragment", "group:wood", "default:mese_crystal_fragment"}}
{ choppy = 3, oddly_breakable_by_hand = 3 },
default.node_sound_wood_defaults())
mesecon.register_pressure_plate(
"mesecons_pressureplates:pressure_plate_stone",
......@@ -92,4 +105,7 @@ mesecon.register_pressure_plate(
{"jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on_edges.png"},
"jeija_pressure_plate_stone_wield.png",
"jeija_pressure_plate_stone_inv.png",
{{"default:mese_crystal_fragment", "default:cobble", "default:mese_crystal_fragment"}})
{{"default:mese_crystal_fragment", "default:cobble", "default:mese_crystal_fragment"}}
{{"default:cobble", "default:cobble"}},
{ cracky = 3, oddly_breakable_by_hand = 3 },
default.node_sound_stone_defaults())
......@@ -56,6 +56,7 @@ mesecon.register_node("mesecons_receiver:receiver", {
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons:wire_00000000_off",
sounds = default.node_sound_defaults(),
}, {
tiles = {
"receiver_top_off.png",
......@@ -104,6 +105,7 @@ mesecon.register_node("mesecons_receiver:receiver_up", {
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons:wire_00000000_off",
sounds = default.node_sound_defaults(),
}, {
tiles = {"mesecons_wire_off.png"},
mesecons = {conductor = {
......@@ -148,6 +150,7 @@ mesecon.register_node("mesecons_receiver:receiver_down", {
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons:wire_00000000_off",
sounds = default.node_sound_defaults(),
}, {
tiles = {"mesecons_wire_off.png"},
mesecons = {conductor = {
......@@ -206,7 +209,6 @@ function mesecon.receiver_place(rcpt_pos)
local param2 = minetest.dir_to_facedir(minetest.facedir_to_dir(node.param2))
if string.find(nn.name, "mesecons:wire_") ~= nil then
minetest.dig_node(pos)
minetest.set_node(pos, {name = rcvtype, param2 = param2})
mesecon.on_placenode(pos, nn)
end
......@@ -215,8 +217,7 @@ end
function mesecon.receiver_remove(rcpt_pos, dugnode)
local pos = mesecon.receiver_get_pos_from_rcpt(rcpt_pos, dugnode.param2)
local nn = minetest.get_node(pos)
if string.find(nn.name, "mesecons_receiver:receiver_") ~=nil then
minetest.dig_node(pos)
if string.find(nn.name, "mesecons_receiver:receiver_") ~= nil then
local node = {name = "mesecons:wire_00000000_off"}
minetest.set_node(pos, node)
mesecon.on_placenode(pos, node)
......
......@@ -60,6 +60,7 @@ minetest.register_node("mesecons_torch:mesecon_torch_off", {
selection_box = torch_selectionbox,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_torch:mesecon_torch_on",
sounds = default.node_sound_defaults(),
mesecons = {receptor = {
state = mesecon.state.off,
rules = torch_get_output_rules
......@@ -79,8 +80,9 @@ minetest.register_node("mesecons_torch:mesecon_torch_on", {
paramtype2 = "wallmounted",
selection_box = torch_selectionbox,
groups = {dig_immediate=3},
light_source = default.LIGHT_MAX-5,
light_source = minetest.LIGHT_MAX-5,
description="Mesecon Torch",
sounds = default.node_sound_defaults(),
mesecons = {receptor = {
state = mesecon.state.on,
rules = torch_get_output_rules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment