Compare commits
28 Commits
e1cffdedbf
...
1963bfcc0d
Author | SHA1 | Date | |
---|---|---|---|
1963bfcc0d | |||
65793514fe | |||
6936c8c2e4 | |||
f5c3f798be | |||
69d4a9584d | |||
3f75c06a3b | |||
2fc1682c04 | |||
93aa24dc42 | |||
93f155f604 | |||
9b835053c2 | |||
583d2c1441 | |||
397d449f1e | |||
29ec26a4c8 | |||
0d86f2c45e | |||
d356f901a3 | |||
6921909100 | |||
3202bf6786 | |||
fedbf49372 | |||
9fda51b650 | |||
4750925eab | |||
16836b16d6 | |||
c1eccba247 | |||
01332a7ba1 | |||
de4eeebd3b | |||
75bd1e8be6 | |||
95e6e2e4a5 | |||
168a923665 | |||
8dec053996 |
@ -1 +0,0 @@
|
||||
default
|
62
mesecons/fifo_queue.lua
Normal file
@ -0,0 +1,62 @@
|
||||
|
||||
-- a simple first-in-first-out queue
|
||||
-- very similar to the one in https://github.com/minetest/minetest/pull/7683
|
||||
|
||||
local fifo_queue = {}
|
||||
|
||||
local metatable = {__index = fifo_queue}
|
||||
|
||||
-- creates a new empty queue
|
||||
function fifo_queue.new()
|
||||
local q = {n_in = 0, n_out = 0, i_out = 1, buf_in = {}, buf_out = {}}
|
||||
setmetatable(q, metatable)
|
||||
return q
|
||||
end
|
||||
|
||||
-- adds an element to the queue
|
||||
function fifo_queue.add(self, v)
|
||||
local n = self.n_in + 1
|
||||
self.n_in = n
|
||||
self.buf_in[n] = v
|
||||
end
|
||||
|
||||
-- removes and returns the next element, or nil of empty
|
||||
function fifo_queue.take(self)
|
||||
local i_out = self.i_out
|
||||
if i_out <= self.n_out then
|
||||
local v = self.buf_out[i_out]
|
||||
self.i_out = i_out + 1
|
||||
self.buf_out[i_out] = true
|
||||
return v
|
||||
end
|
||||
|
||||
-- buf_out is empty, try to swap
|
||||
self.i_out = 1
|
||||
self.n_out = 0
|
||||
if self.n_in == 0 then
|
||||
return nil -- empty
|
||||
end
|
||||
|
||||
-- swap
|
||||
self.n_out = self.n_in
|
||||
self.n_in = 0
|
||||
self.buf_out, self.buf_in = self.buf_in, self.buf_out
|
||||
|
||||
local v = self.buf_out[1]
|
||||
self.i_out = 2
|
||||
self.buf_out[1] = true
|
||||
return v
|
||||
end
|
||||
|
||||
-- returns whether the queue is empty
|
||||
function fifo_queue.is_empty(self)
|
||||
return self.n_out == self.i_out + 1 and self.n_in == 0
|
||||
end
|
||||
|
||||
-- returns stuff for iteration in a for loop, like pairs
|
||||
-- adding new elements while iterating is no problem
|
||||
function fifo_queue.iter(self)
|
||||
return fifo_queue.take, self, nil
|
||||
end
|
||||
|
||||
return fifo_queue
|
@ -11,7 +11,7 @@
|
||||
|
||||
-- RECEPTORS
|
||||
-- mesecon.is_receptor(nodename) --> Returns true if nodename is a receptor
|
||||
-- mesecon.is_receptor_on(nodename --> Returns true if nodename is an receptor with state = mesecon.state.on
|
||||
-- mesecon.is_receptor_on(nodename) --> Returns true if nodename is an receptor with state = mesecon.state.on
|
||||
-- mesecon.is_receptor_off(nodename) --> Returns true if nodename is an receptor with state = mesecon.state.off
|
||||
-- mesecon.receptor_get_rules(node) --> Returns the rules of the receptor (mesecon.rules.default if none specified)
|
||||
|
||||
@ -46,6 +46,8 @@
|
||||
-- mesecon.rotate_rules_down(rules)
|
||||
-- These functions return rules that have been rotated in the specific direction
|
||||
|
||||
local fifo_queue = dofile(minetest.get_modpath("mesecons").."/fifo_queue.lua")
|
||||
|
||||
-- General
|
||||
function mesecon.get_effector(nodename)
|
||||
if minetest.registered_nodes[nodename]
|
||||
@ -92,8 +94,8 @@ function mesecon.get_any_inputrules(node)
|
||||
end
|
||||
|
||||
function mesecon.get_any_rules(node)
|
||||
return mesecon.mergetable(mesecon.get_any_inputrules(node) or {},
|
||||
mesecon.get_any_outputrules(node) or {})
|
||||
return mesecon.merge_rule_sets(mesecon.get_any_inputrules(node),
|
||||
mesecon.get_any_outputrules(node))
|
||||
end
|
||||
|
||||
-- Receptors
|
||||
@ -371,32 +373,39 @@ end
|
||||
-- Follow all all conductor paths replacing conductors that were already
|
||||
-- looked at, activating / changing all effectors along the way.
|
||||
function mesecon.turnon(pos, link)
|
||||
local frontiers = {{pos = pos, link = link}}
|
||||
local frontiers = fifo_queue.new()
|
||||
frontiers:add({pos = pos, link = link})
|
||||
local pos_can_be_skipped = {}
|
||||
|
||||
local depth = 1
|
||||
while frontiers[1] do
|
||||
local f = table.remove(frontiers, 1)
|
||||
for f in frontiers:iter() do
|
||||
local node = mesecon.get_node_force(f.pos)
|
||||
|
||||
if not node then
|
||||
-- Area does not exist; do nothing
|
||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||
elseif mesecon.is_conductor_off(node, f.link) then
|
||||
local rules = mesecon.conductor_get_rules(node)
|
||||
|
||||
-- Call turnon on neighbors
|
||||
for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do
|
||||
local np = vector.add(f.pos, r)
|
||||
for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do
|
||||
table.insert(frontiers, {pos = np, link = l})
|
||||
if not pos_can_be_skipped[minetest.hash_node_position(np)] then
|
||||
for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do
|
||||
frontiers:add({pos = np, link = l})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mesecon.swap_node_force(f.pos, mesecon.get_conductor_on(node, f.link))
|
||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||
elseif mesecon.is_effector(node.name) then
|
||||
mesecon.changesignal(f.pos, node, f.link, mesecon.state.on, depth)
|
||||
if mesecon.is_effector_off(node.name) then
|
||||
mesecon.activate(f.pos, node, f.link, depth)
|
||||
end
|
||||
else
|
||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||
end
|
||||
depth = depth + 1
|
||||
end
|
||||
@ -419,37 +428,42 @@ end
|
||||
-- depth = indicates order in which signals wire fired, higher is later
|
||||
-- }
|
||||
function mesecon.turnoff(pos, link)
|
||||
local frontiers = {{pos = pos, link = link}}
|
||||
local frontiers = fifo_queue.new()
|
||||
frontiers:add({pos = pos, link = link})
|
||||
local signals = {}
|
||||
local pos_can_be_skipped = {}
|
||||
|
||||
local depth = 1
|
||||
while frontiers[1] do
|
||||
local f = table.remove(frontiers, 1)
|
||||
for f in frontiers:iter() do
|
||||
local node = mesecon.get_node_force(f.pos)
|
||||
|
||||
if not node then
|
||||
-- Area does not exist; do nothing
|
||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||
elseif mesecon.is_conductor_on(node, f.link) then
|
||||
local rules = mesecon.conductor_get_rules(node)
|
||||
for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do
|
||||
local np = vector.add(f.pos, r)
|
||||
|
||||
-- Check if an onstate receptor is connected. If that is the case,
|
||||
-- abort this turnoff process by returning false. `receptor_off` will
|
||||
-- discard all the changes that we made in the voxelmanip:
|
||||
for _, l in ipairs(mesecon.rules_link_rule_all_inverted(f.pos, r)) do
|
||||
if mesecon.is_receptor_on(mesecon.get_node_force(np).name) then
|
||||
return false
|
||||
if not pos_can_be_skipped[minetest.hash_node_position(np)] then
|
||||
-- Check if an onstate receptor is connected. If that is the case,
|
||||
-- abort this turnoff process by returning false. `receptor_off` will
|
||||
-- discard all the changes that we made in the voxelmanip:
|
||||
if mesecon.rules_link_rule_all_inverted(f.pos, r)[1] then
|
||||
if mesecon.is_receptor_on(mesecon.get_node_force(np).name) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Call turnoff on neighbors
|
||||
for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do
|
||||
table.insert(frontiers, {pos = np, link = l})
|
||||
-- Call turnoff on neighbors
|
||||
for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do
|
||||
frontiers:add({pos = np, link = l})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mesecon.swap_node_force(f.pos, mesecon.get_conductor_off(node, f.link))
|
||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||
elseif mesecon.is_effector(node.name) then
|
||||
table.insert(signals, {
|
||||
pos = f.pos,
|
||||
@ -457,6 +471,8 @@ function mesecon.turnoff(pos, link)
|
||||
link = f.link,
|
||||
depth = depth
|
||||
})
|
||||
else
|
||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||
end
|
||||
depth = depth + 1
|
||||
end
|
||||
|
2
mesecons/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons
|
||||
depends = default
|
@ -16,9 +16,9 @@ mesecon.rules.default = {
|
||||
{x = 0, y = -1, z = -1},
|
||||
}
|
||||
|
||||
mesecon.rules.floor = mesecon.mergetable(mesecon.rules.default, {{x = 0, y = -1, z = 0}})
|
||||
mesecon.rules.floor = mesecon.merge_rule_sets(mesecon.rules.default, {{x = 0, y = -1, z = 0}})
|
||||
|
||||
mesecon.rules.pplate = mesecon.mergetable(mesecon.rules.floor, {{x = 0, y = -2, z = 0}})
|
||||
mesecon.rules.pplate = mesecon.merge_rule_sets(mesecon.rules.floor, {{x = 0, y = -2, z = 0}})
|
||||
|
||||
mesecon.rules.buttonlike = {
|
||||
{x = 1, y = 0, z = 0},
|
||||
|
@ -193,19 +193,29 @@ function mesecon.tablecopy(obj) -- deep copy
|
||||
return obj
|
||||
end
|
||||
|
||||
-- Returns whether two values are equal.
|
||||
-- In tables, keys are compared for identity but values are compared recursively.
|
||||
-- There is no protection from infinite recursion.
|
||||
function mesecon.cmpAny(t1, t2)
|
||||
if type(t1) ~= type(t2) then return false end
|
||||
if type(t1) ~= "table" and type(t2) ~= "table" then return t1 == t2 end
|
||||
if type(t1) ~= "table" then return t1 == t2 end
|
||||
|
||||
-- Check that for each key of `t1` both tables have the same value
|
||||
for i, e in pairs(t1) do
|
||||
if not mesecon.cmpAny(e, t2[i]) then return false end
|
||||
end
|
||||
|
||||
-- Check that all keys of `t2` are also keys of `t1` so were checked in the previous loop
|
||||
for i, _ in pairs(t2) do
|
||||
if t1[i] == nil then return false end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- does not overwrite values; number keys (ipairs) are appended, not overwritten
|
||||
-- Deprecated. Use `merge_tables` or `merge_rule_sets` as appropriate.
|
||||
function mesecon.mergetable(source, dest)
|
||||
minetest.log("warning", debug.traceback("Deprecated call to mesecon.mergetable"))
|
||||
local rval = mesecon.tablecopy(dest)
|
||||
|
||||
for k, v in pairs(source) do
|
||||
@ -218,6 +228,32 @@ function mesecon.mergetable(source, dest)
|
||||
return rval
|
||||
end
|
||||
|
||||
-- Merges several rule sets in one. Order may not be preserved. Nil arguments
|
||||
-- are ignored.
|
||||
-- The rule sets must be of the same kind (either all single-level or all two-level).
|
||||
-- The function may be changed to normalize the resulting set in some way.
|
||||
function mesecon.merge_rule_sets(...)
|
||||
local rval = {}
|
||||
for _, t in pairs({...}) do -- ignores nils automatically
|
||||
table.insert_all(rval, mesecon.tablecopy(t))
|
||||
end
|
||||
return rval
|
||||
end
|
||||
|
||||
-- Merges two tables, with entries from `replacements` taking precedence over
|
||||
-- those from `base`. Returns the new table.
|
||||
-- Values are deep-copied from either table, keys are referenced.
|
||||
-- Numerical indices aren’t handled specially.
|
||||
function mesecon.merge_tables(base, replacements)
|
||||
local ret = mesecon.tablecopy(replacements) -- these are never overriden so have to be copied in any case
|
||||
for k, v in pairs(base) do
|
||||
if ret[k] == nil then -- it could be `false`
|
||||
ret[k] = mesecon.tablecopy(v)
|
||||
end
|
||||
end
|
||||
return ret
|
||||
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
|
||||
@ -225,8 +261,8 @@ function mesecon.register_node(name, spec_common, spec_off, spec_on)
|
||||
spec_on.__mesecon_state = "on"
|
||||
spec_off.__mesecon_state = "off"
|
||||
|
||||
spec_on = mesecon.mergetable(spec_common, spec_on);
|
||||
spec_off = mesecon.mergetable(spec_common, spec_off);
|
||||
spec_on = mesecon.merge_tables(spec_common, spec_on);
|
||||
spec_off = mesecon.merge_tables(spec_common, spec_off);
|
||||
|
||||
minetest.register_node(name .. "_on", spec_on)
|
||||
minetest.register_node(name .. "_off", spec_off)
|
||||
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_alias/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_alias
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -32,7 +32,13 @@ mesecon.register_node("mesecons_blinkyplant:blinky_plant", {
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
|
||||
},
|
||||
on_timer = on_timer,
|
||||
on_rightclick = toggle_timer,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if minetest.is_protected(pos, clicker and clicker:get_player_name() or "") then
|
||||
return
|
||||
end
|
||||
|
||||
toggle_timer(pos)
|
||||
end,
|
||||
on_construct = toggle_timer
|
||||
},{
|
||||
tiles = {"jeija_blinky_plant_off.png"},
|
||||
|
2
mesecons_blinkyplant/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_blinkyplant
|
||||
depends = mesecons
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
mesecons_receiver
|
@ -8,21 +8,24 @@ mesecon.button_turnoff = function (pos)
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = "mesecons_button:button_off", param2 = node.param2})
|
||||
minetest.sound_play("mesecons_button_pop", {pos = pos})
|
||||
minetest.sound_play("mesecons_button_pop", { pos = pos }, true)
|
||||
local rules = mesecon.rules.buttonlike_get(node)
|
||||
mesecon.receptor_off(pos, rules)
|
||||
end
|
||||
|
||||
local use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or nil
|
||||
|
||||
minetest.register_node("mesecons_button:button_off", {
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_off.png"
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_off.png"
|
||||
},
|
||||
use_texture_alpha = use_texture_alpha,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
@ -46,7 +49,7 @@ minetest.register_node("mesecons_button:button_off", {
|
||||
on_rightclick = function (pos, node)
|
||||
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.sound_play("mesecons_button_push", { pos = pos }, true)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
@ -66,7 +69,8 @@ minetest.register_node("mesecons_button:button_on", {
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_sides.png",
|
||||
"jeija_wall_button_on.png"
|
||||
},
|
||||
},
|
||||
use_texture_alpha = use_texture_alpha,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
|
2
mesecons_button/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_button
|
||||
depends = mesecons, mesecons_receiver
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -10,6 +10,7 @@ minetest.register_chatcommand("say", {
|
||||
minetest.register_chatcommand("tell", {
|
||||
params = "<name> <text>",
|
||||
description = "Say <text> to <name> privately",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
local found, _, target, message = param:find("^([^%s]+)%s+(.*)$")
|
||||
if found == nil then
|
||||
@ -110,7 +111,7 @@ local function resolve_commands(commands, pos)
|
||||
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())
|
||||
local distance = vector.distance(pos, player:get_pos())
|
||||
if distance < min_distance then
|
||||
min_distance = distance
|
||||
nearest = player:get_player_name()
|
||||
@ -174,7 +175,8 @@ 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()
|
||||
return owner == "" or owner == player:get_player_name() or
|
||||
minetest.check_player_privs(player, "protection_bypass")
|
||||
end
|
||||
|
||||
minetest.register_node("mesecons_commandblock:commandblock_off", {
|
||||
|
2
mesecons_commandblock/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_commandblock
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -54,6 +54,7 @@ local boxes = {
|
||||
-- Delayer definition defaults
|
||||
local def = {
|
||||
drawtype = "nodebox",
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or nil,
|
||||
walkable = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
@ -93,7 +94,7 @@ local off_state = {
|
||||
wield_image = "mesecons_delayer_off_1.png",
|
||||
groups = off_groups,
|
||||
on_punch = function(pos, node, puncher)
|
||||
if minetest.is_protected(pos, puncher and puncher:get_player_name()) then
|
||||
if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then
|
||||
return
|
||||
end
|
||||
|
||||
@ -134,7 +135,7 @@ local on_state = {
|
||||
},
|
||||
groups = {bendy = 2, snappy = 1, dig_immediate = 2, not_in_creative_inventory = 1},
|
||||
on_punch = function(pos, node, puncher)
|
||||
if minetest.is_protected(pos, puncher and puncher:get_player_name()) then
|
||||
if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then
|
||||
return
|
||||
end
|
||||
|
||||
|
2
mesecons_delayer/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_delayer
|
||||
depends = mesecons
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
mesecons_materials
|
@ -239,7 +239,7 @@ local node_detector_digiline = {
|
||||
}
|
||||
|
||||
local function after_place_node_detector(pos, placer)
|
||||
local placer_pos = placer:getpos()
|
||||
local placer_pos = placer:get_pos()
|
||||
if not placer_pos then
|
||||
return
|
||||
end
|
||||
|
2
mesecons_detector/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_detector
|
||||
depends = mesecons, mesecons_materials
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
doors
|
@ -13,9 +13,9 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
||||
minetest.swap_node(pos, {name = replace, param2 = p2})
|
||||
|
||||
if (minetest.get_meta(pos):get_int("right") ~= 0) == (params[1] ~= 3) then
|
||||
minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
else
|
||||
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,16 +73,17 @@ meseconify_door("doors:door_wood")
|
||||
meseconify_door("doors:door_steel")
|
||||
meseconify_door("doors:door_glass")
|
||||
meseconify_door("doors:door_obsidian_glass")
|
||||
meseconify_door("xpanes:door_steel_bar")
|
||||
|
||||
-- Trapdoor
|
||||
local function trapdoor_switch(pos, node)
|
||||
local state = minetest.get_meta(pos):get_int("state")
|
||||
|
||||
if state == 1 then
|
||||
minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
minetest.set_node(pos, {name="doors:trapdoor", param2 = node.param2})
|
||||
else
|
||||
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
minetest.set_node(pos, {name="doors:trapdoor_open", param2 = node.param2})
|
||||
end
|
||||
|
||||
@ -110,6 +111,12 @@ if doors and doors.get then
|
||||
minetest.override_item("doors:trapdoor_open", override)
|
||||
minetest.override_item("doors:trapdoor_steel", override)
|
||||
minetest.override_item("doors:trapdoor_steel_open", override)
|
||||
|
||||
if minetest.registered_items["xpanes:trapdoor_steel_bar"] then
|
||||
minetest.override_item("xpanes:trapdoor_steel_bar", override)
|
||||
minetest.override_item("xpanes:trapdoor_steel_bar_open", override)
|
||||
end
|
||||
|
||||
else
|
||||
if minetest.registered_nodes["doors:trapdoor"] then
|
||||
minetest.override_item("doors:trapdoor", {
|
||||
|
3
mesecons_doors/mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = mesecons_doors
|
||||
depends = mesecons, doors
|
||||
optional_depends = xpanes
|
@ -1,12 +1,5 @@
|
||||
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, -16/32, -16/32, 5/32, -12/32, 5/32 },
|
||||
@ -25,14 +18,11 @@ local corner_get_rules = function (node)
|
||||
end
|
||||
|
||||
minetest.register_node("mesecons_extrawires:corner_on", {
|
||||
drawtype = "nodebox",
|
||||
drawtype = "mesh",
|
||||
mesh = "mesecons_extrawires_corner.obj",
|
||||
tiles = {
|
||||
"jeija_insulated_wire_curved_tb_on.png",
|
||||
"jeija_insulated_wire_curved_tb_on.png^[transformR270",
|
||||
"jeija_insulated_wire_sides_on.png",
|
||||
"jeija_insulated_wire_ends_on.png",
|
||||
"jeija_insulated_wire_sides_on.png",
|
||||
"jeija_insulated_wire_ends_on.png"
|
||||
{ name = "jeija_insulated_wire_sides_on.png", backface_culling = true },
|
||||
{ name = "jeija_insulated_wire_ends_on.png", backface_culling = true },
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -40,7 +30,6 @@ minetest.register_node("mesecons_extrawires:corner_on", {
|
||||
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(),
|
||||
@ -55,15 +44,12 @@ minetest.register_node("mesecons_extrawires:corner_on", {
|
||||
})
|
||||
|
||||
minetest.register_node("mesecons_extrawires:corner_off", {
|
||||
drawtype = "nodebox",
|
||||
drawtype = "mesh",
|
||||
description = "Insulated Mesecon Corner",
|
||||
mesh = "mesecons_extrawires_corner.obj",
|
||||
tiles = {
|
||||
"jeija_insulated_wire_curved_tb_off.png",
|
||||
"jeija_insulated_wire_curved_tb_off.png^[transformR270",
|
||||
"jeija_insulated_wire_sides_off.png",
|
||||
"jeija_insulated_wire_ends_off.png",
|
||||
"jeija_insulated_wire_sides_off.png",
|
||||
"jeija_insulated_wire_ends_off.png"
|
||||
{ name = "jeija_insulated_wire_sides_off.png", backface_culling = true },
|
||||
{ name = "jeija_insulated_wire_ends_off.png", backface_culling = true },
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -71,7 +57,6 @@ minetest.register_node("mesecons_extrawires:corner_off", {
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = corner_selectionbox,
|
||||
node_box = corner_nodebox,
|
||||
groups = {dig_immediate = 3},
|
||||
sounds = default.node_sound_defaults(),
|
||||
mesecons = {conductor =
|
||||
@ -87,8 +72,7 @@ minetest.register_node("mesecons_extrawires:corner_off", {
|
||||
minetest.register_craft({
|
||||
output = "mesecons_extrawires:corner_off 3",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off", ""},
|
||||
{"", "mesecons_insulated:insulated_off", ""},
|
||||
{"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off"},
|
||||
{"", "mesecons_insulated:insulated_off"},
|
||||
}
|
||||
})
|
||||
|
@ -1,3 +0,0 @@
|
||||
default
|
||||
mesecons
|
||||
screwdriver?
|
91
mesecons_extrawires/doublecorner.lua
Normal file
@ -0,0 +1,91 @@
|
||||
local rotate
|
||||
if minetest.global_exists("screwdriver") then rotate = screwdriver.rotate_simple end
|
||||
|
||||
local doublecorner_selectionbox = {
|
||||
type = "fixed",
|
||||
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
|
||||
}
|
||||
|
||||
local rules = {
|
||||
{
|
||||
{ x = 1, y = 0, z = 0 },
|
||||
{ x = 0, y = 0, z = 1 },
|
||||
},
|
||||
{
|
||||
{ x = -1, y = 0, z = 0 },
|
||||
{ x = 0, y = 0, z = -1 },
|
||||
},
|
||||
}
|
||||
|
||||
local doublecorner_rules = {}
|
||||
for k = 1, 4 do
|
||||
doublecorner_rules[k] = table.copy(rules)
|
||||
for i, r in ipairs(rules) do
|
||||
rules[i] = mesecon.rotate_rules_left(r)
|
||||
end
|
||||
end
|
||||
|
||||
local function doublecorner_get_rules(node)
|
||||
return doublecorner_rules[node.param2 % 4 + 1]
|
||||
end
|
||||
|
||||
local doublecorner_states = {
|
||||
"mesecons_extrawires:doublecorner_00",
|
||||
"mesecons_extrawires:doublecorner_01",
|
||||
"mesecons_extrawires:doublecorner_10",
|
||||
"mesecons_extrawires:doublecorner_11",
|
||||
}
|
||||
local wire1_states = { "off", "off", "on", "on" }
|
||||
local wire2_states = { "off", "on", "off", "on" }
|
||||
|
||||
for k, state in ipairs(doublecorner_states) do
|
||||
local w1 = wire1_states[k]
|
||||
local w2 = wire2_states[k]
|
||||
local groups = { dig_immediate = 3 }
|
||||
if k ~= 1 then groups.not_in_creative_inventory = 1 end
|
||||
minetest.register_node(state, {
|
||||
drawtype = "mesh",
|
||||
mesh = "mesecons_extrawires_doublecorner.obj",
|
||||
description = "Insulated Mesecon Double Corner",
|
||||
tiles = {
|
||||
{ name = "jeija_insulated_wire_sides_" .. w1 .. ".png", backface_culling = true },
|
||||
{ name = "jeija_insulated_wire_ends_" .. w1 .. ".png", backface_culling = true },
|
||||
{ name = "jeija_insulated_wire_sides_" .. w2 .. ".png", backface_culling = true },
|
||||
{ name = "jeija_insulated_wire_ends_" .. w2 .. ".png", backface_culling = true },
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = doublecorner_selectionbox,
|
||||
groups = groups,
|
||||
drop = doublecorner_states[1],
|
||||
sounds = default.node_sound_defaults(),
|
||||
mesecons = {
|
||||
conductor = {
|
||||
states = doublecorner_states,
|
||||
rules = doublecorner_get_rules,
|
||||
},
|
||||
},
|
||||
on_blast = mesecon.on_blastnode,
|
||||
on_rotate = rotate,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mesecons_extrawires:doublecorner_00",
|
||||
recipe = {
|
||||
"mesecons_extrawires:corner_off",
|
||||
"mesecons_extrawires:corner_off",
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mesecons_extrawires:corner_off 2",
|
||||
recipe = {
|
||||
"mesecons_extrawires:doublecorner_00",
|
||||
},
|
||||
})
|
@ -1,5 +1,6 @@
|
||||
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").."/doublecorner.lua");
|
||||
dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua");
|
||||
dofile(minetest.get_modpath("mesecons_extrawires").."/mesewire.lua");
|
||||
|
@ -18,7 +18,7 @@ minetest.override_item("default:mese", {
|
||||
|
||||
-- Copy node definition of powered mese from normal mese
|
||||
-- and brighten texture tiles to indicate mese is powered
|
||||
local powered_def = mesecon.mergetable(minetest.registered_nodes["default:mese"], {
|
||||
local powered_def = mesecon.merge_tables(minetest.registered_nodes["default:mese"], {
|
||||
drop = "default:mese",
|
||||
light_source = 5,
|
||||
mesecons = {conductor = {
|
||||
|
3
mesecons_extrawires/mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = mesecons_extrawires
|
||||
depends = default, mesecons
|
||||
optional_depends = screwdriver
|
125
mesecons_extrawires/models/mesecons_extrawires_corner.obj
Normal file
@ -0,0 +1,125 @@
|
||||
# Вершины
|
||||
# Провод 1
|
||||
# 1 (ниж. внутр.)
|
||||
v 0.093750 -0.531250 -0.501000
|
||||
v 0.093750 -0.531250 -0.331726
|
||||
v 0.331726 -0.531250 -0.093750
|
||||
v 0.501000 -0.531250 -0.093750
|
||||
# 5 (ниж. наруж.)
|
||||
v -0.093750 -0.531250 -0.501000
|
||||
v -0.093750 -0.531250 -0.254061
|
||||
v 0.254061 -0.531250 0.093750
|
||||
v 0.501000 -0.531250 0.093750
|
||||
# 9 (верх. внутр.)
|
||||
v 0.093750 -0.406250 -0.501000
|
||||
v 0.093750 -0.406250 -0.331726
|
||||
v 0.331726 -0.406250 -0.093750
|
||||
v 0.501000 -0.406250 -0.093750
|
||||
# 13 (верх. наруж.)
|
||||
v -0.093750 -0.406250 -0.501000
|
||||
v -0.093750 -0.406250 -0.254061
|
||||
v 0.254061 -0.406250 0.093750
|
||||
v 0.501000 -0.406250 0.093750
|
||||
# Текстурные координаты
|
||||
# 1 (ниж.)
|
||||
vt 0.000000 0.406250
|
||||
vt 0.168274 0.406250
|
||||
vt 0.331726 0.406250
|
||||
vt 0.668274 0.406250
|
||||
vt 0.831726 0.406250
|
||||
vt 1.000000 0.406250
|
||||
vt 0.000000 0.593750
|
||||
vt 0.245939 0.593750
|
||||
vt 0.254061 0.593750
|
||||
vt 0.745939 0.593750
|
||||
vt 0.754061 0.593750
|
||||
vt 1.000000 0.593750
|
||||
# 13 (верх.)
|
||||
vt 0.000000 0.406250
|
||||
vt 0.245939 0.406250
|
||||
vt 0.254061 0.406250
|
||||
vt 0.745939 0.406250
|
||||
vt 0.754061 0.406250
|
||||
vt 1.000000 0.406250
|
||||
vt 0.000000 0.593750
|
||||
vt 0.168274 0.593750
|
||||
vt 0.331726 0.593750
|
||||
vt 0.668274 0.593750
|
||||
vt 0.831726 0.593750
|
||||
vt 1.000000 0.593750
|
||||
# 25 (внутр.)
|
||||
vt 1.000000 0.093750
|
||||
vt 0.831726 0.093750
|
||||
vt 0.668274 0.093750
|
||||
vt 0.331726 0.093750
|
||||
vt 0.168274 0.093750
|
||||
vt 0.000000 0.093750
|
||||
vt 1.000000 -0.031250
|
||||
vt 0.831726 -0.031250
|
||||
vt 0.668274 -0.031250
|
||||
vt 0.331726 -0.031250
|
||||
vt 0.168274 -0.031250
|
||||
vt 0.000000 -0.031250
|
||||
# 37 (внеш.)
|
||||
vt 0.000000 -0.031250
|
||||
vt 0.245939 -0.031250
|
||||
vt 0.254061 -0.031250
|
||||
vt 0.745939 -0.031250
|
||||
vt 0.754061 -0.031250
|
||||
vt 1.000000 -0.031250
|
||||
vt 0.000000 0.093750
|
||||
vt 0.245939 0.093750
|
||||
vt 0.254061 0.093750
|
||||
vt 0.745939 0.093750
|
||||
vt 0.754061 0.093750
|
||||
vt 1.000000 0.093750
|
||||
# 49 (торец)
|
||||
vt 0.406250 -0.031250
|
||||
vt 0.406250 0.093750
|
||||
vt 0.593750 -0.031250
|
||||
vt 0.593750 0.093750
|
||||
# Нормали
|
||||
# 1
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.707107 0.000000 0.707107
|
||||
# 5
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn -0.707107 0.000000 -0.707107
|
||||
# Грани
|
||||
g Sides1
|
||||
# Часть 1
|
||||
f 5/37/1 6/38/1 14/44/1
|
||||
f 5/37/1 14/44/1 13/43/1
|
||||
f 13/13/2 14/14/2 10/20/2
|
||||
f 13/13/2 10/20/2 9/19/2
|
||||
f 9/25/5 10/26/5 2/32/5
|
||||
f 9/25/5 2/32/5 1/31/5
|
||||
f 1/1/6 2/2/6 6/8/6
|
||||
f 1/1/6 6/8/6 5/7/6
|
||||
# Часть 2
|
||||
f 6/39/4 7/40/4 15/46/4
|
||||
f 6/39/4 15/46/4 14/45/4
|
||||
f 14/15/2 15/16/2 11/22/2
|
||||
f 14/15/2 11/22/2 10/21/2
|
||||
f 10/27/8 11/28/8 3/34/8
|
||||
f 10/27/8 3/34/8 2/33/8
|
||||
f 2/3/6 3/4/6 7/10/6
|
||||
f 2/3/6 7/10/6 6/9/6
|
||||
# Часть 3
|
||||
f 7/41/3 8/42/3 16/48/3
|
||||
f 7/41/3 16/48/3 15/47/3
|
||||
f 15/17/2 16/18/2 12/24/2
|
||||
f 15/17/2 12/24/2 11/23/2
|
||||
f 11/29/7 12/30/7 4/36/7
|
||||
f 11/29/7 4/36/7 3/35/7
|
||||
f 3/5/6 4/6/6 8/12/6
|
||||
f 3/5/6 8/12/6 7/11/6
|
||||
g Ends1
|
||||
f 1/49/3 5/51/3 13/52/3
|
||||
f 1/49/3 13/52/3 9/50/3
|
||||
f 4/49/1 12/50/1 16/52/1
|
||||
f 4/49/1 16/52/1 8/51/1
|
180
mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj
Normal file
@ -0,0 +1,180 @@
|
||||
# Вершины
|
||||
# Провод 1
|
||||
# 1 (ниж. внутр.)
|
||||
v 0.093750 -0.531250 -0.501000
|
||||
v 0.093750 -0.531250 -0.331726
|
||||
v 0.331726 -0.531250 -0.093750
|
||||
v 0.501000 -0.531250 -0.093750
|
||||
# 5 (ниж. наруж.)
|
||||
v -0.093750 -0.531250 -0.501000
|
||||
v -0.093750 -0.531250 -0.254061
|
||||
v 0.254061 -0.531250 0.093750
|
||||
v 0.501000 -0.531250 0.093750
|
||||
# 9 (верх. внутр.)
|
||||
v 0.093750 -0.406250 -0.501000
|
||||
v 0.093750 -0.406250 -0.331726
|
||||
v 0.331726 -0.406250 -0.093750
|
||||
v 0.501000 -0.406250 -0.093750
|
||||
# 13 (верх. наруж.)
|
||||
v -0.093750 -0.406250 -0.501000
|
||||
v -0.093750 -0.406250 -0.254061
|
||||
v 0.254061 -0.406250 0.093750
|
||||
v 0.501000 -0.406250 0.093750
|
||||
# Провод 2
|
||||
# 17 (ниж. внутр.)
|
||||
v -0.093750 -0.531250 0.501000
|
||||
v -0.093750 -0.531250 0.331726
|
||||
v -0.331726 -0.531250 0.093750
|
||||
v -0.501000 -0.531250 0.093750
|
||||
# 21 (ниж. наруж.)
|
||||
v 0.093750 -0.531250 0.501000
|
||||
v 0.093750 -0.531250 0.254061
|
||||
v -0.254061 -0.531250 -0.093750
|
||||
v -0.501000 -0.531250 -0.093750
|
||||
# 25 (верх. внутр.)
|
||||
v -0.093750 -0.406250 0.501000
|
||||
v -0.093750 -0.406250 0.331726
|
||||
v -0.331726 -0.406250 0.093750
|
||||
v -0.501000 -0.406250 0.093750
|
||||
# 29 (верх. наруж.)
|
||||
v 0.093750 -0.406250 0.501000
|
||||
v 0.093750 -0.406250 0.254061
|
||||
v -0.254061 -0.406250 -0.093750
|
||||
v -0.501000 -0.406250 -0.093750
|
||||
# Текстурные координаты
|
||||
# 1 (ниж.)
|
||||
vt 0.000000 0.406250
|
||||
vt 0.168274 0.406250
|
||||
vt 0.331726 0.406250
|
||||
vt 0.668274 0.406250
|
||||
vt 0.831726 0.406250
|
||||
vt 1.000000 0.406250
|
||||
vt 0.000000 0.593750
|
||||
vt 0.245939 0.593750
|
||||
vt 0.254061 0.593750
|
||||
vt 0.745939 0.593750
|
||||
vt 0.754061 0.593750
|
||||
vt 1.000000 0.593750
|
||||
# 13 (верх.)
|
||||
vt 0.000000 0.406250
|
||||
vt 0.245939 0.406250
|
||||
vt 0.254061 0.406250
|
||||
vt 0.745939 0.406250
|
||||
vt 0.754061 0.406250
|
||||
vt 1.000000 0.406250
|
||||
vt 0.000000 0.593750
|
||||
vt 0.168274 0.593750
|
||||
vt 0.331726 0.593750
|
||||
vt 0.668274 0.593750
|
||||
vt 0.831726 0.593750
|
||||
vt 1.000000 0.593750
|
||||
# 25 (внутр.)
|
||||
vt 1.000000 0.093750
|
||||
vt 0.831726 0.093750
|
||||
vt 0.668274 0.093750
|
||||
vt 0.331726 0.093750
|
||||
vt 0.168274 0.093750
|
||||
vt 0.000000 0.093750
|
||||
vt 1.000000 -0.031250
|
||||
vt 0.831726 -0.031250
|
||||
vt 0.668274 -0.031250
|
||||
vt 0.331726 -0.031250
|
||||
vt 0.168274 -0.031250
|
||||
vt 0.000000 -0.031250
|
||||
# 37 (внеш.)
|
||||
vt 0.000000 -0.031250
|
||||
vt 0.245939 -0.031250
|
||||
vt 0.254061 -0.031250
|
||||
vt 0.745939 -0.031250
|
||||
vt 0.754061 -0.031250
|
||||
vt 1.000000 -0.031250
|
||||
vt 0.000000 0.093750
|
||||
vt 0.245939 0.093750
|
||||
vt 0.254061 0.093750
|
||||
vt 0.745939 0.093750
|
||||
vt 0.754061 0.093750
|
||||
vt 1.000000 0.093750
|
||||
# 49 (торец)
|
||||
vt 0.406250 -0.031250
|
||||
vt 0.406250 0.093750
|
||||
vt 0.593750 -0.031250
|
||||
vt 0.593750 0.093750
|
||||
# Нормали
|
||||
# 1
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.707107 0.000000 0.707107
|
||||
# 5
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn -0.707107 0.000000 -0.707107
|
||||
# Грани
|
||||
# Грани
|
||||
g Sides1
|
||||
# Часть 1
|
||||
f 5/37/1 6/38/1 14/44/1
|
||||
f 5/37/1 14/44/1 13/43/1
|
||||
f 13/13/2 14/14/2 10/20/2
|
||||
f 13/13/2 10/20/2 9/19/2
|
||||
f 9/25/5 10/26/5 2/32/5
|
||||
f 9/25/5 2/32/5 1/31/5
|
||||
f 1/1/6 2/2/6 6/8/6
|
||||
f 1/1/6 6/8/6 5/7/6
|
||||
# Часть 2
|
||||
f 6/39/4 7/40/4 15/46/4
|
||||
f 6/39/4 15/46/4 14/45/4
|
||||
f 14/15/2 15/16/2 11/22/2
|
||||
f 14/15/2 11/22/2 10/21/2
|
||||
f 10/27/8 11/28/8 3/34/8
|
||||
f 10/27/8 3/34/8 2/33/8
|
||||
f 2/3/6 3/4/6 7/10/6
|
||||
f 2/3/6 7/10/6 6/9/6
|
||||
# Часть 3
|
||||
f 7/41/3 8/42/3 16/48/3
|
||||
f 7/41/3 16/48/3 15/47/3
|
||||
f 15/17/2 16/18/2 12/24/2
|
||||
f 15/17/2 12/24/2 11/23/2
|
||||
f 11/29/7 12/30/7 4/36/7
|
||||
f 11/29/7 4/36/7 3/35/7
|
||||
f 3/5/6 4/6/6 8/12/6
|
||||
f 3/5/6 8/12/6 7/11/6
|
||||
g Ends1
|
||||
f 1/49/3 5/51/3 13/52/3
|
||||
f 1/49/3 13/52/3 9/50/3
|
||||
f 4/49/1 12/50/1 16/52/1
|
||||
f 4/49/1 16/52/1 8/51/1
|
||||
g Sides2
|
||||
# Часть 1
|
||||
f 21/37/1 22/38/1 30/44/1
|
||||
f 21/37/1 30/44/1 29/43/1
|
||||
f 29/13/2 30/14/2 26/20/2
|
||||
f 29/13/2 26/20/2 25/19/2
|
||||
f 25/25/5 26/26/5 18/32/5
|
||||
f 25/25/5 18/32/5 17/31/5
|
||||
f 17/1/6 18/2/6 22/8/6
|
||||
f 17/1/6 22/8/6 21/7/6
|
||||
# Часть 2
|
||||
f 22/39/4 23/40/4 31/46/4
|
||||
f 22/39/4 31/46/4 30/45/4
|
||||
f 30/15/2 31/16/2 27/22/2
|
||||
f 30/15/2 27/22/2 26/21/2
|
||||
f 26/27/8 27/28/8 19/34/8
|
||||
f 26/27/8 19/34/8 18/33/8
|
||||
f 18/3/6 19/4/6 23/10/6
|
||||
f 18/3/6 23/10/6 22/9/6
|
||||
# Часть 3
|
||||
f 23/41/3 24/42/3 32/48/3
|
||||
f 23/41/3 32/48/3 31/47/3
|
||||
f 31/17/2 32/18/2 28/24/2
|
||||
f 31/17/2 28/24/2 27/23/2
|
||||
f 27/29/7 28/30/7 20/36/7
|
||||
f 27/29/7 20/36/7 19/35/7
|
||||
f 19/5/6 20/6/6 24/12/6
|
||||
f 19/5/6 24/12/6 23/11/6
|
||||
g Ends2
|
||||
f 17/49/3 21/51/3 29/52/3
|
||||
f 17/49/3 29/52/3 25/50/3
|
||||
f 20/49/1 28/50/1 32/52/1
|
||||
f 20/49/1 32/52/1 24/51/1
|
@ -88,7 +88,6 @@ minetest.register_node("mesecons_extrawires:tjunction_off", {
|
||||
minetest.register_craft({
|
||||
output = "mesecons_extrawires:tjunction_off 3",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off"},
|
||||
{"", "mesecons_insulated:insulated_off", ""},
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ mesecon.register_node("mesecons_extrawires:vertical_bottom", {
|
||||
minetest.register_craft({
|
||||
output = "mesecons_extrawires:vertical_off 3",
|
||||
recipe = {
|
||||
{"mesecons:wire_00000000_off"},
|
||||
{"mesecons:wire_00000000_off"},
|
||||
{"mesecons:wire_00000000_off"}
|
||||
{"group:mesecon_conductor_craftable"},
|
||||
{"group:mesecon_conductor_craftable"},
|
||||
{"group:mesecon_conductor_craftable"},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
screwdriver?
|
3
mesecons_fpga/mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = mesecons_fpga
|
||||
depends = mesecons
|
||||
optional_depends = screwdriver
|
BIN
mesecons_fpga/sounds/mesecons_fpga_copy.ogg
Normal file
BIN
mesecons_fpga/sounds/mesecons_fpga_fail.ogg
Normal file
BIN
mesecons_fpga/sounds/mesecons_fpga_write.ogg
Normal file
@ -18,10 +18,12 @@ minetest.register_tool("mesecons_fpga:programmer", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("instr") == "//////////////" then
|
||||
minetest.chat_send_player(placer:get_player_name(), "This FPGA is unprogrammed.")
|
||||
minetest.sound_play("mesecons_fpga_fail", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
|
||||
return itemstack
|
||||
end
|
||||
itemstack:set_metadata(meta:get_string("instr"))
|
||||
minetest.chat_send_player(placer:get_player_name(), "FPGA gate configuration was successfully copied!")
|
||||
minetest.sound_play("mesecons_fpga_copy", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
@ -43,6 +45,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
|
||||
local imeta = itemstack:get_metadata()
|
||||
if imeta == "" then
|
||||
minetest.chat_send_player(player_name, "Use shift+right-click to copy a gate configuration first.")
|
||||
minetest.sound_play("mesecons_fpga_fail", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
@ -50,6 +53,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
|
||||
meta:set_string("instr", imeta)
|
||||
plg.update_meta(pos, imeta)
|
||||
minetest.chat_send_player(player_name, "Gate configuration was successfully written to FPGA!")
|
||||
minetest.sound_play("mesecons_fpga_write", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
@ -1,6 +0,0 @@
|
||||
mesecons
|
||||
mesecons_microcontroller
|
||||
mesecons_delayer
|
||||
|
||||
mesecons_torch
|
||||
mesecons_materials
|
2
mesecons_gates/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_gates
|
||||
depends = mesecons, mesecons_microcontroller, mesecons_delayer, mesecons_torch, mesecons_materials
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -12,6 +12,7 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", {
|
||||
"jeija_hydro_turbine_turbine_top_bottom_off.png",
|
||||
"jeija_hydro_turbine_turbine_misc_off.png"
|
||||
},
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or nil,
|
||||
inventory_image = "jeija_hydro_turbine_inv.png",
|
||||
is_ground_content = false,
|
||||
wield_scale = {x=0.75, y=0.75, z=0.75},
|
||||
@ -42,6 +43,7 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", {
|
||||
{ name = "jeija_hydro_turbine_turbine_misc_on.png",
|
||||
animation = {type = "vertical_frames", aspect_w = 256, aspect_h = 32, length = 0.4} }
|
||||
},
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or nil,
|
||||
inventory_image = "jeija_hydro_turbine_inv.png",
|
||||
drop = "mesecons_hydroturbine:hydro_turbine_off 1",
|
||||
groups = {dig_immediate=2,not_in_creative_inventory=1},
|
||||
|
2
mesecons_hydroturbine/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_hydroturbine
|
||||
depends = mesecons
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
screwdriver?
|
@ -86,7 +86,7 @@ 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"},
|
||||
{"group:mesecon_conductor_craftable", "group:mesecon_conductor_craftable", "group:mesecon_conductor_craftable"},
|
||||
{"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"},
|
||||
}
|
||||
})
|
||||
|
3
mesecons_insulated/mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = mesecons_insulated
|
||||
depends = mesecons
|
||||
optional_depends = screwdriver
|
Before Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 136 B |
@ -1 +0,0 @@
|
||||
mesecons
|
@ -9,9 +9,12 @@ local mesecon_lamp_box = {
|
||||
wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
|
||||
}
|
||||
|
||||
local use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or nil
|
||||
|
||||
minetest.register_node("mesecons_lamp:lamp_on", {
|
||||
drawtype = "nodebox",
|
||||
tiles = {"jeija_meselamp_on.png"},
|
||||
use_texture_alpha = use_texture_alpha,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
is_ground_content = false,
|
||||
@ -36,6 +39,7 @@ minetest.register_node("mesecons_lamp:lamp_on", {
|
||||
minetest.register_node("mesecons_lamp:lamp_off", {
|
||||
drawtype = "nodebox",
|
||||
tiles = {"jeija_meselamp_off.png"},
|
||||
use_texture_alpha = use_texture_alpha,
|
||||
inventory_image = "jeija_meselamp.png",
|
||||
wield_image = "jeija_meselamp.png",
|
||||
paramtype = "light",
|
||||
|
2
mesecons_lamp/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_lamp
|
||||
depends = mesecons
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
dye
|
2
mesecons_lightstone/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_lightstone
|
||||
depends = mesecons, dye
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -266,6 +266,46 @@ local function remove_functions(x)
|
||||
return x
|
||||
end
|
||||
|
||||
local function validate_iid(iid)
|
||||
if not iid then return true end -- nil is OK
|
||||
|
||||
local limit = mesecon.setting("luacontroller_interruptid_maxlen", 256)
|
||||
if type(iid) == "string" then
|
||||
if #iid <= limit then return true end -- string is OK unless too long
|
||||
return false, "An interrupt ID was too large!"
|
||||
end
|
||||
if type(iid) == "number" or type(iid) == "boolean" then return true, "Non-string interrupt IDs are deprecated" end
|
||||
|
||||
local warn
|
||||
local seen = {}
|
||||
local function check(t)
|
||||
if type(t) == "function" then
|
||||
warn = "Functions cannot be used in interrupt IDs"
|
||||
return false
|
||||
end
|
||||
if type(t) ~= "table" then
|
||||
return true
|
||||
end
|
||||
if seen[t] then
|
||||
warn = "Non-tree-like tables are forbidden as interrupt IDs"
|
||||
return false
|
||||
end
|
||||
seen[t] = true
|
||||
for k, v in pairs(t) do
|
||||
if not check(k) then return false end
|
||||
if not check(v) then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
if not check(iid) then return false, warn end
|
||||
|
||||
if #minetest.serialize(iid) > limit then
|
||||
return false, "An interrupt ID was too large!"
|
||||
end
|
||||
|
||||
return true, "Table interrupt IDs are deprecated and are unreliable; use strings instead"
|
||||
end
|
||||
|
||||
-- The setting affects API so is not intended to be changeable at runtime
|
||||
local get_interrupt
|
||||
if mesecon.setting("luacontroller_lightweight_interrupts", false) then
|
||||
@ -282,26 +322,18 @@ else
|
||||
-- itbl: Flat table of functions to run after sandbox cleanup, used to prevent various security hazards
|
||||
get_interrupt = function(pos, itbl, send_warning)
|
||||
-- iid = interrupt id
|
||||
local function interrupt(time, iid)
|
||||
return function (time, iid)
|
||||
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
||||
-- Hence the values get moved out. Should take less time than original, so totally compatible
|
||||
if type(time) ~= "number" then error("Delay must be a number") end
|
||||
table.insert(itbl, function ()
|
||||
-- Outside string metatable sandbox, can safely run this now
|
||||
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
||||
-- Check if IID is dodgy, so you can't use interrupts to store an infinite amount of data.
|
||||
-- Note that this is safe from alter-after-free because this code gets run after the sandbox has ended.
|
||||
-- This runs outside of the timer and *shouldn't* harm perf. unless dodgy data is being sent in the first place
|
||||
iid = remove_functions(iid)
|
||||
local msg_ser = minetest.serialize(iid)
|
||||
if #msg_ser <= mesecon.setting("luacontroller_interruptid_maxlen", 256) then
|
||||
mesecon.queue:add_action(pos, "lc_interrupt", {luac_id, iid}, time, iid, 1)
|
||||
else
|
||||
send_warning("An interrupt ID was too large!")
|
||||
end
|
||||
local ok, warn = validate_iid(iid)
|
||||
if ok then mesecon.queue:add_action(pos, "lc_interrupt", {luac_id, iid}, time, iid, 1) end
|
||||
if warn then send_warning(warn) end
|
||||
end)
|
||||
end
|
||||
return interrupt
|
||||
end
|
||||
end
|
||||
|
||||
@ -632,6 +664,7 @@ local function reset_formspec(meta, code, errmsg)
|
||||
code = minetest.formspec_escape(code or "")
|
||||
errmsg = minetest.formspec_escape(tostring(errmsg or ""))
|
||||
meta:set_string("formspec", "size[12,10]"
|
||||
.."style_type[label,textarea;font=mono]"
|
||||
.."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]"
|
||||
.."label[0.1,8.3;"..errmsg.."]"
|
||||
.."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]"
|
||||
@ -901,4 +934,3 @@ minetest.register_craft({
|
||||
{'group:mesecon_conductor_craftable', 'group:mesecon_conductor_craftable', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
2
mesecons_luacontroller/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_luacontroller
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_materials/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_materials
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_microcontroller/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_microcontroller
|
||||
depends = mesecons
|
@ -1,3 +0,0 @@
|
||||
mesecons
|
||||
mesecons_materials
|
||||
mesecons_mvps
|
@ -66,6 +66,7 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
|
||||
mesecon.on_dignode(pos, node)
|
||||
mesecon.on_placenode(frontpos, node)
|
||||
minetest.get_node_timer(frontpos):start(timer_interval)
|
||||
minetest.sound_play("movestone", { pos = pos, max_hear_distance = 20, gain = 0.5 }, true)
|
||||
|
||||
-- ### Step 3: If sticky, pull stack behind ###
|
||||
if is_sticky then
|
||||
|
2
mesecons_movestones/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_movestones
|
||||
depends = mesecons, mesecons_materials, mesecons_mvps
|
BIN
mesecons_movestones/sounds/movestone.ogg
Normal file
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_mvps/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_mvps
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -1,12 +1,13 @@
|
||||
This effector makes a sound if powered and can be used for making music. Normally it makes piano sounds. The sound frequency can be changed by punching the block. There are some special sounds that depend on the block below:
|
||||
This effector makes a sound if powered and can be used for making music. Normally it makes piano sounds. The sound frequency can be changed by punching the block (only works for piano). There are some special sounds that depend on the block below:
|
||||
<table colspace="5">
|
||||
<tr><th>Block Below</th><th>Effect</th></tr>
|
||||
<tr><td>Glass</td><td>Hihat</td></tr>
|
||||
<tr><td>Stone</td><td>Kick</td></tr>
|
||||
<tr><td>Chest</td><td>Snare</td></tr>
|
||||
<tr><td>Tree</td><td>Crash</td></tr>
|
||||
<tr><td>Wood</td><td>Lite Crash</td></tr>
|
||||
<tr><td>Coal Block</td><td>Explosion Sound </td></tr>
|
||||
<tr><td>Lava Source</td><td>Fire Sound</td></tr>
|
||||
<tr><td>Steel Block</td><td>Raises the pitch by one octave</td></tr>
|
||||
<tr><td>Glass or Obsidian Glass</td><td>Hi-hat</td></tr>
|
||||
<tr><td>Any stone</td><td>Kick</td></tr>
|
||||
<tr><td>Chest or Locked Chest</td><td>Snare</td></tr>
|
||||
<tr><td>Any tree</td><td>Crash</td></tr>
|
||||
<tr><td>Any wooden planks</td><td>Lite Crash</td></tr>
|
||||
<tr><td>Coal Block</td><td>Explosion sound</td></tr>
|
||||
<tr><td>Lava Source</td><td>Fire sound</td></tr>
|
||||
<tr><td>Steel Block</td><td>Piano (high pitch, one octave higher than normal)</td></tr>
|
||||
<tr><td>Any other block</td><td>Piano (low pitch)</td></tr>
|
||||
</table>
|
||||
|
@ -3,7 +3,11 @@ minetest.register_node("mesecons_noteblock:noteblock", {
|
||||
tiles = {"mesecons_noteblock.png"},
|
||||
is_ground_content = false,
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
|
||||
on_punch = function(pos, node) -- change sound when punched
|
||||
on_punch = function(pos, node, puncher) -- change sound when punched
|
||||
if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then
|
||||
return
|
||||
end
|
||||
|
||||
node.param2 = (node.param2+1)%12
|
||||
mesecon.noteblock_play(pos, node.param2)
|
||||
minetest.set_node(pos, node)
|
||||
@ -43,19 +47,33 @@ local soundnames = {
|
||||
}
|
||||
|
||||
local node_sounds = {
|
||||
["default:glass"] = "mesecons_noteblock_hihat",
|
||||
["default:stone"] = "mesecons_noteblock_kick",
|
||||
["default:lava_source"] = "fire_fire",
|
||||
["default:chest"] = "mesecons_noteblock_snare",
|
||||
["default:tree"] = "mesecons_noteblock_crash",
|
||||
["default:wood"] = "mesecons_noteblock_litecrash",
|
||||
["default:chest_locked"] = "mesecons_noteblock_snare",
|
||||
["default:coalblock"] = "tnt_explode",
|
||||
["default:glass"] = "mesecons_noteblock_hihat",
|
||||
["default:obsidian_glass"] = "mesecons_noteblock_hihat",
|
||||
}
|
||||
|
||||
local node_sounds_group = {
|
||||
["stone"] = "mesecons_noteblock_kick",
|
||||
["tree"] = "mesecons_noteblock_crash",
|
||||
["wood"] = "mesecons_noteblock_litecrash",
|
||||
}
|
||||
|
||||
mesecon.noteblock_play = function(pos, param2)
|
||||
pos.y = pos.y-1
|
||||
local nodeunder = minetest.get_node(pos).name
|
||||
local soundname = node_sounds[nodeunder]
|
||||
if not soundname then
|
||||
for k,v in pairs(node_sounds_group) do
|
||||
local g = minetest.get_item_group(nodeunder, k)
|
||||
if g ~= 0 then
|
||||
soundname = v
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not soundname then
|
||||
soundname = soundnames[param2]
|
||||
if not soundname then
|
||||
@ -67,5 +85,11 @@ mesecon.noteblock_play = function(pos, param2)
|
||||
end
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
minetest.sound_play(soundname, {pos = pos})
|
||||
if soundname == "fire_fire" then
|
||||
-- Smoothly fade out fire sound
|
||||
local handle = minetest.sound_play(soundname, {pos = pos, loop = true})
|
||||
minetest.after(3.0, minetest.sound_fade, handle, -1.5, 0.0)
|
||||
else
|
||||
minetest.sound_play(soundname, {pos = pos}, true)
|
||||
end
|
||||
end
|
||||
|
2
mesecons_noteblock/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_noteblock
|
||||
depends = mesecons
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
mesecons_mvps
|
@ -67,11 +67,7 @@ local function piston_remove_pusher(pos, node, check_falling)
|
||||
end
|
||||
|
||||
minetest.remove_node(pusherpos)
|
||||
minetest.sound_play("piston_retract", {
|
||||
pos = pos,
|
||||
max_hear_distance = 20,
|
||||
gain = 0.3,
|
||||
})
|
||||
minetest.sound_play("piston_retract", { pos = pos, max_hear_distance = 20, gain = 0.3 }, true)
|
||||
|
||||
if check_falling then
|
||||
minetest.check_for_falling(pusherpos)
|
||||
@ -96,11 +92,7 @@ local piston_on = function(pos, node)
|
||||
end
|
||||
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.onname})
|
||||
minetest.set_node(pusher_pos, {param2 = node.param2, name = pistonspec.pusher})
|
||||
minetest.sound_play("piston_extend", {
|
||||
pos = pos,
|
||||
max_hear_distance = 20,
|
||||
gain = 0.3,
|
||||
})
|
||||
minetest.sound_play("piston_extend", { pos = pos, max_hear_distance = 20, gain = 0.3 }, true)
|
||||
mesecon.mvps_process_stack(stack)
|
||||
mesecon.mvps_move_objects(pusher_pos, dir, oldstack)
|
||||
end
|
||||
|
2
mesecons_pistons/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_pistons
|
||||
depends = mesecons, mesecons_mvps
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_powerplant/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_powerplant
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -24,7 +24,7 @@ local function pp_on_timer(pos, elapsed)
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
elseif node.name == basename .. "_off" then
|
||||
for k, obj in pairs(objs) do
|
||||
local objpos = obj:getpos()
|
||||
local objpos = obj:get_pos()
|
||||
if objpos.y > pos.y-1 and objpos.y < pos.y then
|
||||
minetest.set_node(pos, {name = basename .. "_on"})
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate )
|
||||
|
2
mesecons_pressureplates/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_pressureplates
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_random/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_random
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_receiver/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_receiver
|
||||
depends = mesecons
|
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
mesecons_materials
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.1 KiB |
@ -1,98 +1,60 @@
|
||||
-- Solar Panel
|
||||
minetest.register_node("mesecons_solarpanel:solar_panel_on", {
|
||||
drawtype = "nodebox",
|
||||
tiles = { "jeija_solar_panel.png", },
|
||||
inventory_image = "jeija_solar_panel.png",
|
||||
wield_image = "jeija_solar_panel.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
|
||||
wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
|
||||
wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
|
||||
wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
|
||||
wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
|
||||
},
|
||||
drop = "mesecons_solarpanel:solar_panel_off",
|
||||
groups = {dig_immediate=3, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = mesecon.rules.wallmounted_get,
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode,
|
||||
})
|
||||
|
||||
-- Solar Panel
|
||||
minetest.register_node("mesecons_solarpanel:solar_panel_off", {
|
||||
drawtype = "nodebox",
|
||||
tiles = { "jeija_solar_panel.png", },
|
||||
inventory_image = "jeija_solar_panel.png",
|
||||
wield_image = "jeija_solar_panel.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
|
||||
wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
|
||||
wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
|
||||
wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
|
||||
wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
|
||||
},
|
||||
groups = {dig_immediate=3},
|
||||
mesecon.register_node("mesecons_solarpanel:solar_panel", {
|
||||
description = "Solar Panel",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"mesecons_solarpanel.png"},
|
||||
inventory_image = "mesecons_solarpanel.png",
|
||||
wield_image = "mesecons_solarpanel.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = {-7/16, -8/16, -7/16, 7/16, -7/16, 7/16},
|
||||
wall_top = {-7/16, 7/16, -7/16, 7/16, 8/16, 7/16},
|
||||
wall_side = {-8/16, -7/16, -7/16, -7/16, 7/16, 7/16},
|
||||
},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
on_blast = mesecon.on_blastnode,
|
||||
},{
|
||||
groups = {dig_immediate = 3},
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = mesecon.rules.wallmounted_get,
|
||||
rules = mesecon.rules.wallmounted_get
|
||||
}}
|
||||
},{
|
||||
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = mesecon.rules.wallmounted_get
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mesecons_solarpanel:solar_panel_off 1",
|
||||
output = "mesecons_solarpanel:solar_panel_off",
|
||||
recipe = {
|
||||
{"mesecons_materials:silicon", "mesecons_materials:silicon"},
|
||||
{"mesecons_materials:silicon", "mesecons_materials:silicon"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_solarpanel:solar_panel_off"},
|
||||
minetest.register_abm({
|
||||
label = "Solar Panel On/Off",
|
||||
nodenames = {
|
||||
"mesecons_solarpanel:solar_panel_off",
|
||||
"mesecons_solarpanel:solar_panel_on"
|
||||
},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
local light = minetest.get_node_light(pos)
|
||||
|
||||
if light >= 12 then
|
||||
if light >= 12 and node.name == "mesecons_solarpanel:solar_panel_off" then
|
||||
node.name = "mesecons_solarpanel:solar_panel_on"
|
||||
minetest.swap_node(pos, node)
|
||||
mesecon.receptor_on(pos, mesecon.rules.wallmounted_get(node))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_solarpanel:solar_panel_on"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local light = minetest.get_node_light(pos)
|
||||
|
||||
if light < 12 then
|
||||
elseif light < 12 and node.name == "mesecons_solarpanel:solar_panel_on" then
|
||||
node.name = "mesecons_solarpanel:solar_panel_off"
|
||||
minetest.swap_node(pos, node)
|
||||
mesecon.receptor_off(pos, mesecon.rules.wallmounted_get(node))
|
||||
|
2
mesecons_solarpanel/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_solarpanel
|
||||
depends = mesecons, mesecons_materials
|
Before Width: | Height: | Size: 612 B |
BIN
mesecons_solarpanel/textures/mesecons_solarpanel.png
Normal file
After Width: | Height: | Size: 607 B |
@ -1,2 +0,0 @@
|
||||
mesecons
|
||||
mesecons_mvps
|
2
mesecons_stickyblocks/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_stickyblocks
|
||||
depends = mesecons, mesecons_mvps
|
@ -1 +0,0 @@
|
||||
mesecons
|
@ -11,7 +11,7 @@ mesecon.register_node("mesecons_switch:mesecon_switch", {
|
||||
else
|
||||
mesecon.receptor_off(pos)
|
||||
end
|
||||
minetest.sound_play("mesecons_switch", {pos=pos})
|
||||
minetest.sound_play("mesecons_switch", { pos = pos }, true)
|
||||
end
|
||||
},{
|
||||
groups = {dig_immediate=2},
|
||||
|
2
mesecons_switch/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_switch
|
||||
depends = mesecons
|
@ -1 +0,0 @@
|
||||
mesecons
|
2
mesecons_torch/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mesecons_torch
|
||||
depends = mesecons
|