Initial commit

master
AndrejIT 2021-07-26 14:43:58 +03:00 committed by Andrejs
commit 7faee9a7de
52 changed files with 1703 additions and 0 deletions

30
COPYING.txt Executable file
View File

@ -0,0 +1,30 @@
The Mesecons Mod for Minetest is
Copyright (C) 2011-2016 Mesecons Mod Developer Team and contributors
See the version control system log for information about other authors.
License of source code
----------------------
Copyright (C) 2011-2016 Mesecons Mod Developer Team and contributors
This program is free software; you can redistribute the Mesecons Mod and/or
modify it under the terms of the GNU Lesser General Public License version 3
published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
License of media (textures, sounds and documentation)
-----------------------------------------------------
Copyright (C) 2011-2016 Mesecons Mod Developer Team and contributors
All textures, sounds and documentation files are licensed under the
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/

11
README.md Executable file
View File

@ -0,0 +1,11 @@
Electricity mod for minetest game.
Reworked from mesecons mod https://github.com/minetest-mods/mesecons/
Mesecons are great, but too much to be suitable to be put on survival server.
Also, Mesecons code segmentation was too mind-blowing for me to make any modifications. (at least when i started)
So i introduced my own concept.
Hopefully, it will work well enough.
And surely it will be fun!

3
alias.lua Executable file
View File

@ -0,0 +1,3 @@
-- This file registers aliases for the /give /giveme commands.
minetest.register_alias("electricity:wire", "electricity:wire_off")

2
depends.txt Executable file
View File

@ -0,0 +1,2 @@
default
coordinate_helper?

839
init.lua Executable file
View File

@ -0,0 +1,839 @@
electricity = {}
-- nodes electricity level. store only until server restart.
electricity.rdata = {}
electricity.producers = {} -- pos of all electricity producers.
electricity.not_producers = {} -- pos of all other electricity nodes.
-- electricity.rdata2 = {} -- additional rule sets
-- electricity.rdata3 = {}
dofile(minetest.get_modpath("electricity").."/internal.lua")
-- dofile(minetest.get_modpath("electricity").."/link_core.lua")
-- a little recursion to distribute voltage from producers
function electricity.traverse_connected_nodes(self_pos)
local h = minetest.hash_node_position(self_pos)
local volt = electricity.get(self_pos, self_pos)
if volt == 0 then
return
end
local neighbors = electricity.get_connected_pos(self_pos)
for _, pos in ipairs(neighbors) do
local volt_n = electricity.get(pos, self_pos)
if volt_n == 0 then
electricity.set(pos, self_pos, 1)
-- recurse another nodes
electricity.traverse_connected_nodes(pos)
end
end
end
-- Swap electricity node on or off
function electricity.swap_on_off(self_pos)
local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
if node_reg and
node_reg.electricity
then
local volt = electricity.get(self_pos, self_pos)
if volt == 1 and node.name == node_reg.electricity.name_off then
node.name = node_reg.electricity.name_on
minetest.swap_node(self_pos, node)
elseif volt == 0 and node.name == node_reg.electricity.name_on then
node.name = node_reg.electricity.name_off
minetest.swap_node(self_pos, node)
end
end
end
function electricity.set(self_pos, from_pos, count)
local h = minetest.hash_node_position(self_pos)
electricity.rdata[h] = count
return 0
end
function electricity.get(self_pos, from_pos)
local h = minetest.hash_node_position(self_pos)
local count = 0
if electricity.rdata[h] ~= nil then
count = electricity.rdata[h]
end
return count
end
-- electricity register nodes
minetest.register_abm{
label = "electricity node setup",
nodenames = {"group:electricity_conductor", "group:electricity_consumer"},
interval = 5,
chance = 1,
catch_up = false,
action = function(pos)
local h = minetest.hash_node_position(pos)
if electricity.not_producers[h] == nil then
electricity.not_producers[h] = pos
electricity.set(pos, pos, 0)
end
end,
}
minetest.register_abm{
label = "electricity node setup",
nodenames = {"group:electricity_producer"},
interval = 5,
chance = 1,
catch_up = false,
action = function(pos)
local h = minetest.hash_node_position(pos)
if electricity.producers[h] == nil then
electricity.producers[h] = pos
electricity.set(pos, pos, 0)
end
end,
}
-- electricity works
minetest.register_abm{
label = "electricity contsumption",
nodenames = {"group:electricity_consumer", "group:electricity_conductor"},
interval = 1,
chance = 1,
catch_up = false,
action = function(pos)
electricity.swap_on_off(pos)
end,
}
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
if timer >= 2 then
-- recalculate vhere is voltage.
for _, pos in pairs(electricity.not_producers) do
electricity.set(pos, pos, 0)
end
for _, pos in pairs(electricity.producers) do
electricity.traverse_connected_nodes(pos)
end
timer = 0
end
end)
local wire_definition_base = {
description = "Electricity wire",
drop = "electricity:wire_off",
inventory_image = "electricity_wire_inv.png",
wield_image = "electricity_wire_inv.png",
tiles = {"electricity_wire_off.png"},
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.5, 0.1, -0.45, 0.5},
},
},
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_construct = function(pos, node, digger)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = pos
electricity.set(pos, pos, 0)
end,
after_destruct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = nil
electricity.rdata[h] = nil
end,
electricity = {
rules = {
{x=1,y=0,z=0}, -- front
{x=-1,y=0,z=0}, -- back
{x=0,y=-1,z=0}, -- bottom?
},
name_on = "electricity:wire_on",
name_off = "electricity:wire_off",
},
groups = {electricity = 1, electricity_conductor = 1, cracky = 3, oddly_breakable_by_hand = 3}, -- remove electricity = 1 to preserve resources
}
-- WIRE --
local wire_definition = table.copy(wire_definition_base) -- careful, this copy is not deep
minetest.register_node("electricity:wire_off", wire_definition)
wire_definition = table.copy(wire_definition)
wire_definition.tiles = {"electricity_wire_on.png"}
wire_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_on", wire_definition)
-- WIRE BEND --
local wire_bend_definition = table.copy(wire_definition_base)
wire_bend_definition.description = "Electricity wire bend"
wire_bend_definition.drop = "electricity:wire_bend_off"
wire_bend_definition.inventory_image = "electricity_wire_bend_inv.png"
wire_bend_definition.wield_image = "electricity_wire_bend_inv.png"
wire_bend_definition.node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.5, 0.1, -0.45, 0.1}, -- z=-1
{-0.5, -0.5, -0.1, -0.1, -0.45, 0.1}, -- x=1
},
}
wire_bend_definition.electricity = {
rules = {
{x=1,y=0,z=0},
{x=0,y=0,z=-1},
{x=0,y=-1,z=0},
},
name_on = "electricity:wire_bend_on",
name_off = "electricity:wire_bend_off",
}
minetest.register_node("electricity:wire_bend_off", wire_bend_definition)
wire_bend_definition = table.copy(wire_bend_definition)
wire_bend_definition.tiles = {"electricity_wire_on.png"}
wire_bend_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_bend_on", wire_bend_definition)
-- WIRE BRANCH --
local wire_branch_definition = table.copy(wire_definition_base)
wire_branch_definition.description = "Electricity wire branch"
wire_branch_definition.drop = "electricity:wire_branch_off"
wire_branch_definition.inventory_image = "electricity_wire_branch_inv.png"
wire_branch_definition.wield_image = "electricity_wire_branch_inv.png"
wire_branch_definition.node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.5, 0.1, -0.45, 0.1}, -- z=-1
{-0.5, -0.5, -0.1, -0.1, -0.45, 0.1}, -- x=1
{0.1, -0.5, -0.1, 0.5, -0.45, 0.1}, -- x=-1
},
}
wire_branch_definition.electricity = {
rules = {
{x=1,y=0,z=0},
{x=0,y=0,z=-1},
{x=0,y=0,z=1},
{x=0,y=-1,z=0},
},
name_on = "electricity:wire_branch_on",
name_off = "electricity:wire_branch_off",
}
minetest.register_node("electricity:wire_branch_off", wire_branch_definition)
wire_branch_definition = table.copy(wire_branch_definition)
wire_branch_definition.tiles = {"electricity_wire_on.png"}
wire_branch_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_branch_on", wire_branch_definition)
-- WIRE BEND UP --
local wire_bend_up_definition = table.copy(wire_definition_base)
wire_bend_up_definition.description = "Electricity wire bend up"
wire_bend_up_definition.drop = "electricity:wire_bend_up_off"
wire_bend_up_definition.inventory_image = "electricity_wire_bend_up_inv.png"
wire_bend_up_definition.wield_image = "electricity_wire_bend_up_inv.png"
wire_bend_up_definition.node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.5, 0.1, -0.45, -0.1}, -- z=-1
{-0.1, -0.5, -0.1, 0.1, 0.5, 0.1}, -- y=1
},
}
wire_bend_up_definition.electricity = {
rules = {
{x=1,y=0,z=0},
{x=0,y=1,z=0},
{x=0,y=-1,z=0},
},
name_on = "electricity:wire_bend_up_on",
name_off = "electricity:wire_bend_up_off",
}
minetest.register_node("electricity:wire_bend_up_off", wire_bend_up_definition)
wire_bend_up_definition = table.copy(wire_bend_up_definition)
wire_bend_up_definition.tiles = {"electricity_wire_on.png"}
wire_bend_up_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_bend_up_on", wire_bend_up_definition)
-- WIRE UP --
local wire_up_definition = table.copy(wire_definition_base)
wire_up_definition.description = "Electricity wire vertical"
wire_up_definition.drop = "electricity:wire_up_off"
wire_up_definition.inventory_image = "electricity_wire_up_inv.png"
wire_up_definition.wield_image = "electricity_wire_up_inv.png"
wire_up_definition.node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.1, 0.1, 0.5, 0.1}, -- y=1
},
}
wire_up_definition.electricity = {
rules = {
{x=0,y=1,z=0},
{x=0,y=-1,z=0},
},
name_on = "electricity:wire_up_on",
name_off = "electricity:wire_up_off",
}
minetest.register_node("electricity:wire_up_off", wire_up_definition)
wire_up_definition = table.copy(wire_up_definition)
wire_up_definition.tiles = {"electricity_wire_on.png"}
wire_up_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_up_on", wire_up_definition)
-- WIRE BRANCH UP --
local wire_branch_up_definition = table.copy(wire_definition_base)
wire_branch_up_definition.description = "Electricity wire branch up"
wire_branch_up_definition.drop = "electricity:wire_branch_up_off"
wire_branch_up_definition.inventory_image = "electricity_wire_branch_up_inv.png"
wire_branch_up_definition.wield_image = "electricity_wire_branch_up_inv.png"
wire_branch_up_definition.node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.5, 0.1, -0.45, -0.1}, -- z=-1
{-0.1, -0.5, -0.1, 0.1, 0.5, 0.1}, -- y=1
{-0.1, -0.5, 0.1, 0.1, -0.45, 0.5}, -- z=1
},
}
wire_branch_up_definition.electricity = {
rules = {
{x=1,y=0,z=0},
{x=-1,y=0,z=0},
{x=0,y=1,z=0},
{x=0,y=-1,z=0},
},
name_on = "electricity:wire_branch_up_on",
name_off = "electricity:wire_branch_up_off",
}
minetest.register_node("electricity:wire_branch_up_off", wire_branch_up_definition)
wire_branch_up_definition = table.copy(wire_branch_up_definition)
wire_branch_up_definition.tiles = {"electricity_wire_on.png"}
wire_branch_up_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_branch_up_on", wire_branch_up_definition)
-- WIRE HALF --
local wire_half_definition = table.copy(wire_definition_base)
wire_half_definition.description = "Electricity wire half"
wire_half_definition.drop = "electricity:wire_half_off"
wire_half_definition.inventory_image = "electricity_wire_half_inv.png"
wire_half_definition.wield_image = "electricity_wire_half_inv.png"
wire_half_definition.node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.5, 0.1, -0.45, 0.1}, -- z=-1
},
}
wire_half_definition.electricity = {
rules = {
{x=1,y=0,z=0},
{x=0,y=-1,z=0},
},
name_on = "electricity:wire_half_on",
name_off = "electricity:wire_half_off",
}
minetest.register_node("electricity:wire_half_off", wire_half_definition)
wire_half_definition = table.copy(wire_half_definition)
wire_half_definition.tiles = {"electricity_wire_on.png"}
wire_half_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:wire_half_on", wire_half_definition)
-- LAMP --
local lamp_definition_base = {
description = "Electricity lamp",
drop = "electricity:lamp_off",
inventory_image = "jeija_meselamp.png",
wield_image = "jeija_meselamp.png",
tiles = {"lamp_off.png","lamp_off.png","lamp_off.png"},
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_top = { -0.5, 0.3, -0.5, 0.5, 0.5, 0.5 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.3, 0.5 },
wall_side = { -0.3, -0.5, -0.5, -0.5, 0.5, 0.5 },
},
paramtype2 = "wallmounted",
is_ground_content = false,
on_construct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = pos
electricity.set(pos, pos, 0)
-- minetest.get_node_timer(pos):start(1.0)
end,
after_destruct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = nil
electricity.rdata[h] = nil
end,
electricity = {
rules = {
{x=0,y=1,z=0}, -- left :|
{x=-1,y=0,z=0}, -- bottom :|
{x=0,y=0,z=1},
{x=0,y=0,z=-1},
{x=0,y=-1,z=0},
},
name_on = "electricity:lamp_on",
name_off = "electricity:lamp_off",
},
groups = {electricity = 1, electricity_consumer = 1, cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_stone_defaults(),
}
local lamp_definition = table.copy(lamp_definition_base)
minetest.register_node("electricity:lamp_off", lamp_definition)
lamp_definition = table.copy(lamp_definition)
lamp_definition.light_source = minetest.LIGHT_MAX
lamp_definition.tiles = {"lamp_on.png","lamp_on.png","lamp_on.png"}
lamp_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:lamp_on", lamp_definition)
-- PRESSURE PLATE --
function electricity.plate_on_timer(self_pos, elapsed)
local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
if node_reg and
node_reg.electricity and
node_reg.electricity.name_enabled
then
local objs = minetest.get_objects_inside_radius(self_pos, 1)
if objs[1] ~= nil then
if node.name == node_reg.electricity.name_disabled then
node.name = node_reg.electricity.name_enabled
minetest.swap_node(self_pos, node)
end
else
if node.name == node_reg.electricity.name_enabled then
node.name = node_reg.electricity.name_disabled
minetest.swap_node(self_pos, node)
end
end
end
end
local plate_definition_base = {
description = "Electricity pressure plate",
drop = "electricity:pressure_plate_off",
inventory_image = "jeija_pressure_plate_stone_inv.png",
wield_image = "jeija_pressure_plate_stone_wield.png",
tiles = {"jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off_edges.png"},
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 },
},
paramtype2 = "facedir",
is_ground_content = false,
on_timer = function(pos, elapsed)
electricity.plate_on_timer(pos, elapsed)
return true
end,
on_construct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = pos
electricity.set(pos, pos, 0)
minetest.get_node_timer(pos):start(0.5)
end,
after_destruct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = nil
electricity.rdata[h] = nil
end,
electricity = {
rules = {
},
name_enabled = "electricity:pressure_plate_on",
name_disabled = "electricity:pressure_plate_off",
},
groups = {electricity = 1, electricity_conductor = 1, cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_stone_defaults(),
}
local plate_definition = table.copy(plate_definition_base)
minetest.register_node("electricity:pressure_plate_off", plate_definition)
plate_definition = table.copy(plate_definition)
plate_definition.tiles = {"jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on_edges.png"}
plate_definition.node_box.fixed = { -0.5, -0.5, -0.5, 0.5, -7.5/16, 0.5 }
plate_definition.electricity.rules = {
{x=0,y=-1,z=0}, -- bottom :|
{x=-1,y=0,z=0}, -- front :|
{x=1,y=0,z=0},
{x=0,y=0,z=-1},
{x=0,y=0,z=1},
}
plate_definition.groups["not_in_creative_inventory"] = 1
minetest.register_node("electricity:pressure_plate_on", plate_definition)
-- SOLAR PANEL --
function electricity.solar_on_timer(self_pos, elapsed)
local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
local light = minetest.get_node_light(self_pos, nil)
local day = false
if minetest.get_timeofday() > 0.25 and minetest.get_timeofday() < 0.75 then
day = true
end
local altitude = self_pos.y -- More stable electricity if higher position
if altitude < 0 then
altitude = 0
elseif altitude > 25 then
altitude = 25
end
if node_reg and
node_reg.electricity and
day and
light >= 12 and
altitude > 0 and
math.random(0, 75+altitude) > 70
then
electricity.set(self_pos, self_pos, 1) -- produce lectricity
else
electricity.set(self_pos, self_pos, 0) -- no electricity
end
end
local solar_definition_base = {
description = "Electricity solar panel",
inventory_image = "jeija_solar_panel.png",
wield_image = "jeija_solar_panel.png",
tiles = {"jeija_solar_panel.png","jeija_solar_panel.png","jeija_solar_panel.png"},
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_top = { -0.5, 0.4, -0.5, 0.5, 0.5, 0.5 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4, 0.5 },
wall_side = { -0.4, -0.5, -0.5, -0.5, 0.5, 0.5 },
},
paramtype2 = "wallmounted",
is_ground_content = false,
on_timer = function(pos, elapsed)
electricity.solar_on_timer(pos, elapsed)
return true
end,
on_construct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.producers[h] = pos
electricity.set(pos, pos, 0)
minetest.get_node_timer(pos):start(1.5)
end,
after_destruct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.producers[h] = nil
electricity.rdata[h] = nil
end,
electricity = {
rules = {
{x=0,y=1,z=0}, -- left :|
{x=-1,y=0,z=0}, -- bottom :|
{x=0,y=0,z=1},
{x=0,y=0,z=-1},
{x=0,y=-1,z=0},
},
name_enabled = "electricity:solar",
-- name_disabled = "electricity:solar",
},
groups = {electricity = 1, electricity_producer = 1, cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_stone_defaults(),
}
local solar_definition = table.copy(solar_definition_base)
minetest.register_node("electricity:solar", solar_definition)
-- LEVER --
function electricity:lever_on_rightclick(self_pos, node)
-- local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
if node.name == node_reg.electricity.name_disabled then
node.name = node_reg.electricity.name_enabled
minetest.swap_node(self_pos, node)
else
node.name = node_reg.electricity.name_disabled
minetest.swap_node(self_pos, node)
end
minetest.sound_play("mesecons_lever", {
pos = self_pos,
max_hear_distance = 16,
gain = 10.0,
})
end
local lever_definition_base = {
description = "Electricity lever",
drop = "electricity:lever_off",
inventory_image = "jeija_wall_lever_inv.png",
wield_image = "jeija_wall_lever_inv.png",
tiles = {
"jeija_wall_lever_lever_light_off.png",
"jeija_wall_lever_front.png",
"jeija_wall_lever_front_bump.png",
"jeija_wall_lever_back_edges.png"
},
paramtype = "light",
drawtype = "mesh",
mesh = "jeija_wall_lever_off.obj",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.2, 0.5, 0.5, 0.5 },
},
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_rightclick = function (pos, node)
electricity:lever_on_rightclick(pos, node)
end,
on_construct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = pos
electricity.set(pos, pos, 0)
end,
after_destruct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = nil
electricity.rdata[h] = nil
end,
electricity = {
rules = {
},
name_enabled = "electricity:lever_on",
name_disabled = "electricity:lever_off",
},
groups = {electricity = 1, cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
}
local lever_definition = table.copy(lever_definition_base)
minetest.register_node("electricity:lever_off", lever_definition)
lever_definition = table.copy(lever_definition)
lever_definition.tiles = {
"jeija_wall_lever_lever_light_on.png",
"jeija_wall_lever_front.png",
"jeija_wall_lever_front_bump.png",
"jeija_wall_lever_back_edges.png"
}
lever_definition.groups["not_in_creative_inventory"] = 1
lever_definition.mesh = "jeija_wall_lever_on.obj"
lever_definition.electricity.rules = {
{x=0,y=1,z=0},
{x=-1,y=0,z=0},
{x=0,y=0,z=1},
{x=0,y=0,z=-1},
{x=0,y=-1,z=0},
}
minetest.register_node("electricity:lever_on", lever_definition)
-- TRANSISTOR
function electricity.transistor_on_timer(self_pos, elapsed)
local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
if node_reg and
node_reg.electricity and
node_reg.electricity.name_enabled
then
local face_vector = nil
if node_reg.paramtype2 == "wallmounted" then
face_vector = vector.multiply(minetest.wallmounted_to_dir(node.param2), -1)
elseif node_reg.paramtype2 == "facedir" then
face_vector = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
else
face_vector = vector.new(1,0,0)
end
local base_pos = get_pos_relative(self_pos, {x=0, y=0, z=-1}, face_vector)
local h = minetest.hash_node_position(base_pos)
local volt = 0
if electricity.rdata[h] ~= nil then
volt = electricity.rdata[h]
end
if electricity.check_relative_rule(base_pos, self_pos) and volt == 1 then
if node.name == node_reg.electricity.name_disabled then
node.name = node_reg.electricity.name_enabled
minetest.swap_node(self_pos, node)
end
else
if node.name == node_reg.electricity.name_enabled then
node.name = node_reg.electricity.name_disabled
minetest.swap_node(self_pos, node)
end
end
end
end
local transistor_definition_base = {
description = "Electricity transistor",
drop = "electricity:transistor_off",
inventory_image = "electricity_transistor.png",
wield_image = "electricity_transistor.png",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }},
},
node_box = {
type = "fixed",
fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }},
},
tiles = {"electricity_transistor.png^".."jeija_gate_off.png^"..
"electricity_transistor.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_timer = function(pos, elapsed)
electricity.transistor_on_timer(pos, elapsed)
return true
end,
on_construct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = pos
electricity.set(pos, pos, 0)
minetest.get_node_timer(pos):start(0.5)
end,
after_destruct = function(pos)
local h = minetest.hash_node_position(pos)
electricity.not_producers[h] = nil
electricity.rdata[h] = nil
end,
electricity = {
rules = {
},
name_enabled = "electricity:transistor_on",
name_disabled = "electricity:transistor_off",
},
groups = {electricity = 1, electricity_conductor = 1, cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
}
local transistor_definition = table.copy(transistor_definition_base)
minetest.register_node("electricity:transistor_off", transistor_definition)
transistor_definition = table.copy(transistor_definition)
transistor_definition.tiles = {"electricity_transistor.png^".."jeija_gate_on.png^"..
"electricity_transistor.png"}
transistor_definition.groups["not_in_creative_inventory"] = 1
transistor_definition.electricity.rules = {
{x=-1,y=0,z=0},
{x=1,y=0,z=0},
{x=0,y=-1,z=0}, -- also bottom
}
minetest.register_node("electricity:transistor_on", transistor_definition)
-- ##############
-- ## Crafting ##
-- ##############
minetest.register_craft({
output = "electricity:wire_off",
recipe = {
{"default:copper_ingot", "", ""},
{"default:copper_ingot", "", ""},
{"default:copper_ingot", "", ""}
}
})
minetest.register_craft({
output = "electricity:wire_half_off",
recipe = {
{"default:copper_ingot", "", ""},
{"default:copper_ingot", "", ""},
{"", "", ""}
}
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_bend_off",
recipe = {"electricity:wire_off"}
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_branch_off",
recipe = {"electricity:wire_off", "electricity:wire_half_off"}
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_bend_up_off",
recipe = {"electricity:wire_bend_off"}
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_up_off",
recipe = {"electricity:wire_bend_up_off"}
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_off",
recipe = {"electricity:wire_up_off"},
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_branch_up_off",
recipe = {"electricity:wire_branch_off"},
})
minetest.register_craft({
type = "shapeless",
output = "electricity:wire_branch_off",
recipe = {"electricity:wire_branch_up_off"},
})
minetest.register_craft({
output = "electricity:pressure_plate_off",
recipe = {
{"", "default:stonebrick", ""},
{"electricity:wire_off", "default:copperblock", "electricity:wire_off"},
{"", "default:steelblock", ""}
}
})
minetest.register_craft({
output = "electricity:solar",
recipe = {
{"default:glass", "default:glass", "default:glass"},
{"electricity:wire_off", "default:coalblock", "electricity:wire_off"},
{"default:obsidian", "default:obsidian", "default:obsidian"}
}
})
minetest.register_craft({
output = "electricity:lamp_off",
recipe = {
{"", "default:glass", ""},
{"electricity:wire_off", "default:steelblock", "electricity:wire_off"},
{"", "default:glass", ""}
}
})
minetest.register_craft({
output = "electricity:lever_off",
recipe = {
{"", "default:copperblock", ""},
{"electricity:wire_off", "default:wood", "electricity:wire_off"},
{"", "default:stick", ""}
}
})
minetest.register_craft({
output = "electricity:transistor_off",
recipe = {
{"", "electricity:wire_off", ""},
{"electricity:wire_off", "default:mese_crystal", "electricity:wire_off"},
{"", "default:obsidian", ""}
}
})

386
internal.lua Executable file
View File

@ -0,0 +1,386 @@
-- cache node conn data to use it when unloaded?
electricity.conn_cache = {}
-- Can i make "electricity" code simplier?
-- check if first rule connects to pos
function electricity.check_relative_rule(self_pos, to_pos)
local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
if node_reg and
node_reg.electricity and
node_reg.electricity.rules
then
local allrules = node_reg.electricity.rules
local face_vector = nil
local down_vector = nil
if node_reg.paramtype2 == "wallmounted" then
face_vector = vector.multiply(minetest.wallmounted_to_dir(node.param2), -1)
elseif node_reg.paramtype2 == "facedir" then
face_vector = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
else
face_vector = vector.new(1,0,0)
end
if allrules[1] and allrules[1].x then
for _, rule in ipairs(allrules) do
if vector.equals(get_pos_relative(self_pos, rule, face_vector, down_vector), to_pos) then
return true
end
end
elseif allrules[1] then
metarule = allrules[1]
for _, rule in ipairs(metarule) do
if vector.equals(get_pos_relative(self_pos, rule, face_vector, down_vector), to_pos) then
return true
end
end
end
end
return false
end
-- get list of all connected positions for first rule
function electricity.get_connected_pos(self_pos)
local h = minetest.hash_node_position(self_pos)
local node = minetest.get_node_or_nil(self_pos)
-- return from cache when not loaded or has not loaded neighbor
if electricity.conn_cache[h] then
if not node then
return electricity.conn_cache[h]
end
local n1 = minetest.get_node_or_nil({x=self_pos.x+1, y=self_pos.y, z=self_pos.z})
local n2 = minetest.get_node_or_nil({x=self_pos.x-1, y=self_pos.y, z=self_pos.z})
local n3 = minetest.get_node_or_nil({x=self_pos.x, y=self_pos.y, z=self_pos.z+1})
local n4 = minetest.get_node_or_nil({x=self_pos.x, y=self_pos.y, z=self_pos.z-1})
local n5 = minetest.get_node_or_nil({x=self_pos.x, y=self_pos.y+1, z=self_pos.z})
local n6 = minetest.get_node_or_nil({x=self_pos.x, y=self_pos.y-1, z=self_pos.z})
if not n1 or not n2 or not n3 or not n4 or not n5 or not n6 then
return electricity.conn_cache[h]
end
end
local node_reg = minetest.registered_nodes[node.name]
if node_reg and
node_reg.electricity and
node_reg.electricity.rules
then
local allrules = node_reg.electricity.rules
local face_vector = nil
local down_vector = nil
if node_reg.paramtype2 == "wallmounted" then
face_vector = vector.multiply(minetest.wallmounted_to_dir(node.param2), -1)
elseif node_reg.paramtype2 == "facedir" then
face_vector = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
else
face_vector = vector.new(1,0,0)
end
local connected_pos_list = {}
if allrules[1] and allrules[1].x then
for _, rule in ipairs(allrules) do
local to_pos = get_pos_relative(self_pos, rule, face_vector, down_vector)
-- minetest.chat_send_all(minetest.serialize(rule))
-- minetest.chat_send_all(minetest.serialize(face_vector))
-- minetest.chat_send_all(minetest.serialize(to_pos))
-- minetest.chat_send_all(minetest.serialize("-"))
if electricity.check_relative_rule(to_pos, self_pos) then
table.insert(connected_pos_list, to_pos)
end
end
elseif allrules[1] then
metarule = allrules[1]
for _, rule in ipairs(metarule) do
local to_pos = get_pos_relative(self_pos, rule, face_vector, down_vector)
if electricity.check_relative_rule(to_pos, self_pos) then
table.insert(connected_pos_list, to_pos)
end
end
end
electricity.conn_cache[h] = connected_pos_list
return connected_pos_list
end
return {}
end
-- not used...
-- check if first position connects to second
function electricity.check_forward(pos1, pos2)
local node = minetest.get_node(pos1)
local node_reg = minetest.registered_nodes[node.name]
local rules = {}
if node_reg and
node_reg.electricity and
node_reg.electricity.rules
then
rules = node_reg.electricity.rules
end
local face_vector = nil
local down_vector = nil
if node_reg.paramtype2 == "wallmounted" then
face_vector = vector.multiply(minetest.wallmounted_to_dir(node.param2), -1)
elseif node_reg.paramtype2 == "facedir" then
face_vector = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
else
face_vector = vector.new(1,0,0)
end
for _, rule in ipairs(rules) do
if vector.equals(get_pos_relative(pos1, rule, face_vector, down_vector), pos2) then
return true
end
end
return false
end
-- not used ...
-- get list of connected AND disconnected "electricity" neighbors positions
function electricity.get_all_pos(self_pos)
local node = minetest.get_node(self_pos)
local node_reg = minetest.registered_nodes[node.name]
local rules = {}
local connected_pos_list = {}
local disconnected_pos_list = {}
local tmp_pos_list = {}
tmp_pos_list = minetest.find_nodes_in_area(
{x=self_pos.x-1, y=self_pos.y-1, z=self_pos.z},
{x=self_pos.x-1, y=self_pos.y+1, z=self_pos.z},
{"group:electricity"}
)
for _, pos in ipairs(tmp_pos_list) do
table.insert(disconnected_pos_list, pos)
end
tmp_pos_list = minetest.find_nodes_in_area(
{x=self_pos.x+1, y=self_pos.y-1, z=self_pos.z},
{x=self_pos.x+1, y=self_pos.y+1, z=self_pos.z},
{"group:electricity"}
)
for _, pos in ipairs(tmp_pos_list) do
table.insert(disconnected_pos_list, pos)
end
tmp_pos_list = minetest.find_nodes_in_area(
{x=self_pos.x, y=self_pos.y-1, z=self_pos.z-1},
{x=self_pos.x, y=self_pos.y-1, z=self_pos.z+1},
{"group:electricity"}
)
for _, pos in ipairs(tmp_pos_list) do
table.insert(disconnected_pos_list, pos)
end
tmp_pos_list = minetest.find_nodes_in_area(
{x=self_pos.x, y=self_pos.y+1, z=self_pos.z-1},
{x=self_pos.x, y=self_pos.y+1, z=self_pos.z+1},
{"group:electricity"}
)
for _, pos in ipairs(tmp_pos_list) do
table.insert(disconnected_pos_list, pos)
end
tmp_pos_list = minetest.find_nodes_in_area(
{x=self_pos.x-1, y=self_pos.y, z=self_pos.z-1},
{x=self_pos.x+1, y=self_pos.y, z=self_pos.z-1},
{"group:electricity"}
)
for _, pos in ipairs(tmp_pos_list) do
table.insert(disconnected_pos_list, pos)
end
tmp_pos_list = minetest.find_nodes_in_area(
{x=self_pos.x-1, y=self_pos.y, z=self_pos.z+1},
{x=self_pos.x+1, y=self_pos.y, z=self_pos.z+1},
{"group:electricity"}
)
for _, pos in ipairs(tmp_pos_list) do
table.insert(disconnected_pos_list, pos)
end
if node_reg and
node_reg.electricity and
node_reg.electricity.rules
then
rules = node_reg.electricity.rules
end
local face_vector = nil
local down_vector = nil
if node_reg.paramtype2 == "wallmounted" then
face_vector = vector.multiply(minetest.wallmounted_to_dir(node.param2), -1)
elseif node_reg.paramtype2 == "facedir" then
face_vector = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
else
face_vector = vector.new(1,0,0)
end
for _, rule in ipairs(rules) do
local match = nil
local to_pos = get_pos_relative(self_pos, rule, face_vector, down_vector)
if electricity.check_forward(to_pos, self_pos) then
table.insert(connected_pos_list, to_pos)
for key, pos in ipairs(disconnected_pos_list) do
if vector.equals(to_pos, pos) then
match = key
break
end
end
end
if match ~= nil then
table.remove(disconnected_pos_list, match)
end
end
return connected_pos_list,disconnected_pos_list
end
-- this function is available separatelly in coordinate_helper mod
if not _G['get_pos_relative'] then --check global table if function already defined from coordinate_helper mod
-- x-FRONT/BACK, z-LEFT/RIGHT, y-UP/DOWN
function get_pos_relative(position, rel_pos, face_vector, down_vector)
local pos = {x=position.x,y=position.y,z=position.z}
assert(vector.length(face_vector) == 1, "Incorrect face vector")
-- oh no! "wallmounted" and "facedir" cannot store down vector. i choose defaults.
if not down_vector then
down_vector = {x=0, y=0, z=0}
if face_vector.y == 1 then
down_vector.x = 1
elseif face_vector.y == -1 then
down_vector.x = -1
else
down_vector.y = -1
end
end
assert(vector.length(down_vector) == 1, "Incorrect down vector")
assert(vector.length(vector.multiply(face_vector, down_vector)) == 0, "Down vector incompatible with face vector")
if rel_pos.x == 0 and rel_pos.y == 0 and rel_pos.z == 0 then
return {x=pos.x, y=pos.y, z=pos.z}
end
local fdir = face_vector
local ddir = down_vector
if fdir.x == 1 then -- NORD
pos.x = pos.x + rel_pos.x
if ddir.y == -1 then
pos.y = pos.y + rel_pos.y
pos.z = pos.z + rel_pos.z
elseif ddir.x == 1 then
assert(false, "Impossible vector combination!")
elseif ddir.x == -1 then
assert(false, "Impossible vector combination!")
elseif ddir.z == 1 then
pos.y = pos.y + rel_pos.z
pos.z = pos.z - rel_pos.y
elseif ddir.z == -1 then
pos.y = pos.y - rel_pos.z
pos.z = pos.z + rel_pos.y
elseif ddir.y == 1 then
pos.y = pos.y - rel_pos.y
pos.z = pos.z - rel_pos.z
end
elseif fdir.z == -1 then -- EAST
pos.z = pos.z - rel_pos.x
if ddir.y == -1 then
pos.y = pos.y + rel_pos.y
pos.x = pos.x + rel_pos.z
elseif ddir.x == 1 then
pos.y = pos.y + rel_pos.z
pos.x = pos.x - rel_pos.y
elseif ddir.x == -1 then
pos.y = pos.y - rel_pos.z
pos.x = pos.x + rel_pos.y
elseif ddir.z == 1 then
assert(false, "Impossible vector combination!")
elseif ddir.z == -1 then
assert(false, "Impossible vector combination!")
elseif ddir.y == 1 then
pos.y = pos.y - rel_pos.y
pos.x = pos.x - rel_pos.z
end
elseif fdir.x == -1 then -- SOUTH
pos.x = pos.x - rel_pos.x
if ddir.y == -1 then
pos.y = pos.y + rel_pos.y
pos.z = pos.z - rel_pos.z
elseif ddir.x == 1 then
assert(false, "Impossible vector combination!")
elseif ddir.x == -1 then
assert(false, "Impossible vector combination!")
elseif ddir.z == 1 then
pos.y = pos.y - rel_pos.z
pos.z = pos.z - rel_pos.y
elseif ddir.z == -1 then
pos.y = pos.y + rel_pos.z
pos.z = pos.z + rel_pos.y
elseif ddir.y == 1 then
pos.y = pos.y - rel_pos.y
pos.z = pos.z + rel_pos.z
end
elseif fdir.z == 1 then -- WEST
pos.z = pos.z + rel_pos.x
if ddir.y == -1 then
pos.y = pos.y + rel_pos.y
pos.x = pos.x - rel_pos.z
elseif ddir.x == 1 then
pos.y = pos.y - rel_pos.z
pos.x = pos.x - rel_pos.y
elseif ddir.x == -1 then
pos.y = pos.y + rel_pos.z
pos.x = pos.x + rel_pos.y
elseif ddir.z == 1 then
assert(false, "Impossible vector combination!")
elseif ddir.z == -1 then
assert(false, "Impossible vector combination!")
elseif ddir.y == 1 then
pos.y = pos.y - rel_pos.y
pos.x = pos.x + rel_pos.z
end
elseif fdir.y == 1 then -- UP
pos.y = pos.y + rel_pos.x
if ddir.y == -1 then
assert(false, "Impossible vector combination!")
elseif ddir.x == 1 then
pos.x = pos.x - rel_pos.y
pos.z = pos.z + rel_pos.z
elseif ddir.x == -1 then
pos.x = pos.x + rel_pos.y
pos.z = pos.z - rel_pos.z
elseif ddir.z == 1 then
pos.x = pos.x - rel_pos.z
pos.z = pos.z - rel_pos.y
elseif ddir.z == -1 then
pos.x = pos.x + rel_pos.z
pos.z = pos.z + rel_pos.y
elseif ddir.y == 1 then
assert(false, "Impossible vector combination!")
end
elseif fdir.y == -1 then -- DOWN
pos.y = pos.y - rel_pos.x
if ddir.y == -1 then
assert(false, "Impossible vector combination!")
elseif ddir.x == 1 then
pos.x = pos.x - rel_pos.y
pos.z = pos.z - rel_pos.z
elseif ddir.x == -1 then
pos.x = pos.x + rel_pos.y
pos.z = pos.z + rel_pos.z
elseif ddir.z == 1 then
pos.x = pos.x + rel_pos.z
pos.z = pos.z - rel_pos.y
elseif ddir.z == -1 then
pos.x = pos.x - rel_pos.z
pos.z = pos.z + rel_pos.y
elseif ddir.y == 1 then
assert(false, "Impossible vector combination!")
end
end
return pos
end
end

216
models/jeija_wall_lever_off.obj Executable file
View File

@ -0,0 +1,216 @@
# Blender v2.73 (sub 0) OBJ File: 'mesecons-wall-lever-off.blend'
# www.blender.org
o nodebox-5
v 0.281250 0.156250 0.312500
v -0.375000 0.375000 0.375000
v -0.375000 -0.375000 0.375000
v 0.343751 0.218750 0.375000
v 0.343751 -0.218752 0.375000
v 0.375000 0.375000 0.375000
v 0.375000 -0.375000 0.375000
v 0.281250 -0.156250 0.312500
v -0.062500 -0.055586 0.191789
v -0.062500 -0.087939 0.312529
v -0.062500 -0.413939 0.225178
v -0.062500 -0.381586 0.104437
v -0.343751 0.218750 0.375000
v 0.062500 -0.055586 0.191789
v 0.062500 -0.087939 0.312529
v -0.343751 -0.218752 0.375000
v 0.062500 -0.413939 0.225178
v 0.062500 -0.381586 0.104437
v 0.375000 -0.375000 0.500000
v 0.375000 0.375000 0.500000
v -0.375000 -0.375000 0.500000
v -0.375000 0.375000 0.500000
v -0.281250 0.156250 0.312500
v -0.281250 -0.156250 0.312500
v -0.250000 0.125000 0.312500
v -0.250000 -0.125000 0.312500
v 0.250000 0.125000 0.312500
v 0.250000 -0.125000 0.312500
v -0.250000 0.125000 0.250000
v -0.250000 -0.125000 0.250000
v 0.250000 0.125000 0.250000
v 0.250000 -0.125000 0.250000
v 0.125000 -0.062500 0.187500
v 0.125000 0.062500 0.187500
v -0.125000 -0.062500 0.187500
v -0.125000 0.062500 0.187500
v 0.062500 -0.031251 0.176992
v 0.062500 0.031250 0.176992
v -0.062498 -0.031251 0.176992
v -0.062498 0.031250 0.176992
v -0.187500 -0.093750 0.208750
v 0.187500 0.093750 0.208750
v 0.187500 -0.093750 0.208750
v -0.187500 0.093750 0.208750
v -0.375000 0.375000 0.375000
v -0.375000 -0.375000 0.375000
v 0.375000 0.375000 0.375000
v 0.375000 -0.375000 0.375000
v 0.375000 -0.375000 0.500000
v 0.375000 0.375000 0.500000
v -0.375000 -0.375000 0.500000
v -0.375000 0.375000 0.500000
vt 0.312500 0.437500
vt 0.312500 0.000000
vt 0.437500 0.000000
vt 0.437500 0.437500
vt 0.687500 0.187500
vt 0.812500 0.187500
vt 0.812500 0.312500
vt 0.687500 0.312500
vt 0.187500 0.437500
vt 0.062500 0.437500
vt 0.062500 0.000000
vt 0.187500 0.000000
vt 0.875000 0.796875
vt 0.375000 0.796875
vt 0.343750 0.765625
vt 0.906250 0.765625
vt 0.203125 0.875000
vt 0.203125 0.625000
vt 0.234375 0.593750
vt 0.234375 0.906250
vt 0.875000 0.890625
vt 0.906250 0.921875
vt 0.343750 0.921875
vt 0.375000 0.890625
vt 0.109375 0.875000
vt 0.078125 0.906250
vt 0.078125 0.593750
vt 0.109375 0.625000
vt 0.562500 0.437500
vt 0.562500 0.000000
vt 0.218880 0.343823
vt 0.218880 0.656178
vt 0.156408 0.718649
vt 0.156408 0.281350
vt 0.968592 0.718649
vt 0.968592 0.281350
vt 0.999827 0.125174
vt 0.999827 0.874827
vt 0.781120 0.656178
vt 0.843592 0.718649
vt 0.843592 0.281350
vt 0.781120 0.343823
vt 0.843592 0.156350
vt 0.156408 0.156350
vt 0.125173 0.000174
vt 0.874827 0.000174
vt 0.031408 0.718649
vt 0.000173 0.874827
vt 0.000173 0.125174
vt 0.031408 0.281350
vt 0.843592 0.843649
vt 0.874827 0.999827
vt 0.125173 0.999827
vt 0.156408 0.843649
vt 0.250000 0.625000
vt 0.750000 0.625000
vt 0.750000 0.687500
vt 0.250000 0.687500
vt 0.250000 0.375000
vt 0.250000 0.312500
vt 0.750000 0.312500
vt 0.750000 0.375000
vt 0.812500 0.375000
vt 0.812500 0.625000
vt 0.187500 0.625000
vt 0.187500 0.375000
vt 0.625000 0.562500
vt 0.562500 0.531250
vt 0.562500 0.468750
vt 0.625000 0.437500
vt 0.437500 0.468750
vt 0.437500 0.531250
vt 0.375000 0.437500
vt 0.375000 0.562500
vt 0.312500 0.406250
vt 0.687500 0.406250
vt 0.312500 0.593750
vt 0.687500 0.593750
vt 1.000000 0.000000
vt 1.000000 0.875000
vt 0.125000 0.875000
vt 0.125000 0.000000
vt 0.000000 0.875000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 0.125000 1.000000
vn 0.000000 -0.258800 0.965900
vn 0.000000 -0.965900 -0.258800
vn 0.000000 0.258800 -0.965900
vn 0.000000 0.000000 -1.000000
vn -1.000000 0.000000 0.000000
vn 1.000000 0.000000 0.000000
vn 0.707100 0.000000 -0.707100
vn 0.000000 0.707100 -0.707100
vn 0.000000 -0.707100 -0.707100
vn -0.707100 0.000000 -0.707100
vn 0.000000 1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn -0.141100 0.273900 -0.951300
vn -0.054600 0.137500 -0.989000
vn -0.054600 -0.137500 -0.989000
vn -0.141100 -0.273900 -0.951300
vn 0.054600 -0.137500 -0.989000
vn 0.054600 0.137500 -0.989000
vn 0.141100 -0.273900 -0.951300
vn 0.141100 0.273900 -0.951300
vn 0.269900 -0.421500 -0.865700
vn -0.269900 -0.421500 -0.865700
vn 0.269900 0.421500 -0.865700
vn -0.269900 0.421500 -0.865700
vn -0.395600 0.336800 -0.854500
vn 0.395600 0.336800 -0.854500
vn 0.395600 -0.336800 -0.854500
vn -0.395600 -0.336800 -0.854500
vn 0.000000 -0.000000 1.000000
g nodebox-5_nodebox-5_lever-light
s off
f 17/1/1 15/2/1 10/3/1 11/4/1
f 18/5/2 17/6/2 11/7/2 12/8/2
f 18/9/3 12/10/3 9/11/3 14/12/3
f 26/13/4 28/14/4 8/15/4 24/16/4
f 25/17/4 26/18/4 24/19/4 23/20/4
f 25/21/4 23/22/4 1/23/4 27/24/4
f 27/25/4 1/26/4 8/27/4 28/28/4
f 12/29/5 11/4/5 10/3/5 9/30/5
f 18/9/6 14/12/6 15/2/6 17/1/6
g nodebox-5_nodebox-5_front
f 8/31/7 1/32/7 4/33/7 5/34/7
f 13/35/4 16/36/4 3/37/4 2/38/4
f 1/32/8 23/39/8 13/40/8 4/33/8
f 8/31/9 5/34/9 16/41/9 24/42/9
f 24/42/10 16/41/10 13/40/10 23/39/10
f 16/43/4 5/44/4 7/45/4 3/46/4
f 4/47/4 6/48/4 7/49/4 5/50/4
f 13/51/4 2/52/4 6/53/4 4/54/4
g nodebox-5_nodebox-5_front-bump
f 31/55/11 29/56/11 25/57/11 27/58/11
f 32/59/12 28/60/12 26/61/12 30/62/12
f 30/62/5 26/63/5 25/64/5 29/56/5
f 32/59/6 31/55/6 27/65/6 28/66/6
s 1
f 36/67/13 40/68/14 39/69/15 35/70/16
f 37/71/17 39/69/15 40/68/14 38/72/18
f 35/70/16 39/69/15 37/71/17 33/73/19
f 33/73/19 37/71/17 38/72/18 34/74/20
f 34/74/20 38/72/18 40/68/14 36/67/13
f 33/73/19 43/75/21 41/76/22 35/70/16
f 33/73/19 34/74/20 42/77/23 43/75/21
f 35/70/16 41/76/22 44/78/24 36/67/13
f 42/77/23 44/78/24 29/56/25 31/55/26
f 43/75/21 32/59/27 30/62/28 41/76/22
f 43/75/21 42/77/23 31/55/26 32/59/27
f 41/76/22 30/62/28 29/56/25 44/78/24
f 34/74/20 36/67/13 44/78/24 42/77/23
g nodebox-5_nodebox-5_back-edges
s off
f 19/79/29 20/80/29 22/81/29 21/82/29
f 7/82/6 6/81/6 20/83/6 19/84/6
f 3/82/5 21/84/5 22/83/5 2/81/5
f 48/85/12 49/80/12 51/81/12 46/86/12
f 47/85/11 45/86/11 52/81/11 50/80/11

216
models/jeija_wall_lever_on.obj Executable file
View File

@ -0,0 +1,216 @@
# Blender v2.73 (sub 0) OBJ File: 'mesecons-wall-lever.blend'
# www.blender.org
o nodebox-5
v 0.281250 0.156250 0.312500
v -0.375000 0.375000 0.375000
v -0.375000 -0.375000 0.375000
v 0.343751 0.218750 0.375000
v 0.343751 -0.218752 0.375000
v 0.375000 0.375000 0.375000
v 0.375000 -0.375000 0.375000
v 0.281250 -0.156250 0.312500
v -0.062500 0.075354 0.315617
v -0.062500 0.043002 0.194876
v -0.062500 0.369002 0.107525
v -0.062500 0.401354 0.228266
v -0.343751 0.218750 0.375000
v 0.062500 0.075354 0.315617
v 0.062500 0.043002 0.194876
v -0.343751 -0.218752 0.375000
v 0.062500 0.369002 0.107525
v 0.062500 0.401354 0.228266
v 0.375000 -0.375000 0.500000
v 0.375000 0.375000 0.500000
v -0.375000 -0.375000 0.500000
v -0.375000 0.375000 0.500000
v -0.281250 0.156250 0.312500
v -0.281250 -0.156250 0.312500
v -0.250000 0.125000 0.312500
v -0.250000 -0.125000 0.312500
v 0.250000 0.125000 0.312500
v 0.250000 -0.125000 0.312500
v -0.250000 0.125000 0.250000
v -0.250000 -0.125000 0.250000
v 0.250000 0.125000 0.250000
v 0.250000 -0.125000 0.250000
v 0.125000 -0.062500 0.187500
v 0.125000 0.062500 0.187500
v -0.125000 -0.062500 0.187500
v -0.125000 0.062500 0.187500
v 0.062500 -0.031251 0.176992
v 0.062500 0.031250 0.176992
v -0.062498 -0.031251 0.176992
v -0.062498 0.031250 0.176992
v -0.187500 -0.093750 0.208750
v 0.187500 0.093750 0.208750
v 0.187500 -0.093750 0.208750
v -0.187500 0.093750 0.208750
v -0.375000 0.375000 0.375000
v -0.375000 -0.375000 0.375000
v 0.375000 0.375000 0.375000
v 0.375000 -0.375000 0.375000
v 0.375000 -0.375000 0.500000
v 0.375000 0.375000 0.500000
v -0.375000 -0.375000 0.500000
v -0.375000 0.375000 0.500000
vt 0.312500 0.437500
vt 0.312500 0.000000
vt 0.437500 0.000000
vt 0.437500 0.437500
vt 0.687500 0.187500
vt 0.812500 0.187500
vt 0.812500 0.312500
vt 0.687500 0.312500
vt 0.187500 0.437500
vt 0.062500 0.437500
vt 0.062500 0.000000
vt 0.187500 0.000000
vt 0.875000 0.796875
vt 0.375000 0.796875
vt 0.343750 0.765625
vt 0.906250 0.765625
vt 0.203125 0.875000
vt 0.203125 0.625000
vt 0.234375 0.593750
vt 0.234375 0.906250
vt 0.875000 0.890625
vt 0.906250 0.921875
vt 0.343750 0.921875
vt 0.375000 0.890625
vt 0.109375 0.875000
vt 0.078125 0.906250
vt 0.078125 0.593750
vt 0.109375 0.625000
vt 0.562500 0.437500
vt 0.562500 0.000000
vt 0.218880 0.343823
vt 0.218880 0.656178
vt 0.156408 0.718649
vt 0.156408 0.281350
vt 0.968592 0.718649
vt 0.968592 0.281350
vt 0.999827 0.125174
vt 0.999827 0.874827
vt 0.781120 0.656178
vt 0.843592 0.718649
vt 0.843592 0.281350
vt 0.781120 0.343823
vt 0.843592 0.156350
vt 0.156408 0.156350
vt 0.125173 0.000174
vt 0.874827 0.000174
vt 0.031408 0.718649
vt 0.000173 0.874827
vt 0.000173 0.125174
vt 0.031408 0.281350
vt 0.843592 0.843649
vt 0.874827 0.999827
vt 0.125173 0.999827
vt 0.156408 0.843649
vt 0.250000 0.625000
vt 0.750000 0.625000
vt 0.750000 0.687500
vt 0.250000 0.687500
vt 0.250000 0.375000
vt 0.250000 0.312500
vt 0.750000 0.312500
vt 0.750000 0.375000
vt 0.812500 0.375000
vt 0.812500 0.625000
vt 0.187500 0.625000
vt 0.187500 0.375000
vt 0.625000 0.562500
vt 0.562500 0.531250
vt 0.562500 0.468750
vt 0.625000 0.437500
vt 0.437500 0.468750
vt 0.437500 0.531250
vt 0.375000 0.437500
vt 0.375000 0.562500
vt 0.312500 0.406250
vt 0.687500 0.406250
vt 0.312500 0.593750
vt 0.687500 0.593750
vt 1.000000 0.000000
vt 1.000000 0.875000
vt 0.125000 0.875000
vt 0.125000 0.000000
vt 0.000000 0.875000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 0.125000 1.000000
vn 0.000000 -0.258800 -0.965900
vn 0.000000 0.965900 -0.258800
vn 0.000000 0.258800 0.965900
vn 0.000000 0.000000 -1.000000
vn -1.000000 0.000000 0.000000
vn 1.000000 0.000000 0.000000
vn 0.707100 0.000000 -0.707100
vn 0.000000 0.707100 -0.707100
vn 0.000000 -0.707100 -0.707100
vn -0.707100 0.000000 -0.707100
vn 0.000000 1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn -0.141100 0.273900 -0.951300
vn -0.054600 0.137500 -0.989000
vn -0.054600 -0.137500 -0.989000
vn -0.141100 -0.273900 -0.951300
vn 0.054600 -0.137500 -0.989000
vn 0.054600 0.137500 -0.989000
vn 0.141100 -0.273900 -0.951300
vn 0.141100 0.273900 -0.951300
vn 0.269900 -0.421500 -0.865700
vn -0.269900 -0.421500 -0.865700
vn 0.269900 0.421500 -0.865700
vn -0.269900 0.421500 -0.865700
vn -0.395600 0.336800 -0.854500
vn 0.395600 0.336800 -0.854500
vn 0.395600 -0.336800 -0.854500
vn -0.395600 -0.336800 -0.854500
vn 0.000000 -0.000000 1.000000
g nodebox-5_nodebox-5_lever-light
s off
f 17/1/1 15/2/1 10/3/1 11/4/1
f 18/5/2 17/6/2 11/7/2 12/8/2
f 18/9/3 12/10/3 9/11/3 14/12/3
f 26/13/4 28/14/4 8/15/4 24/16/4
f 25/17/4 26/18/4 24/19/4 23/20/4
f 25/21/4 23/22/4 1/23/4 27/24/4
f 27/25/4 1/26/4 8/27/4 28/28/4
f 12/29/5 11/4/5 10/3/5 9/30/5
f 18/9/6 14/12/6 15/2/6 17/1/6
g nodebox-5_nodebox-5_front
f 8/31/7 1/32/7 4/33/7 5/34/7
f 13/35/4 16/36/4 3/37/4 2/38/4
f 1/32/8 23/39/8 13/40/8 4/33/8
f 8/31/9 5/34/9 16/41/9 24/42/9
f 24/42/10 16/41/10 13/40/10 23/39/10
f 16/43/4 5/44/4 7/45/4 3/46/4
f 4/47/4 6/48/4 7/49/4 5/50/4
f 13/51/4 2/52/4 6/53/4 4/54/4
g nodebox-5_nodebox-5_front-bump
f 31/55/11 29/56/11 25/57/11 27/58/11
f 32/59/12 28/60/12 26/61/12 30/62/12
f 30/62/5 26/63/5 25/64/5 29/56/5
f 32/59/6 31/55/6 27/65/6 28/66/6
s 1
f 36/67/13 40/68/14 39/69/15 35/70/16
f 37/71/17 39/69/15 40/68/14 38/72/18
f 35/70/16 39/69/15 37/71/17 33/73/19
f 33/73/19 37/71/17 38/72/18 34/74/20
f 34/74/20 38/72/18 40/68/14 36/67/13
f 33/73/19 43/75/21 41/76/22 35/70/16
f 33/73/19 34/74/20 42/77/23 43/75/21
f 35/70/16 41/76/22 44/78/24 36/67/13
f 42/77/23 44/78/24 29/56/25 31/55/26
f 43/75/21 32/59/27 30/62/28 41/76/22
f 43/75/21 42/77/23 31/55/26 32/59/27
f 41/76/22 30/62/28 29/56/25 44/78/24
f 34/74/20 36/67/13 44/78/24 42/77/23
g nodebox-5_nodebox-5_back-edges
s off
f 19/79/29 20/80/29 22/81/29 21/82/29
f 7/82/6 6/81/6 20/83/6 19/84/6
f 3/82/5 21/84/5 22/83/5 2/81/5
f 48/85/12 49/80/12 51/81/12 46/86/12
f 47/85/11 45/86/11 52/81/11 50/80/11

BIN
sounds/mesecons_lever.ogg Executable file

Binary file not shown.

BIN
sounds/piston_extend.ogg Executable file

Binary file not shown.

BIN
sounds/piston_retract.ogg Executable file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

BIN
textures/electricity_wire_inv.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

BIN
textures/electricity_wire_off.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

BIN
textures/electricity_wire_on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

BIN
textures/jeija_gate_off.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

BIN
textures/jeija_gate_on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

BIN
textures/jeija_meselamp.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

BIN
textures/jeija_solar_panel.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

BIN
textures/jeija_wall_lever_inv.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

BIN
textures/lamp_off.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
textures/lamp_on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

BIN
textures/mesecons_piston_back.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

BIN
textures/mesecons_piston_left.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

BIN
textures/mesecons_piston_top.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B