summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.luacheckrc6
-rw-r--r--LICENSE22
-rw-r--r--init.lua93
-rw-r--r--mod.conf2
-rw-r--r--textures/bm_to_mesecons_converter_off.pngbin0 -> 7607 bytes
-rw-r--r--textures/bm_to_mesecons_converter_on.pngbin0 -> 7811 bytes
-rw-r--r--textures/bm_to_mesecons_converter_sides.pngbin0 -> 1995 bytes
7 files changed, 123 insertions, 0 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..a21d36f
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,6 @@
+max_line_length = 120
+read_globals = {
+ "core",
+ "mesecon",
+ "vector",
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b3dbff0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..fd0aeb7
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,93 @@
+local meseconrules = {
+ vector.new(1,0,0),
+ vector.new(-1,0,0),
+ vector.new(0,0,1),
+ vector.new(0,0,-1),
+ vector.new(1,1,0),
+ vector.new(-1,1,0),
+ vector.new(0,1,1),
+ vector.new(0,1,-1),
+}
+
+core.register_node("bm_to_mesecons:converter_off",{
+ description = "Basic Machines to Mesecons Converter",
+ tiles = {
+ "bm_to_mesecons_converter_off.png",
+ "bm_to_mesecons_converter_sides.png",
+ },
+ use_texture_alpha = "opaque",
+ is_ground_content = false,
+ paramtype = "light",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,-0.47,0.5},
+ {-0.438,-0.47,-0.438,0.438,-0.42,0.438},
+ },
+ },
+ groups = {
+ dig_immediate = 2,
+ },
+ effector = {
+ action_on = function(pos)
+ local node = core.get_node(pos)
+ node.name = "bm_to_mesecons:converter_on"
+ core.swap_node(pos,node)
+ mesecon.receptor_on(pos,meseconrules)
+ core.get_node_timer(pos):start(0.5)
+ end,
+ },
+ mesecons = {
+ receptor = {
+ state = mesecon.state.off,
+ rules = meseconrules,
+ },
+ },
+ on_construct = function(pos)
+ core.get_meta(pos):set_string("infotext","Basic Machines to Mesecons Converter")
+ end,
+})
+
+core.register_node("bm_to_mesecons:converter_on",{
+ description = "Basic Machines to Mesecons Converter (on state - you hacker you!)",
+ tiles = {
+ "bm_to_mesecons_converter_on.png",
+ "bm_to_mesecons_converter_sides.png",
+ },
+ use_texture_alpha = "opaque",
+ is_ground_content = false,
+ paramtype = "light",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,-0.47,0.5},
+ {-0.438,-0.47,-0.438,0.438,-0.42,0.438},
+ },
+ },
+ groups = {
+ dig_immediate = 2,
+ not_in_creative_inventory = 1,
+ },
+ drop = "bm_to_mesecons:converter_off",
+ mesecons = {
+ receptor = {
+ state = mesecon.state.on,
+ rules = meseconrules,
+ },
+ },
+ on_timer = function(pos)
+ local node = core.get_node(pos)
+ if node.name ~= "bm_to_mesecons:converter_on" then return end
+ node.name = "bm_to_mesecons:converter_off"
+ core.swap_node(pos,node)
+ mesecon.receptor_off(pos,meseconrules)
+ end,
+})
+
+core.register_craft({
+ output = "bm_to_mesecons:converter_off",
+ type = "shapeless",
+ recipe = {"basic_machines:mesecon_adapter"},
+})
diff --git a/mod.conf b/mod.conf
new file mode 100644
index 0000000..b141d5f
--- /dev/null
+++ b/mod.conf
@@ -0,0 +1,2 @@
+name = bm_to_mesecons
+depends = basic_machines,mesecons
diff --git a/textures/bm_to_mesecons_converter_off.png b/textures/bm_to_mesecons_converter_off.png
new file mode 100644
index 0000000..3192bff
--- /dev/null
+++ b/textures/bm_to_mesecons_converter_off.png
Binary files differ
diff --git a/textures/bm_to_mesecons_converter_on.png b/textures/bm_to_mesecons_converter_on.png
new file mode 100644
index 0000000..121888d
--- /dev/null
+++ b/textures/bm_to_mesecons_converter_on.png
Binary files differ
diff --git a/textures/bm_to_mesecons_converter_sides.png b/textures/bm_to_mesecons_converter_sides.png
new file mode 100644
index 0000000..bc3cebd
--- /dev/null
+++ b/textures/bm_to_mesecons_converter_sides.png
Binary files differ