Updated farming and mesecons

This commit is contained in:
Billy S 2019-03-29 20:20:31 -04:00
parent 79068f558c
commit 607ae8ffd7
149 changed files with 1658 additions and 897 deletions

View File

@ -13,6 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
### Changelog:
- 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click.
- 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread.
- 1.38 - Pumpkin grows into block, use chopping board to cut into 4x slices, same with melon block, 2x2 slices makes a block, cocoa pods are no longer walkable
- 1.37 - Added custom 'growth_check(pos, nodename) function for crop nodes to use (check cocoa.lua for example)
- 1.36 - Added Beetroot, Beetroot Soup (6x beetroot, 1x bowl), fix register_plant() issue, add new recipes
@ -59,4 +61,4 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
- 0.1 - Fixed growing bug
- 0.0 - Initial release
### Lucky Blocks: 38
### Lucky Blocks: 39

View File

@ -56,3 +56,9 @@ growth_check = function(pos, node_name)
end
return true -- condition not met, skip next growth stage until next check
end,
### Scythe items that will not drop
This is a function to add items to a list that scythes will not drop, e.g. farming:trellis or farming:beanpole.
farming.add_to_scythe_not_drops(item_name)

View File

@ -110,5 +110,13 @@ farming.registered_plants["farming:barley"] = {
seed = "farming:seed_barley",
minlight = 13,
maxlight = 15,
steps = 8
steps = 7
}
-- Fuel
minetest.register_craft({
type = "fuel",
recipe = "farming:barley",
burntime = 1,
})

View File

@ -191,7 +191,7 @@ local crop_def = {
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
attached_node = 1, growing = 1, plant = 1
},
sounds = default.node_sound_leaves_defaults()
}

View File

@ -22,6 +22,7 @@ minetest.register_craftitem("farming:carrot_juice", {
description = S("Carrot Juice"),
inventory_image = "farming_carrot_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1},
})
minetest.register_craft({

View File

@ -186,7 +186,7 @@ local crop_def = {
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
attached_node = 1, growing = 1, plant = 1
},
sounds = default.node_sound_leaves_defaults()
}

View File

@ -47,6 +47,7 @@ minetest.register_craftitem("farming:pineapple_juice", {
description = S("Pineapple Juice"),
inventory_image = "farming_pineapple_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1},
})
minetest.register_craft({

View File

@ -14,7 +14,16 @@ minetest.register_craftitem("farming:potato", {
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
end,
on_use = minetest.item_eat(1),
-- on_use = minetest.item_eat(1),
on_use = function(itemstack, user, pointed_thing)
if user then
if math.random(1, 3) == 1 then
return minetest.do_item_eat(-1, nil, itemstack, user, pointed_thing)
else
return minetest.do_item_eat(1, nil, itemstack, user, pointed_thing)
end
end
end,
})
-- baked potato

View File

@ -17,6 +17,7 @@ minetest.register_craftitem("farming:smoothie_raspberry", {
description = S("Raspberry Smoothie"),
inventory_image = "farming_raspberry_smoothie.png",
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = {vessel = 1},
})
minetest.register_craft({

View File

@ -0,0 +1,162 @@
local S = farming.intllib
--= A nice addition from Ademant's grain mod :)
-- Rye
farming.register_plant("farming:rye", {
description = "Rye seed",
paramtype2 = "meshoptions",
inventory_image = "farming_rye_seed.png",
steps = 8,
place_param2 = 3,
})
minetest.override_item("farming:rye", {
groups = {food_rye = 1, flammable = 4}
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {
"farming:rye", "farming:rye", "farming:rye", "farming:rye",
"farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
-- Oats
farming.register_plant("farming:oat", {
description = "Oat seed",
paramtype2 = "meshoptions",
inventory_image = "farming_oat_seed.png",
steps = 8,
place_param2 = 3,
})
minetest.override_item("farming:oat", {
groups = {food_oats = 1, flammable = 4}
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {
"farming:oat", "farming:oat", "farming:oat", "farming:oat",
"farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
-- Rice
farming.register_plant("farming:rice", {
description = "Rice grains",
paramtype2 = "meshoptions",
inventory_image = "farming_rice_seed.png",
steps = 8,
place_param2 = 3,
})
minetest.override_item("farming:rice", {
groups = {food_rice = 1, flammable = 4}
})
minetest.register_craftitem("farming:rice_bread", {
description = "Rice Bread",
inventory_image = "farming_rice_bread.png",
on_use = minetest.item_eat(5),
groups = {food_rice_bread = 1, flammable = 2},
})
minetest.register_craftitem("farming:rice_flour", {
description = "Rice Flour",
inventory_image = "farming_rice_flour.png",
groups = {food_rice_flour = 1, flammable = 1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:rice_flour",
recipe = {
"farming:rice", "farming:rice", "farming:rice", "farming:rice",
"farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:rice_bread",
recipe = "farming:rice_flour"
})
-- Multigrain flour
minetest.register_craftitem("farming:flour_multigrain", {
description = S("Multigrain Flour"),
inventory_image = "farming_flour_multigrain.png",
groups = {food_flour = 1, flammable = 1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour_multigrain",
recipe = {
"farming:wheat", "farming:barley", "farming:oat",
"farming:rye", "farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
-- Multigrain bread
minetest.register_craftitem("farming:bread_multigrain", {
description = S("Multigrain Bread"),
inventory_image = "farming_bread_multigrain.png",
on_use = minetest.item_eat(7),
groups = {food_bread = 1, flammable = 2},
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread_multigrain",
recipe = "farming:flour_multigrain"
})
-- Fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:rice_bread",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:bread_multigrain",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:rye",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:oat",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:rice",
burntime = 1,
})

View File

@ -29,6 +29,7 @@ farming.pepper = true
farming.pineapple = true
farming.peas = true
farming.beetroot = true
farming.grains = true
-- rarety of crops on map, default is 0.001 (higher number = more crops)
farming.rarety = 0.002

View File

@ -185,4 +185,36 @@ minetest.after(0, function()
},
replacements = {{fluid_return, "bucket:bucket_empty"}}
})
minetest.register_craft({
type = "shapeless",
output = "farming:porridge",
recipe = {
"group:food_oats", "group:food_oats", "group:food_oats",
"group:food_oats", "group:food_bowl", fluid
},
replacements = {{fluid_return, "bucket:bucket_empty"}}
})
end)
--= Jaffa Cake
minetest.register_craftitem("farming:jaffa_cake", {
description = S("Jaffa Cake"),
inventory_image = "farming_jaffa_cake.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
type = "shapeless",
output = "farming:jaffa_cake",
recipe = {
"farming:baking_tray", "group:food_egg", "group:food_sugar",
"group:food_flour", "group:food_cocoa", "group:food_orange",
"group:food_milk"
},
replacements = {
{"farming:baking_tray", "farming:baking_tray"},
{"mobs:bucket_milk", "bucket:bucket_empty"}
}
})

View File

@ -8,6 +8,7 @@ for i = 4, 5 do
max_items = 1,
items = {
{items = {'farming:seed_wheat'}, rarity = 5},
{items = {'farming:seed_oat'},rarity = 5},
{items = {'default:grass_1'}},
}
},
@ -21,7 +22,8 @@ for i = 4, 5 do
drop = {
max_items = 1,
items = {
{items = {'farming:seed_barley'}, rarity = 6},
{items = {'farming:seed_barley'}, rarity = 5},
{items = {'farming:seed_rye'},rarity = 5},
{items = {'default:dry_grass_1'}},
}
},
@ -37,6 +39,7 @@ minetest.override_item("default:junglegrass", {
max_items = 1,
items = {
{items = {'farming:seed_cotton'}, rarity = 8},
{items = {'farming:seed_rice'},rarity = 8},
{items = {'default:junglegrass'}},
}
},

View File

@ -330,3 +330,143 @@ minetest.register_craftitem("farming:hoe_bomb", {
end
end,
})
-- Mithril Scythe (special item)
farming.scythe_not_drops = {"farming:trellis", "farming:beanpole"}
farming.add_to_scythe_not_drops = function(item)
table.insert(farming.scythe_not_drops, item)
end
minetest.register_tool("farming:scythe_mithril", {
description = S("Mithril Scythe (Right-click crop to harvest and replant)"),
inventory_image = "farming_scythe_mithril.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level = 2,
groupcaps = {
fleshy = {times = {[2] = 0.65, [3] = 0.25}, uses = 150, maxlevel = 2},
snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 150, maxlevel = 2},
},
damage_groups = {fleshy = 8},
},
sound = {breaks = "default_tool_breaks"},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local name = placer:get_player_name()
if minetest.is_protected(pos, name) then
return
end
local node = minetest.get_node_or_nil(pos)
if not node then
return
end
local def = minetest.registered_nodes[node.name]
if not def then
return
end
if not def.drop then
return
end
if not def.groups
or not def.groups.plant then
return
end
local drops = minetest.get_node_drops(node.name, "")
if not drops
or #drops == 0
or (#drops == 1 and drops[1] == "") then
return
end
-- get crop name
local mname = node.name:split(":")[1]
local pname = node.name:split(":")[2]
local sname = tonumber(pname:split("_")[2])
pname = pname:split("_")[1]
if not sname then
return
end
-- add dropped items
for _, dropped_item in pairs(drops) do
-- dont drop items on this list
for _, not_item in pairs(farming.scythe_not_drops) do
if dropped_item == not_item then
dropped_item = nil
end
end
if dropped_item then
local obj = minetest.add_item(pos, dropped_item)
if obj then
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 3,
z = math.random(-10, 10) / 9,
})
end
end
end
-- Run script hook
for _, callback in pairs(core.registered_on_dignodes) do
callback(pos, node)
end
-- play sound
minetest.sound_play("default_grass_footstep", {pos = pos, gain = 1.0})
local replace = mname .. ":" .. pname .. "_1"
if minetest.registered_nodes[replace] then
local p2 = minetest.registered_nodes[replace].place_param2 or 1
minetest.set_node(pos, {name = replace, param2 = p2})
else
minetest.set_node(pos, {name = "air"})
end
if not farming.is_creative(name) then
itemstack:add_wear(65535 / 150) -- 150 uses
return itemstack
end
end,
})
if minetest.get_modpath("moreores") then
minetest.register_craft({
output = "farming:scythe_mithril",
recipe = {
{"", "moreores:mithril_ingot", "moreores:mithril_ingot"},
{"moreores:mithril_ingot", "", "group:stick"},
{"", "", "group:stick"}
}
})
end

View File

@ -7,7 +7,7 @@
farming = {
mod = "redo",
version = "20180929",
version = "20190111",
path = minetest.get_modpath("farming"),
select = {
type = "fixed",
@ -457,6 +457,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
minetest.set_node(pt.above, {name = plantname, param2 = p2})
--minetest.get_node_timer(pt.above):start(1)
--farming.handle_growth(pt.above)--, node)
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
@ -591,7 +592,7 @@ farming.registered_plants[mname .. ":" .. pname] = {
minlight = def.minlight,
maxlight = def.maxlight
}
print(dump(farming.registered_plants[mname .. ":" .. pname]))
--print(dump(farming.registered_plants[mname .. ":" .. pname]))
-- Return info
return {seed = mname .. ":seed_" .. pname, harvest = mname .. ":" .. pname}
end
@ -621,6 +622,7 @@ farming.pepper = true
farming.pineapple = true
farming.peas = true
farming.beetroot = true
farming.grains = true
farming.rarety = 0.002 -- 0.006
@ -629,16 +631,14 @@ local input = io.open(farming.path.."/farming.conf", "r")
if input then
dofile(farming.path .. "/farming.conf")
input:close()
input = nil
end
-- load new world-specific settings if found inside world folder
local worldpath = minetest.get_worldpath()
local input = io.open(worldpath.."/farming.conf", "r")
input = io.open(worldpath.."/farming.conf", "r")
if input then
dofile(worldpath .. "/farming.conf")
input:close()
input = nil
end
@ -685,6 +685,7 @@ ddoo("pineapple.lua", farming.pineapple)
ddoo("peas.lua", farming.peas)
ddoo("beetroot.lua", farming.beetroot)
ddoo("chili.lua", farming.chili)
ddoo("ryeoatrice.lua", farming.grains)
dofile(farming.path.."/food.lua")
dofile(farming.path.."/mapgen.lua")

View File

@ -23,7 +23,7 @@ THE SOFTWARE.
License of media (textures):
----------------------------
Created by PilzAdam (License: WTFPL):
Created by PilzAdam (License: CC BY 3.0):
farming_bread.png
farming_soil.png
farming_soil_wet.png
@ -41,7 +41,7 @@ Created by Calinou (License: CC BY-SA):
farming_tool_mesehoe.png
farming_tool_diamondhoe.png
Created by VanessaE (License: WTFPL):
Created by VanessaE (License: CC BY 3.0):
farming_cotton_seed.png
farming_wheat_seed.png
farming_flour.png
@ -63,7 +63,7 @@ Created by VanessaE (License: WTFPL):
farming_cotton_7.png
farming_cotton_8.png
Created by Doc (License: WTFPL):
Created by Doc (License: CC BY 3.0):
farming_cucumber.png
farming_cucumber_1.png
farming_cucumber_2.png
@ -80,7 +80,7 @@ Created by Doc (License: WTFPL):
farming_raspberry_3.png
farming_raspberry_4.png
Created by Gambit:
Created by Gambit (License: CC BY 3.0):
default_junglegrass.png
farming_carrot.png
farming_carrot_1.png
@ -92,7 +92,7 @@ Created by Gambit:
farming_carrot_7.png
farming_carrot_8.png
Created by JoseTheCrafter and edited by TenPlus1:
Created by JoseTheCrafter and edited by TenPlus1 (CC BY 3.0):
farming_tomato.png
farming_tomato_1.png
farming_tomato_2.png
@ -103,7 +103,7 @@ Created by JoseTheCrafter and edited by TenPlus1:
farming_tomato_7.png
farming_tomato_8.png
Created by GeMinecraft and edited by TenPlus1:
Created by GeMinecraft and edited by TenPlus1 (CC BY 3.0):
farming_corn.png
farming_corn_cob.png
farming_corn_1.png
@ -115,7 +115,7 @@ Created by GeMinecraft and edited by TenPlus1:
farming_corn_7.png
farming_corn_8.png
Created by TenPlus1
Created by TenPlus1 (CC BY 3.0)
farming_cocoa_1.png
farming_cocoa_2.png
farming_cocoa_3.png
@ -128,3 +128,14 @@ Created by TenPlus1
farming_rhubarb.png
farming_rhubarb_pie.png
farming_hemp*.png
Created by ademant (CC-BY-3.0)
farming_rye*.png
farming_oat*.png
farming_rice*.png
Created by PilzAdam and edited by SpaghettiToastBook (CC0):
farming_bread_multigrain.png
Created by VanessaE and edited by SpaghettiToastBook (CC0):
farming_flour_multigrain.png

View File

@ -34,6 +34,7 @@ if minetest.get_modpath("lucky_block") then
{"dro", {"farming:hoe_bomb"}, 10},
{"dro", {"farming:turkish_delight"}, 5},
{"lig"},
{"dro", {"farming:scythe_mithril"}, 1},
{"sch", "instafarm", 0, true, {
{"farming:wheat_8", "farming:carrot_8"},
{"farming:cotton_8", "farming:rhubarb_3"},
@ -67,6 +68,9 @@ if minetest.get_modpath("lucky_block") then
{name = "farming:seed_barley", max = 15},
{name = "farming:seed_barley", max = 15},
{name = "farming:seed_hemp", max = 15},
{name = "farming:seed_rye", max = 15},
{name = "farming:seed_rice", max = 15},
{name = "farming:seed_oat", max = 15},
{name = "farming:soil_wet", max = 10},
}},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

View File

@ -22,9 +22,9 @@ OK, I want in.
--------------
Go get it!
[DOWNLOAD IT NOW](https://github.com/Jeija/minetest-mod-mesecons/archive/master.zip)
[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,9 +43,11 @@ 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/Jeija/minetest-mod-mesecons)!
Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)!
Who wrote it anyways?
---------------------

View File

@ -1,64 +0,0 @@
{
"Conductors" : {
"Mesecon" : "mesecons_wires/doc/mesecon",
"Insulated Wire" : "mesecons_insulated/doc/insulated",
"T-Junction" : "mesecons_extrawires/doc/tjunction",
"Crossing" : "mesecons_extrawires/doc/crossing",
"Corner" : "mesecons_extrawires/doc/corner",
"Vertical Wire" : "mesecons_extrawires/doc/vertical",
"Mese" : "mesecons_extrawires/doc/mese"
},
"Receptors" : {
"Power Plant" : "mesecons_powerplant/doc/powerplant",
"Blinky Plant" : "mesecons_blinkyplant/doc/blinkyplant",
"Switch" : "mesecons_switch/doc/switch",
"Object Detector" : "mesecons_detector/doc/objectdetector",
"Node Detector" : "mesecons_detector/doc/nodedetector",
"Wall Lever" : "mesecons_walllever/doc/walllever",
"Pressure Plate" : "mesecons_pressureplates/doc/pressureplate_wood",
"Pressure Plate" : "mesecons_pressureplates/doc/pressureplate_stone",
"Water Turbine" : "mesecons_hydroturbine/doc/waterturbine",
"Solar Panel" : "mesecons_solarpanel/doc/solarpanel",
"Wall Button" : "mesecons_button/doc/button"
},
"Effectors" : {
"Noteblock" : "mesecons_noteblock/doc/noteblock",
"Lamp" : "mesecons_lamp/doc/lamp",
"Piston" : "mesecons_pistons/doc/piston",
"Sticky Piston" : "mesecons_pistons/doc/piston_sticky",
"Movestone" : "mesecons_movestones/doc/movestone",
"Sticky Movestone" : "mesecons_movestones/doc/movestone_sticky",
"Removestone" : "mesecons_random/doc/removestone",
"Ghoststone" : "mesecons_random/doc/ghoststone",
"Command Block" : "mesecons_commandblock/doc/commandblock",
"Lightstones" : {
"Dark Grey" : "mesecons_lightstone/doc/lightstone_darkgrey",
"Light Grey" : "mesecons_lightstone/doc/lightstone_lightgrey",
"Green" : "mesecons_lightstone/doc/lightstone_green",
"Red" : "mesecons_lightstone/doc/lightstone_red",
"Blue" : "mesecons_lightstone/doc/lightstone_blue",
"Yellow" : "mesecons_lightstone/doc/lightstone_yellow"
}
},
"Logic" : {
"Luacontroller" : "mesecons_luacontroller/doc/luacontroller",
"FPGA" : "mesecons_fpga/doc/fpga",
"FPGA Programmer" : "mesecons_fpga/doc/programmer",
"Torch" : "mesecons_torch/doc/torch",
"Delayer" : "mesecons_delayer/doc/delayer",
"Gates" : {
"Diode" : "mesecons_gates/doc/diode",
"NOT Gate" : "mesecons_gates/doc/not",
"AND Gate" : "mesecons_gates/doc/and",
"NAND Gate" : "mesecons_gates/doc/nand",
"OR Gate" : "mesecons_gates/doc/or",
"NOR Gate" : "mesecons_gates/doc/nor",
"XOR Gate" : "mesecons_gates/doc/xor"
}
},
"Crafts" : {
"Silicon" : "mesecons_materials/doc/silicon",
"Glue" : "mesecons_materials/doc/glue",
"Fiber" : "mesecons_materials/doc/fiber"
}
}

View File

@ -548,52 +548,3 @@ function mesecon.is_powered(pos, rule)
if (#sourcepos == 0) then return false
else return sourcepos end
end
--Rules rotation Functions:
function mesecon.rotate_rules_right(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = -rule.z,
y = rule.y,
z = rule.x,
name = rule.name})
end
return nr
end
function mesecon.rotate_rules_left(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = rule.z,
y = rule.y,
z = -rule.x,
name = rule.name})
end
return nr
end
function mesecon.rotate_rules_down(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = -rule.y,
y = rule.x,
z = rule.z,
name = rule.name})
end
return nr
end
function mesecon.rotate_rules_up(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = rule.y,
y = -rule.x,
z = rule.z,
name = rule.name})
end
return nr
end

View File

@ -4,7 +4,7 @@ minetest.register_node("mesecons:mesecon_off", {
inventory_image = "jeija_mesecon_off.png",
wield_image = "jeija_mesecon_off.png",
paramtype = "light",
is_ground_content = true,
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
@ -22,7 +22,7 @@ minetest.register_node("mesecons:mesecon_on", {
drawtype = "raillike",
tiles = {"jeija_mesecon_on.png", "jeija_mesecon_curved_on.png", "jeija_mesecon_t_junction_on.png", "jeija_mesecon_crossing_on.png"},
paramtype = "light",
is_ground_content = true,
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
@ -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"

View File

@ -1,61 +1,85 @@
mesecon.rules = {}
mesecon.state = {}
mesecon.rules.default =
{{x=0, y=0, z=-1},
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=1, y=1, z=0},
{x=1, y=-1, z=0},
{x=-1, y=1, z=0},
{x=-1, y=-1, z=0},
{x=0, y=1, z=1},
{x=0, y=-1, z=1},
{x=0, y=1, z=-1},
{x=0, y=-1, z=-1}}
mesecon.rules.default = {
{x = 0, y = 0, z = -1},
{x = 1, y = 0, z = 0},
{x = -1, y = 0, z = 0},
{x = 0, y = 0, z = 1},
{x = 1, y = 1, z = 0},
{x = 1, y = -1, z = 0},
{x = -1, y = 1, z = 0},
{x = -1, y = -1, z = 0},
{x = 0, y = 1, z = 1},
{x = 0, y = -1, z = 1},
{x = 0, y = 1, z = -1},
{x = 0, y = -1, z = -1},
}
mesecon.rules.pplate = mesecon.mergetable(mesecon.rules.default, {{x=0, y=-2, z=0}})
mesecon.rules.floor = mesecon.mergetable(mesecon.rules.default, {{x = 0, y = -1, z = 0}})
mesecon.rules.buttonlike =
{{x = 1, y = 0, z = 0},
{x = 1, y = 1, z = 0},
{x = 1, y =-1, z = 0},
{x = 1, y =-1, z = 1},
{x = 1, y =-1, z =-1},
{x = 2, y = 0, z = 0}}
mesecon.rules.pplate = mesecon.mergetable(mesecon.rules.floor, {{x = 0, y = -2, z = 0}})
mesecon.rules.flat =
{{x = 1, y = 0, z = 0},
{x =-1, y = 0, z = 0},
{x = 0, y = 0, z = 1},
{x = 0, y = 0, z =-1}}
mesecon.rules.buttonlike = {
{x = 1, y = 0, z = 0},
{x = 1, y = 1, z = 0},
{x = 1, y = -1, z = 0},
{x = 1, y = -1, z = 1},
{x = 1, y = -1, z = -1},
{x = 2, y = 0, z = 0},
}
mesecon.rules.alldirs =
{{x= 1, y= 0, z= 0},
{x=-1, y= 0, z= 0},
{x= 0, y= 1, z= 0},
{x= 0, y=-1, z= 0},
{x= 0, y= 0, z= 1},
{x= 0, y= 0, z=-1}}
mesecon.rules.flat = {
{x = 1, y = 0, z = 0},
{x = -1, y = 0, z = 0},
{x = 0, y = 0, z = 1},
{x = 0, y = 0, z = -1},
}
mesecon.rules.alldirs = {
{x = 1, y = 0, z = 0},
{x = -1, y = 0, z = 0},
{x = 0, y = 1, z = 0},
{x = 0, y = -1, z = 0},
{x = 0, y = 0, z = 1},
{x = 0, y = 0, z = -1},
}
local rules_wallmounted = {
xp = mesecon.rotate_rules_down(mesecon.rules.floor),
xn = mesecon.rotate_rules_up(mesecon.rules.floor),
yp = mesecon.rotate_rules_up(mesecon.rotate_rules_up(mesecon.rules.floor)),
yn = mesecon.rules.floor,
zp = mesecon.rotate_rules_left(mesecon.rotate_rules_up(mesecon.rules.floor)),
zn = mesecon.rotate_rules_right(mesecon.rotate_rules_up(mesecon.rules.floor)),
}
local rules_buttonlike = {
xp = mesecon.rules.buttonlike,
xn = mesecon.rotate_rules_right(mesecon.rotate_rules_right(mesecon.rules.buttonlike)),
yp = mesecon.rotate_rules_down(mesecon.rules.buttonlike),
yn = mesecon.rotate_rules_up(mesecon.rules.buttonlike),
zp = mesecon.rotate_rules_right(mesecon.rules.buttonlike),
zn = mesecon.rotate_rules_left(mesecon.rules.buttonlike),
}
local function rules_from_dir(ruleset, dir)
if dir.x == 1 then return ruleset.xp end
if dir.y == 1 then return ruleset.yp end
if dir.z == 1 then return ruleset.zp end
if dir.x == -1 then return ruleset.xn end
if dir.y == -1 then return ruleset.yn end
if dir.z == -1 then return ruleset.zn end
end
mesecon.rules.wallmounted_get = function(node)
local dir = minetest.wallmounted_to_dir(node.param2)
return rules_from_dir(rules_wallmounted, dir)
end
mesecon.rules.buttonlike_get = function(node)
local rules = mesecon.rules.buttonlike
local dir = minetest.facedir_to_dir(node.param2)
if dir.x == 1 then
-- No action needed
elseif dir.z == -1 then
rules=mesecon.rotate_rules_left(rules)
elseif dir.x == -1 then
rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
elseif dir.z == 1 then
rules=mesecon.rotate_rules_right(rules)
elseif dir.y == -1 then
rules=mesecon.rotate_rules_up(rules)
elseif dir.y == 1 then
rules=mesecon.rotate_rules_down(rules)
end
return rules
return rules_from_dir(rules_buttonlike, dir)
end
mesecon.state.on = "on"

View File

@ -21,7 +21,8 @@ mesecon.on_placenode = function(pos, node)
end
--mesecon.receptor_on (pos, mesecon.conductor_get_rules(node))
elseif mesecon.is_conductor_on(node) then
minetest.swap_node(pos, {name = mesecon.get_conductor_off(node)})
node.name = mesecon.get_conductor_off(node)
minetest.swap_node(pos, node)
end
end
@ -62,34 +63,74 @@ mesecon.on_dignode = function(pos, node)
mesecon.execute_autoconnect_hooks_queue(pos, node)
end
function mesecon.on_blastnode(pos, intensity)
local node = minetest.get_node(pos)
minetest.remove_node(pos)
mesecon.on_dignode(pos, node)
return minetest.get_node_drops(node.name, "")
end
minetest.register_on_placenode(mesecon.on_placenode)
minetest.register_on_dignode(mesecon.on_dignode)
-- Overheating service for fast circuits
local OVERHEAT_MAX = mesecon.setting("overheat_max", 20)
local COOLDOWN_TIME = mesecon.setting("cooldown_time", 2.0)
local COOLDOWN_STEP = mesecon.setting("cooldown_granularity", 0.5)
local COOLDOWN_MULTIPLIER = OVERHEAT_MAX / COOLDOWN_TIME
local cooldown_timer = 0.0
local object_heat = {}
-- returns true if heat is too high
mesecon.do_overheat = function(pos)
local meta = minetest.get_meta(pos)
local heat = meta:get_int("heat") or 0
heat = heat + 1
meta:set_int("heat", heat)
if heat < mesecon.setting("overheat_max", 20) then
mesecon.queue:add_action(pos, "cooldown", {}, 1, nil, 0)
else
function mesecon.do_overheat(pos)
local id = minetest.hash_node_position(pos)
local heat = (object_heat[id] or 0) + 1
object_heat[id] = heat
if heat >= OVERHEAT_MAX then
minetest.log("action", "Node overheats at " .. minetest.pos_to_string(pos))
object_heat[id] = nil
return true
end
return false
end
function mesecon.do_cooldown(pos)
local id = minetest.hash_node_position(pos)
object_heat[id] = nil
end
mesecon.queue:add_function("cooldown", function (pos)
local meta = minetest.get_meta(pos)
local heat = meta:get_int("heat")
function mesecon.get_heat(pos)
local id = minetest.hash_node_position(pos)
return object_heat[id] or 0
end
if (heat > 0) then
meta:set_int("heat", heat - 1)
function mesecon.move_hot_nodes(moved_nodes)
local new_heat = {}
for _, n in ipairs(moved_nodes) do
local old_id = minetest.hash_node_position(n.oldpos)
local new_id = minetest.hash_node_position(n.pos)
new_heat[new_id] = object_heat[old_id]
object_heat[old_id] = nil
end
end)
for id, heat in pairs(new_heat) do
object_heat[id] = heat
end
end
local function global_cooldown(dtime)
cooldown_timer = cooldown_timer + dtime
if cooldown_timer < COOLDOWN_STEP then
return -- don't overload the CPU
end
local cooldown = COOLDOWN_MULTIPLIER * cooldown_timer
cooldown_timer = 0
for id, heat in pairs(object_heat) do
heat = heat - cooldown
if heat <= 0 then
object_heat[id] = nil -- free some RAM
else
object_heat[id] = heat
end
end
end
minetest.register_globalstep(global_cooldown)

View File

@ -6,6 +6,56 @@ function mesecon.move_node(pos, newpos)
minetest.get_meta(pos):from_table(meta)
end
-- Rules rotation Functions:
function mesecon.rotate_rules_right(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = -rule.z,
y = rule.y,
z = rule.x,
name = rule.name})
end
return nr
end
function mesecon.rotate_rules_left(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = rule.z,
y = rule.y,
z = -rule.x,
name = rule.name})
end
return nr
end
function mesecon.rotate_rules_down(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = -rule.y,
y = rule.x,
z = rule.z,
name = rule.name})
end
return nr
end
function mesecon.rotate_rules_up(rules)
local nr = {}
for i, rule in ipairs(rules) do
table.insert(nr, {
x = rule.y,
y = -rule.x,
z = rule.z,
name = rule.name})
end
return nr
end
--
function mesecon.flattenrules(allrules)
--[[
{
@ -178,6 +228,7 @@ end
function mesecon.register_node(name, spec_common, spec_off, spec_on)
spec_common.drop = spec_common.drop or name .. "_off"
spec_common.on_blast = spec_common.on_blast or mesecon.on_blastnode
spec_common.__mesecon_basename = name
spec_on.__mesecon_state = "on"
spec_off.__mesecon_state = "off"

View File

@ -4,12 +4,13 @@
mesecon.button_turnoff = function (pos)
local node = minetest.get_node(pos)
if node.name=="mesecons_button:button_on" then --has not been dug
minetest.swap_node(pos, {name = "mesecons_button:button_off", param2=node.param2})
minetest.sound_play("mesecons_button_pop", {pos=pos})
local rules = mesecon.rules.buttonlike_get(node)
mesecon.receptor_off(pos, rules)
if node.name ~= "mesecons_button:button_on" then -- has been dug
return
end
minetest.swap_node(pos, {name = "mesecons_button:button_off", param2 = node.param2})
minetest.sound_play("mesecons_button_pop", {pos = pos})
local rules = mesecon.rules.buttonlike_get(node)
mesecon.receptor_off(pos, rules)
end
minetest.register_node("mesecons_button:button_off", {
@ -24,6 +25,7 @@ minetest.register_node("mesecons_button:button_off", {
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
legacy_wallmounted = true,
walkable = false,
on_rotate = mesecon.buttonlike_onrotate,
@ -45,13 +47,14 @@ minetest.register_node("mesecons_button:button_off", {
minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2})
mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
minetest.sound_play("mesecons_button_push", {pos=pos})
minetest.after(1, mesecon.button_turnoff, pos)
minetest.get_node_timer(pos):start(1)
end,
sounds = default.node_sound_stone_defaults(),
mesecons = {receptor = {
state = mesecon.state.off,
rules = mesecon.rules.buttonlike_get
}}
}},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("mesecons_button:button_on", {
@ -66,10 +69,11 @@ minetest.register_node("mesecons_button:button_on", {
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
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",
@ -89,7 +93,9 @@ minetest.register_node("mesecons_button:button_on", {
mesecons = {receptor = {
state = mesecon.state.on,
rules = mesecon.rules.buttonlike_get
}}
}},
on_timer = mesecon.button_turnoff,
on_blast = mesecon.on_blastnode,
})
minetest.register_craft({

View File

@ -0,0 +1 @@
mesecons

View File

@ -0,0 +1,2 @@
There is no crafting recipe as this should only be available for server admins. Quite similar to the Minecraft counterpart. Executes server commands.
It works in inactive blocks.

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,212 @@
minetest.register_chatcommand("say", {
params = "<text>",
description = "Say <text> as the server",
privs = {server=true},
func = function(name, param)
minetest.chat_send_all(name .. ": " .. param)
end
})
minetest.register_chatcommand("tell", {
params = "<name> <text>",
description = "Say <text> to <name> privately",
func = function(name, param)
local found, _, target, message = param:find("^([^%s]+)%s+(.*)$")
if found == nil then
minetest.chat_send_player(name, "Invalid usage: " .. param)
return
end
if not minetest.get_player_by_name(target) then
minetest.chat_send_player(name, "Invalid target: " .. target)
end
minetest.chat_send_player(target, name .. " whispers: " .. message, false)
end
})
minetest.register_chatcommand("hp", {
params = "<name> <value>",
description = "Set health of <name> to <value> hitpoints",
privs = {ban=true},
func = function(name, param)
local found, _, target, value = param:find("^([^%s]+)%s+(%d+)$")
if found == nil then
minetest.chat_send_player(name, "Invalid usage: " .. param)
return
end
local player = minetest.get_player_by_name(target)
if player then
player:set_hp(value)
else
minetest.chat_send_player(name, "Invalid target: " .. target)
end
end
})
local function initialize_data(meta)
local commands = minetest.formspec_escape(meta:get_string("commands"))
meta:set_string("formspec",
"invsize[9,5;]" ..
"textarea[0.5,0.5;8.5,4;commands;Commands;"..commands.."]" ..
"label[1,3.8;@nearest, @farthest, and @random are replaced by the respective player names]" ..
"button_exit[3.3,4.5;2,1;submit;Submit]")
local owner = meta:get_string("owner")
if owner == "" then
owner = "not owned"
else
owner = "owned by " .. owner
end
meta:set_string("infotext", "Command Block\n" ..
"(" .. owner .. ")\n" ..
"Commands: "..commands)
end
local function construct(pos)
local meta = minetest.get_meta(pos)
meta:set_string("commands", "tell @nearest Commandblock unconfigured")
meta:set_string("owner", "")
initialize_data(meta)
end
local function after_place(pos, placer)
if placer then
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name())
initialize_data(meta)
end
end
local function receive_fields(pos, formname, fields, sender)
if not fields.submit then
return
end
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if owner ~= "" and sender:get_player_name() ~= owner then
return
end
meta:set_string("commands", fields.commands)
initialize_data(meta)
end
local function resolve_commands(commands, pos)
local players = minetest.get_connected_players()
-- No players online: remove all commands containing
-- @nearest, @farthest and @random
if #players == 0 then
commands = commands:gsub("[^\r\n]+", function (line)
if line:find("@nearest") then return "" end
if line:find("@farthest") then return "" end
if line:find("@random") then return "" end
return line
end)
return commands
end
local nearest, farthest = nil, nil
local min_distance, max_distance = math.huge, -1
for index, player in pairs(players) do
local distance = vector.distance(pos, player:getpos())
if distance < min_distance then
min_distance = distance
nearest = player:get_player_name()
end
if distance > max_distance then
max_distance = distance
farthest = player:get_player_name()
end
end
local random = players[math.random(#players)]:get_player_name()
commands = commands:gsub("@nearest", nearest)
commands = commands:gsub("@farthest", farthest)
commands = commands:gsub("@random", random)
return commands
end
local function commandblock_action_on(pos, node)
if node.name ~= "mesecons_commandblock:commandblock_off" then
return
end
minetest.swap_node(pos, {name = "mesecons_commandblock:commandblock_on"})
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if owner == "" then
return
end
local commands = resolve_commands(meta:get_string("commands"), pos)
for _, command in pairs(commands:split("\n")) do
local pos = command:find(" ")
local cmd, param = command, ""
if pos then
cmd = command:sub(1, pos - 1)
param = command:sub(pos + 1)
end
local cmddef = minetest.chatcommands[cmd]
if not cmddef then
minetest.chat_send_player(owner, "The command "..cmd.." does not exist")
return
end
local has_privs, missing_privs = minetest.check_player_privs(owner, cmddef.privs)
if not has_privs then
minetest.chat_send_player(owner, "You don't have permission "
.."to run "..cmd
.." (missing privileges: "
..table.concat(missing_privs, ", ")..")")
return
end
cmddef.func(owner, param)
end
end
local function commandblock_action_off(pos, node)
if node.name == "mesecons_commandblock:commandblock_on" then
minetest.swap_node(pos, {name = "mesecons_commandblock:commandblock_off"})
end
end
local function can_dig(pos, player)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
return owner == "" or owner == player:get_player_name()
end
minetest.register_node("mesecons_commandblock:commandblock_off", {
description = "Command Block",
tiles = {"jeija_commandblock_off.png"},
inventory_image = minetest.inventorycube("jeija_commandblock_off.png"),
is_ground_content = false,
groups = {cracky=2, mesecon_effector_off=1},
on_construct = construct,
after_place_node = after_place,
on_receive_fields = receive_fields,
can_dig = can_dig,
sounds = default.node_sound_stone_defaults(),
mesecons = {effector = {
action_on = commandblock_action_on
}},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("mesecons_commandblock:commandblock_on", {
tiles = {"jeija_commandblock_on.png"},
is_ground_content = false,
groups = {cracky=2, mesecon_effector_on=1, not_in_creative_inventory=1},
light_source = 10,
drop = "mesecons_commandblock:commandblock_off",
on_construct = construct,
after_place_node = after_place,
on_receive_fields = receive_fields,
can_dig = can_dig,
sounds = default.node_sound_stone_defaults(),
mesecons = {effector = {
action_off = commandblock_action_off
}},
on_blast = mesecon.on_blastnode,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -1 +1 @@
The delayer delays the signal from the input for a determined time. The time can be set by punching the delayer. Possible delays are: 0.1 seconds, 0.3 seconds, 0.5 seconds and 1 second. You may try to use it for creating songs with the noteblock.
The delayer delays the signal from the input for a determined time. The time can be set by punching the delayer. Possible delays are: 0.1 seconds, 0.3 seconds, 0.5 seconds and 1 second. You may try to use it for creating songs with the noteblock. It works in unloaded blocks.

View File

@ -87,7 +87,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
is_ground_content = true,
is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1',
on_punch = function (pos, node)
if node.name=="mesecons_delayer:delayer_off_1" then
@ -114,7 +114,8 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
rules = delayer_get_input_rules,
action_on = delayer_activate
}
}
},
on_blast = mesecon.on_blastnode,
})
@ -142,7 +143,7 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
is_ground_content = true,
is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1',
on_punch = function (pos, node)
if node.name=="mesecons_delayer:delayer_on_1" then
@ -157,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 =
{
@ -168,7 +170,8 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
rules = delayer_get_input_rules,
action_off = delayer_deactivate
}
}
},
on_blast = mesecon.on_blastnode,
})
end

View File

@ -1,12 +1,15 @@
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)
@ -33,18 +36,22 @@ minetest.register_node("mesecons_extrawires:corner_on", {
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
walkable = false,
sunlight_propagates = true,
selection_box = corner_selectionbox,
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,
rules = corner_get_rules,
offstate = "mesecons_extrawires:corner_off"
}}
}},
on_blast = mesecon.on_blastnode,
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
})
minetest.register_node("mesecons_extrawires:corner_off", {
@ -60,17 +67,21 @@ minetest.register_node("mesecons_extrawires:corner_off", {
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
walkable = false,
sunlight_propagates = true,
selection_box = corner_selectionbox,
node_box = corner_nodebox,
groups = {dig_immediate = 3},
sounds = default.node_sound_defaults(),
mesecons = {conductor =
{
state = mesecon.state.off,
rules = corner_get_rules,
onstate = "mesecons_extrawires:corner_on"
}}
}},
on_blast = mesecon.on_blastnode,
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
})
minetest.register_craft({

View File

@ -29,16 +29,19 @@ minetest.register_node("mesecons_extrawires:crossover_off", {
"jeija_insulated_wire_ends_off.png"
},
paramtype = "light",
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,
rules = crossover_get_rules(),
}
},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("mesecons_extrawires:crossover_01", {
@ -53,16 +56,19 @@ minetest.register_node("mesecons_extrawires:crossover_01", {
"jeija_insulated_wire_ends_off.png"
},
paramtype = "light",
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,
rules = crossover_get_rules(),
}
},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("mesecons_extrawires:crossover_10", {
@ -77,16 +83,19 @@ minetest.register_node("mesecons_extrawires:crossover_10", {
"jeija_insulated_wire_ends_on.png"
},
paramtype = "light",
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,
rules = crossover_get_rules(),
}
},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("mesecons_extrawires:crossover_on", {
@ -101,16 +110,19 @@ minetest.register_node("mesecons_extrawires:crossover_on", {
"jeija_insulated_wire_ends_on.png"
},
paramtype = "light",
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,
rules = crossover_get_rules(),
}
},
on_blast = mesecon.on_blastnode,
})
minetest.register_craft({

View File

@ -1,2 +1,3 @@
default
mesecons
screwdriver?

View File

@ -1 +1 @@
Insulated corners are conductors that only conduct between the inputs (also not up or down). When placing they always point to the left in direction of your vision.
Insulated corners are conductors that only conduct between the inputs (also not up or down). When placing they always point to the left in direction of your vision. Like uninsulated wires, they work through unloaded blocks.

View File

@ -1 +1 @@
Insulated crossing are conductors that conduct two signals between the opposing sides, the signals are insulated to each other.
Insulated crossing are conductors that conduct two signals between the opposing sides, the signals are insulated to each other. Like uninsulated wires, they work through unloaded blocks.

View File

@ -1 +1 @@
The basic prerequesite for mesecons, can be crafted into wires and other stuff. Have a look at the <a href="http://wiki.minetest.net/Mese">Minetest Wiki</a> for more information. Mese is a conductor. It conducts in all six directions: Up/Down/Left/Right/Forward/Backward
The basic prerequesite for mesecons, can be crafted into wires and other stuff. Have a look at the <a href="http://wiki.minetest.net/Mese">Minetest Wiki</a> for more information. Mese is a conductor. It conducts in all six directions: Up/Down/Left/Right/Forward/Backward. Like horizontal wires, Mese conduction works through unloaded blocks.

View File

@ -1 +1 @@
Insulated T-Junctions are conductors that only conduct between the inputs (also not up or down).
Insulated T-Junctions are conductors that only conduct between the inputs (also not up or down). Like uninsulated wires, they work through unloaded blocks.

View File

@ -1 +1 @@
Vertical Mesecons only conduct up and down. Plates appear at the ends, at that place they also conduct to the side.
Vertical Mesecons only conduct up and down. Plates appear at the ends, at that place they also conduct to the side. Like horizontal wires, they work through unloaded blocks.

View File

@ -1,5 +1,5 @@
--dofile(minetest.get_modpath("mesecons_extrawires").."/crossover.lua");
--dofile(minetest.get_modpath("mesecons_extrawires").."/tjunction.lua");
--dofile(minetest.get_modpath("mesecons_extrawires").."/corner.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/crossover.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/tjunction.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/corner.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/mesewire.lua");

View File

@ -26,7 +26,8 @@ local powered_def = mesecon.mergetable(minetest.registered_nodes["default:mese"]
offstate = "default:mese",
rules = mesewire_rules
}},
groups = {cracky = 1, not_in_creative_inventory = 1}
groups = {cracky = 1, not_in_creative_inventory = 1},
on_blast = mesecon.on_blastnode,
})
for i, v in pairs(powered_def.tiles) do

View File

@ -1,12 +1,15 @@
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)
@ -34,18 +37,22 @@ minetest.register_node("mesecons_extrawires:tjunction_on", {
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
walkable = false,
sunlight_propagates = true,
selection_box = tjunction_selectionbox,
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,
rules = tjunction_get_rules,
offstate = "mesecons_extrawires:tjunction_off"
}}
}},
on_blast = mesecon.on_blastnode,
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
})
minetest.register_node("mesecons_extrawires:tjunction_off", {
@ -61,17 +68,21 @@ minetest.register_node("mesecons_extrawires:tjunction_off", {
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
walkable = false,
sunlight_propagates = true,
selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox,
groups = {dig_immediate = 3},
sounds = default.node_sound_defaults(),
mesecons = {conductor =
{
state = mesecon.state.off,
rules = tjunction_get_rules,
onstate = "mesecons_extrawires:tjunction_on"
}}
}},
on_blast = mesecon.on_blastnode,
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
})
minetest.register_craft({

View File

@ -77,17 +77,19 @@ end
-- Vertical wire
mesecon.register_node("mesecons_extrawires:vertical", {
description = "Vertical mesecon",
description = "Vertical Mesecon",
drawtype = "nodebox",
walkable = false,
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
selection_box = vertical_box,
node_box = vertical_box,
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},
@ -112,6 +114,7 @@ mesecon.register_node("mesecons_extrawires:vertical_top", {
drawtype = "nodebox",
walkable = false,
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
groups = {dig_immediate=3, not_in_creative_inventory=1},
selection_box = top_box,
@ -119,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 = {
@ -142,6 +146,7 @@ mesecon.register_node("mesecons_extrawires:vertical_bottom", {
drawtype = "nodebox",
walkable = false,
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
selection_box = bottom_box,
@ -149,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 = {

View File

@ -0,0 +1,2 @@
mesecons
screwdriver?

View File

@ -0,0 +1 @@
Insulated mesecons are conductors that only conduct in one direction (and also not up or down). Like uninsulated wires, they work through unloaded blocks.

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,92 @@
local screwdriver_exists = minetest.global_exists("screwdriver")
local function insulated_wire_get_rules(node)
local rules = {{x = 1, y = 0, z = 0},
{x =-1, y = 0, z = 0}}
if node.param2 == 1 or node.param2 == 3 then
return mesecon.rotate_rules_right(rules)
end
return rules
end
minetest.register_node("mesecons_insulated:insulated_on", {
drawtype = "nodebox",
description = "Straight Insulated Mesecon",
tiles = {
"jeija_insulated_wire_sides_on.png",
"jeija_insulated_wire_sides_on.png",
"jeija_insulated_wire_ends_on.png",
"jeija_insulated_wire_ends_on.png",
"jeija_insulated_wire_sides_on.png",
"jeija_insulated_wire_sides_on.png"
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
walkable = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
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",
rules = insulated_wire_get_rules
}},
on_blast = mesecon.on_blastnode,
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
})
minetest.register_node("mesecons_insulated:insulated_off", {
drawtype = "nodebox",
description = "Straight Insulated Mesecon",
tiles = {
"jeija_insulated_wire_sides_off.png",
"jeija_insulated_wire_sides_off.png",
"jeija_insulated_wire_ends_off.png",
"jeija_insulated_wire_ends_off.png",
"jeija_insulated_wire_sides_off.png",
"jeija_insulated_wire_sides_off.png"
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
walkable = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
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",
rules = insulated_wire_get_rules
}},
on_blast = mesecon.on_blastnode,
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
})
minetest.register_craft({
output = "mesecons_insulated:insulated_off 3",
recipe = {
{"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"},
{"mesecons:wire_00000000_off", "mesecons:wire_00000000_off", "mesecons:wire_00000000_off"},
{"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"},
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View File

@ -0,0 +1 @@
mesecons

View File

@ -0,0 +1 @@
Craftitem: It can't be placed! Made by cooking glue in the furnace. Used for insulated mesecon crafting.

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1 @@
Craftitem: It can't be placed! Made by cooking saplings in furnace. Used for sticky pistons and sticky movestones.

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

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