diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..64a2fed --- /dev/null +++ b/LICENSE @@ -0,0 +1,63 @@ +LICENSE FOR CODE: +================= + + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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 OR COPYRIGHT HOLDERS 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. + + + + +LICENSE FOR MEDIA: +================== + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ \ No newline at end of file diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..200eb11 --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +dofile(minetest.get_modpath("advcarts").."/tracks.lua") \ No newline at end of file diff --git a/models/advcarts_cargo_cart.obj b/models/advcarts_cargo_cart.obj new file mode 100644 index 0000000..d717a4c --- /dev/null +++ b/models/advcarts_cargo_cart.obj @@ -0,0 +1,50 @@ +# Blender v2.78 (sub 0) OBJ File: '' +# www.blender.org +mtllib advtrains_cargo_cart.mtl +o Cube +v 4.999998 -5.000000 -4.999997 +v 4.999998 -5.000000 4.999998 +v -4.999998 -5.000000 4.999997 +v -4.999996 -5.000000 -5.000000 +v 5.000000 5.000000 -4.999995 +v 4.999994 5.000000 5.000000 +v -5.000000 5.000000 4.999996 +v -4.999997 5.000000 -4.999998 +vt 0.5000 0.5000 +vt 0.5000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5000 +vt 0.5000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5000 +vt 0.5000 0.5000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 0.5000 1.0000 +vt 0.5000 0.5000 +vt 1.0000 0.0000 +vt 1.0000 0.5000 +vt 0.5000 0.5000 +vt 0.5000 0.0000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 0.5000 1.0000 +vt 0.5000 0.5000 +vt 0.0000 0.5000 +vt 0.0000 0.0000 +vt 0.5000 0.0000 +vt 0.5000 0.5000 +vn 0.0000 -1.0000 -0.0000 +vn 0.0000 1.0000 -0.0000 +vn 1.0000 0.0000 0.0000 +vn -0.0000 -0.0000 1.0000 +vn -1.0000 -0.0000 -0.0000 +vn 0.0000 0.0000 -1.0000 +usemtl Material +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 5/5/2 8/6/2 7/7/2 6/8/2 +f 1/9/3 5/10/3 6/11/3 2/12/3 +f 2/13/4 6/14/4 7/15/4 3/16/4 +f 3/17/5 7/18/5 8/19/5 4/20/5 +f 5/21/6 1/22/6 4/23/6 8/24/6 diff --git a/models/advcarts_cart.obj b/models/advcarts_cart.obj new file mode 100644 index 0000000..e080da5 --- /dev/null +++ b/models/advcarts_cart.obj @@ -0,0 +1,78 @@ +# Blender v2.78 (sub 0) OBJ File: 'carts_cart.blend' +# www.blender.org +mtllib advtrains_cart.mtl +o Cube +v 5.000000 -5.000000 -5.000000 +v 5.000000 -5.000000 5.000000 +v -5.000000 -5.000000 4.999999 +v -4.999998 -5.000000 -5.000002 +v 5.000002 5.000000 -4.999997 +v 4.999997 5.000000 5.000003 +v -5.000002 5.000000 4.999998 +v -5.000000 5.000000 -5.000000 +v 4.324999 5.000000 4.325001 +v 4.325000 -4.325000 4.325000 +v -4.325001 5.000000 4.325003 +v -4.324999 5.000000 -4.324998 +v -4.325000 -4.325000 4.325001 +v -4.325000 -4.325000 -4.324999 +v 4.324998 5.000000 -4.324999 +v 4.324999 -4.325000 -4.325000 +vt 0.5000 -0.0000 +vt -0.0000 0.0000 +vt -0.0000 0.5000 +vt 0.5000 0.5000 +vt 1.0000 0.5000 +vt 0.5000 1.0000 +vt 1.0000 1.0000 +vt 0.5000 1.0000 +vt 0.5000 0.5000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 0.5000 -0.0000 +vt 0.5000 0.5000 +vt 1.0000 0.5000 +vt 1.0000 0.0000 +vt 1.0000 0.5000 +vt 0.5000 0.5000 +vt 0.5000 -0.0000 +vt 1.0000 0.0000 +vt 0.4688 1.0000 +vt 0.4688 0.5312 +vt 0.0312 0.5312 +vt 0.0312 1.0000 +vt 0.4688 1.0000 +vt 0.4688 0.5312 +vt 0.0312 0.5312 +vt 0.0312 1.0000 +vt 0.4688 0.9688 +vt 0.0312 0.9688 +vt 0.0312 0.5312 +vt 0.4688 0.5312 +vt -0.0000 0.5000 +vt 0.5000 0.5000 +vt 0.4688 0.9688 +vt 0.0000 1.0000 +vt 0.0312 0.9688 +vn 0.0000 -1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +vn -1.0000 -0.0000 -0.0000 +vn 0.0000 0.0000 -1.0000 +vn -0.0000 -0.0000 1.0000 +vn 0.0000 1.0000 -0.0000 +usemtl Material +s off +f 2/1/1 3/2/1 4/3/1 1/4/1 +f 2/5/2 1/4/2 5/6/2 6/7/2 +f 8/8/3 4/9/3 3/10/3 7/11/3 +f 4/12/4 8/13/4 5/14/4 1/15/4 +f 6/16/5 7/17/5 3/18/5 2/19/5 +f 14/20/2 12/21/2 11/22/2 13/23/2 +f 10/24/3 9/25/3 15/26/3 16/27/3 +f 16/28/6 14/29/6 13/30/6 10/31/6 +f 16/27/5 15/26/5 12/21/5 14/20/5 +f 9/25/4 10/24/4 13/23/4 11/22/4 +f 9/25/6 11/22/6 7/32/6 6/33/6 +f 9/25/6 6/33/6 5/6/6 15/34/6 +f 15/34/6 5/6/6 8/35/6 12/36/6 +f 12/36/6 8/35/6 7/32/6 11/22/6 diff --git a/models/advcarts_engine.obj b/models/advcarts_engine.obj new file mode 100644 index 0000000..54aa345 --- /dev/null +++ b/models/advcarts_engine.obj @@ -0,0 +1,76 @@ +# Blender v2.78 (sub 0) OBJ File: '' +# www.blender.org +mtllib advcarts_engine.mtl +o Cube.001 +v 5.000000 -5.000001 4.999999 +v -5.000000 -5.000001 4.999998 +v -4.999998 -4.999999 -5.000003 +v 5.000000 -4.999999 -5.000001 +v 5.000002 5.000001 -4.999996 +v 4.999997 4.999999 5.000004 +v -5.000000 5.000001 -4.999999 +v -5.000002 4.999999 4.999999 +v -4.325000 -4.324999 -4.324999 +v -4.324999 5.000000 -4.324997 +v -4.325001 5.000000 4.325004 +v -4.325000 -4.325000 4.325000 +v 4.325000 -4.325000 4.324999 +v 4.324999 5.000000 4.325002 +v 4.324998 5.000000 -4.324998 +v 4.324999 -4.324999 -4.325000 +vt 0.5000 -0.0000 +vt -0.0000 0.0000 +vt -0.0000 0.5000 +vt 0.5000 0.5000 +vt 1.0000 0.5000 +vt 0.5000 1.0000 +vt 1.0000 1.0000 +vt 0.5000 1.0000 +vt 0.5000 0.5000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 1.0000 1.0000 +vt 1.0000 0.5000 +vt 0.5000 1.0000 +vt 0.5000 0.5000 +vt 0.5000 0.5000 +vt 0.5000 1.0000 +vt 1.0000 1.0000 +vt 1.0000 0.5000 +vt 0.5000 0.5000 +vt 0.5000 1.0000 +vt 1.0000 1.0000 +vt 1.0000 0.5000 +vt 0.5000 0.5000 +vt 0.0000 0.5000 +vt 0.0000 -0.0000 +vt 0.5000 0.0000 +vt 0.4688 0.5312 +vt 0.0312 0.5312 +vt -0.0000 0.5000 +vt 0.5000 0.5000 +vt 0.4688 0.9688 +vt 0.0000 1.0000 +vt 0.0312 0.9688 +vn 0.0000 -1.0000 -0.0000 +vn 1.0000 0.0000 0.0000 +vn -1.0000 -0.0000 -0.0000 +vn 0.0000 0.0000 -1.0000 +vn -0.0000 -0.0000 1.0000 +vn 0.0000 1.0000 0.0000 +usemtl Material.001 +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 1/5/2 4/4/2 5/6/2 6/7/2 +f 7/8/3 3/9/3 2/10/3 8/11/3 +f 3/9/4 7/8/4 5/12/4 4/13/4 +f 6/7/5 8/14/5 2/15/5 1/5/5 +f 9/16/2 10/17/2 11/18/2 12/19/2 +f 13/20/3 14/21/3 15/22/3 16/23/3 +f 16/24/6 9/25/6 12/26/6 13/27/6 +f 16/23/5 15/22/5 10/17/5 9/16/5 +f 14/21/4 13/20/4 12/19/4 11/18/4 +f 14/28/6 11/29/6 8/30/6 6/31/6 +f 14/28/6 6/31/6 5/6/6 15/32/6 +f 15/32/6 5/6/6 7/33/6 10/34/6 +f 10/34/6 7/33/6 8/30/6 11/29/6 diff --git a/models/advcarts_track_diagonal_slope_bottom.obj b/models/advcarts_track_diagonal_slope_bottom.obj new file mode 100644 index 0000000..834530a --- /dev/null +++ b/models/advcarts_track_diagonal_slope_bottom.obj @@ -0,0 +1,16 @@ +# Blender v2.78 (sub 0) OBJ File: 'advcarts_track_diagonal_slope_bottom.obj' +# www.blender.org +mtllib advcarts_track_diagonal_slope_bottom.mtl +o Plane +v 0.853553 -0.500000 -0.146447 +v 0.146447 -0.500000 -0.853553 +v -0.853553 0.000000 0.146447 +v -0.146447 0.000000 0.853553 +vt 0.0000 0.4142 +vt 0.4142 0.0000 +vt 1.0000 0.5858 +vt 0.5858 1.0000 +vn 0.2357 0.9428 -0.2357 +usemtl None +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 diff --git a/models/advcarts_track_diagonal_slope_top.obj b/models/advcarts_track_diagonal_slope_top.obj new file mode 100644 index 0000000..8d57194 --- /dev/null +++ b/models/advcarts_track_diagonal_slope_top.obj @@ -0,0 +1,16 @@ +# Blender v2.78 (sub 0) OBJ File: 'advcarts_track_diagonal_slope_bottom.obj' +# www.blender.org +mtllib advcarts_track_diagonal_slope_top.mtl +o Plane.002 +v 0.853553 0.000000 -0.146447 +v 0.146447 0.000000 -0.853553 +v -0.853553 0.500000 0.146447 +v -0.146447 0.500000 0.853553 +vt 0.0000 0.4142 +vt 0.4142 0.0000 +vt 1.0000 0.5858 +vt 0.5858 1.0000 +vn 0.2357 0.9428 -0.2357 +usemtl None.002 +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 diff --git a/models/advcarts_track_normal.obj b/models/advcarts_track_normal.obj new file mode 100644 index 0000000..e28313d --- /dev/null +++ b/models/advcarts_track_normal.obj @@ -0,0 +1,16 @@ +# Blender v2.78 (sub 0) OBJ File: 'advcarts_track_normal.obj' +# www.blender.org +mtllib advcarts_track_normal.mtl +o Plane +v 1.000000 -0.498000 -1.000000 +v -1.000000 -0.498000 -1.000000 +v -1.000000 -0.498000 1.000000 +v 1.000000 -0.498000 1.000000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 1.0000 -0.0000 +usemtl None +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 diff --git a/models/advcarts_track_slope_bottom.obj b/models/advcarts_track_slope_bottom.obj new file mode 100644 index 0000000..6313fd4 --- /dev/null +++ b/models/advcarts_track_slope_bottom.obj @@ -0,0 +1,16 @@ +# Blender v2.78 (sub 0) OBJ File: 'advcarts_track_diagonal_slope_bottom.obj' +# www.blender.org +mtllib advcarts_track_slope_bottom.mtl +o Plane.001 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 0.000000 0.500000 +v 0.500000 0.000000 0.500000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 0.8944 -0.4472 +usemtl None.001 +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 diff --git a/models/advcarts_track_slope_top.obj b/models/advcarts_track_slope_top.obj new file mode 100644 index 0000000..80bbab7 --- /dev/null +++ b/models/advcarts_track_slope_top.obj @@ -0,0 +1,16 @@ +# Blender v2.78 (sub 0) OBJ File: 'advcarts_track_diagonal_slope_bottom.obj' +# www.blender.org +mtllib advcarts_track_slope_top.mtl +o Plane.001 +v 0.500000 -0.000000 -0.500000 +v -0.500000 -0.000000 -0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 0.8944 -0.4472 +usemtl None.001 +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 diff --git a/models/advcarts_track_straight.obj b/models/advcarts_track_straight.obj new file mode 100644 index 0000000..a088462 --- /dev/null +++ b/models/advcarts_track_straight.obj @@ -0,0 +1,52 @@ +# Blender v2.78 (sub 0) OBJ File: 'advcarts_straight.obj' +# www.blender.org +mtllib advcarts_track_straight.mtl +o Plane.001 +v 0.375000 -0.499000 1.000000 +v 1.000000 -0.499000 1.000000 +v 1.000000 -0.499000 -1.000000 +v 0.375000 -0.499000 -1.000000 +v -1.000000 -0.499000 1.000000 +v -0.375000 -0.499000 1.000000 +v -0.375000 -0.499000 -1.000000 +v -1.000000 -0.499000 -1.000000 +v -0.375000 -0.497000 1.000000 +v -0.250000 -0.497000 1.000000 +v -0.250000 -0.497000 -1.000000 +v -0.375000 -0.497000 -1.000000 +v 0.250000 -0.497000 1.000000 +v 0.375000 -0.497000 1.000000 +v 0.375000 -0.497000 -1.000000 +v 0.250000 -0.497000 -1.000000 +v -0.250000 -0.499000 1.000000 +v 0.250000 -0.499000 1.000000 +v 0.250000 -0.499000 -1.000000 +v -0.250000 -0.499000 -1.000000 +vt 0.6875 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.6875 1.0000 +vt 0.0000 0.0000 +vt 0.3125 0.0000 +vt 0.3125 1.0000 +vt 0.0000 1.0000 +vt 0.3125 0.0000 +vt 0.3750 0.0000 +vt 0.3750 1.0000 +vt 0.3125 1.0000 +vt 0.6250 0.0000 +vt 0.6875 0.0000 +vt 0.6875 1.0000 +vt 0.6250 1.0000 +vt 0.3750 0.0000 +vt 0.6250 0.0000 +vt 0.6250 1.0000 +vt 0.3750 1.0000 +vn 0.0000 1.0000 0.0000 +usemtl None +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 5/5/1 6/6/1 7/7/1 8/8/1 +f 9/9/1 10/10/1 11/11/1 12/12/1 +f 13/13/1 14/14/1 15/15/1 16/16/1 +f 17/17/1 18/18/1 19/19/1 20/20/1 diff --git a/textures/advcarts_hammer.png b/textures/advcarts_hammer.png new file mode 100644 index 0000000..79d195d Binary files /dev/null and b/textures/advcarts_hammer.png differ diff --git a/textures/advcarts_track_atc_curve.png b/textures/advcarts_track_atc_curve.png new file mode 100644 index 0000000..e4d7785 Binary files /dev/null and b/textures/advcarts_track_atc_curve.png differ diff --git a/textures/advcarts_track_atc_inv.png b/textures/advcarts_track_atc_inv.png new file mode 100644 index 0000000..d96fa6e Binary files /dev/null and b/textures/advcarts_track_atc_inv.png differ diff --git a/textures/advcarts_track_atc_straight.png b/textures/advcarts_track_atc_straight.png new file mode 100644 index 0000000..84c41f9 Binary files /dev/null and b/textures/advcarts_track_atc_straight.png differ diff --git a/textures/advcarts_track_atc_straight_45.png b/textures/advcarts_track_atc_straight_45.png new file mode 100644 index 0000000..d29832b Binary files /dev/null and b/textures/advcarts_track_atc_straight_45.png differ diff --git a/textures/advcarts_track_detector_off_curve.png b/textures/advcarts_track_detector_off_curve.png new file mode 100644 index 0000000..d67d1d7 Binary files /dev/null and b/textures/advcarts_track_detector_off_curve.png differ diff --git a/textures/advcarts_track_detector_off_inv.png b/textures/advcarts_track_detector_off_inv.png new file mode 100644 index 0000000..52dc352 Binary files /dev/null and b/textures/advcarts_track_detector_off_inv.png differ diff --git a/textures/advcarts_track_detector_off_straight.png b/textures/advcarts_track_detector_off_straight.png new file mode 100644 index 0000000..b0d57a3 Binary files /dev/null and b/textures/advcarts_track_detector_off_straight.png differ diff --git a/textures/advcarts_track_detector_off_straight_45.png b/textures/advcarts_track_detector_off_straight_45.png new file mode 100644 index 0000000..2169b16 Binary files /dev/null and b/textures/advcarts_track_detector_off_straight_45.png differ diff --git a/textures/advcarts_track_detector_on_curve.png b/textures/advcarts_track_detector_on_curve.png new file mode 100644 index 0000000..f1d2b84 Binary files /dev/null and b/textures/advcarts_track_detector_on_curve.png differ diff --git a/textures/advcarts_track_detector_on_inv.png b/textures/advcarts_track_detector_on_inv.png new file mode 100644 index 0000000..6cc4c90 Binary files /dev/null and b/textures/advcarts_track_detector_on_inv.png differ diff --git a/textures/advcarts_track_detector_on_straight.png b/textures/advcarts_track_detector_on_straight.png new file mode 100644 index 0000000..d40b1af Binary files /dev/null and b/textures/advcarts_track_detector_on_straight.png differ diff --git a/textures/advcarts_track_detector_on_straight_45.png b/textures/advcarts_track_detector_on_straight_45.png new file mode 100644 index 0000000..2ac3782 Binary files /dev/null and b/textures/advcarts_track_detector_on_straight_45.png differ diff --git a/textures/advcarts_track_load_curve.png b/textures/advcarts_track_load_curve.png new file mode 100644 index 0000000..6cb4447 Binary files /dev/null and b/textures/advcarts_track_load_curve.png differ diff --git a/textures/advcarts_track_load_inv.png b/textures/advcarts_track_load_inv.png new file mode 100644 index 0000000..53c94c7 Binary files /dev/null and b/textures/advcarts_track_load_inv.png differ diff --git a/textures/advcarts_track_load_straight.png b/textures/advcarts_track_load_straight.png new file mode 100644 index 0000000..1dfbf4b Binary files /dev/null and b/textures/advcarts_track_load_straight.png differ diff --git a/textures/advcarts_track_load_straight_45.png b/textures/advcarts_track_load_straight_45.png new file mode 100644 index 0000000..5b50cfe Binary files /dev/null and b/textures/advcarts_track_load_straight_45.png differ diff --git a/textures/advcarts_track_steel_6_way_crossing.png b/textures/advcarts_track_steel_6_way_crossing.png new file mode 100644 index 0000000..5b82e8b Binary files /dev/null and b/textures/advcarts_track_steel_6_way_crossing.png differ diff --git a/textures/advcarts_track_steel_8_way_crossing.png b/textures/advcarts_track_steel_8_way_crossing.png new file mode 100644 index 0000000..933fed6 Binary files /dev/null and b/textures/advcarts_track_steel_8_way_crossing.png differ diff --git a/textures/advcarts_track_steel_crossing.png b/textures/advcarts_track_steel_crossing.png new file mode 100644 index 0000000..990a8db Binary files /dev/null and b/textures/advcarts_track_steel_crossing.png differ diff --git a/textures/advcarts_track_steel_curve.png b/textures/advcarts_track_steel_curve.png new file mode 100644 index 0000000..66affa3 Binary files /dev/null and b/textures/advcarts_track_steel_curve.png differ diff --git a/textures/advcarts_track_steel_diagonal.png b/textures/advcarts_track_steel_diagonal.png new file mode 100644 index 0000000..f5ad4ae Binary files /dev/null and b/textures/advcarts_track_steel_diagonal.png differ diff --git a/textures/advcarts_track_steel_diagonal_6_way_crossing.png b/textures/advcarts_track_steel_diagonal_6_way_crossing.png new file mode 100644 index 0000000..72a9c33 Binary files /dev/null and b/textures/advcarts_track_steel_diagonal_6_way_crossing.png differ diff --git a/textures/advcarts_track_steel_diagonal_crossing.png b/textures/advcarts_track_steel_diagonal_crossing.png new file mode 100644 index 0000000..80818ea Binary files /dev/null and b/textures/advcarts_track_steel_diagonal_crossing.png differ diff --git a/textures/advcarts_track_steel_diagonal_slope.png b/textures/advcarts_track_steel_diagonal_slope.png new file mode 100644 index 0000000..fdb1368 Binary files /dev/null and b/textures/advcarts_track_steel_diagonal_slope.png differ diff --git a/textures/advcarts_track_steel_diagonal_switch.png b/textures/advcarts_track_steel_diagonal_switch.png new file mode 100644 index 0000000..bb13e15 Binary files /dev/null and b/textures/advcarts_track_steel_diagonal_switch.png differ diff --git a/textures/advcarts_track_steel_diagonal_switch_ty.png b/textures/advcarts_track_steel_diagonal_switch_ty.png new file mode 100644 index 0000000..f868eb8 Binary files /dev/null and b/textures/advcarts_track_steel_diagonal_switch_ty.png differ diff --git a/textures/advcarts_track_steel_diagonal_switch_y.png b/textures/advcarts_track_steel_diagonal_switch_y.png new file mode 100644 index 0000000..8de21fb Binary files /dev/null and b/textures/advcarts_track_steel_diagonal_switch_y.png differ diff --git a/textures/advcarts_track_steel_inv.png b/textures/advcarts_track_steel_inv.png new file mode 100644 index 0000000..da973a0 Binary files /dev/null and b/textures/advcarts_track_steel_inv.png differ diff --git a/textures/advcarts_track_steel_skewed_crossing.png b/textures/advcarts_track_steel_skewed_crossing.png new file mode 100644 index 0000000..5313ffd Binary files /dev/null and b/textures/advcarts_track_steel_skewed_crossing.png differ diff --git a/textures/advcarts_track_steel_straight.png b/textures/advcarts_track_steel_straight.png new file mode 100644 index 0000000..c8601db Binary files /dev/null and b/textures/advcarts_track_steel_straight.png differ diff --git a/textures/advcarts_track_steel_switch.png b/textures/advcarts_track_steel_switch.png new file mode 100644 index 0000000..deaddb8 Binary files /dev/null and b/textures/advcarts_track_steel_switch.png differ diff --git a/textures/advcarts_track_steel_switch_ty.png b/textures/advcarts_track_steel_switch_ty.png new file mode 100644 index 0000000..9ae2f61 Binary files /dev/null and b/textures/advcarts_track_steel_switch_ty.png differ diff --git a/textures/advcarts_track_steel_switch_y.png b/textures/advcarts_track_steel_switch_y.png new file mode 100644 index 0000000..299a6a6 Binary files /dev/null and b/textures/advcarts_track_steel_switch_y.png differ diff --git a/textures/advcarts_track_unload_curve.png b/textures/advcarts_track_unload_curve.png new file mode 100644 index 0000000..765688b Binary files /dev/null and b/textures/advcarts_track_unload_curve.png differ diff --git a/textures/advcarts_track_unload_inv.png b/textures/advcarts_track_unload_inv.png new file mode 100644 index 0000000..39b92b1 Binary files /dev/null and b/textures/advcarts_track_unload_inv.png differ diff --git a/textures/advcarts_track_unload_straight.png b/textures/advcarts_track_unload_straight.png new file mode 100644 index 0000000..21b80d2 Binary files /dev/null and b/textures/advcarts_track_unload_straight.png differ diff --git a/textures/advcarts_track_unload_straight_45.png b/textures/advcarts_track_unload_straight_45.png new file mode 100644 index 0000000..124467c Binary files /dev/null and b/textures/advcarts_track_unload_straight_45.png differ diff --git a/track.txt b/track.txt new file mode 100644 index 0000000..f948f48 --- /dev/null +++ b/track.txt @@ -0,0 +1,6 @@ + +6 5 4 + \ | / +7 - * - 3 + / | \ +8 1 2 \ No newline at end of file diff --git a/tracks.lua b/tracks.lua new file mode 100644 index 0000000..e81b89d --- /dev/null +++ b/tracks.lua @@ -0,0 +1,408 @@ +advcarts = {} + +advcarts.autoconnect_rails = function(pos, node) + node_dict = { + {x = pos.x, y = pos.y, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y, z = pos.z}, + {x = pos.x + 1, y = pos.y, z = pos.z + 1}, + {x = pos.x, y = pos.y, z = pos.z + 1}, + {x = pos.x - 1, y = pos.y, z = pos.z + 1}, + {x = pos.x - 1, y = pos.y, z = pos.z}, + {x = pos.x - 1, y = pos.y, z = pos.z - 1}, + } + local is_rail = function(i) + if minetest.get_item_group(minetest.get_node(node_dict[i]).name, "advcarts_rail") == 1 then + return true + else + return false + end + end + if minetest.registered_nodes[node.name].advcarts_rail_type == "slope" then + return + end + local prefix = node.name:sub(0, node.name:find("000") + 2) + if is_rail(1) == true and is_rail(5) == true then + minetest.set_node(pos, {name = prefix.."straight", param2 = 0}) + elseif is_rail(3) == true and is_rail(7) == true then + minetest.set_node(pos, {name = prefix.."straight", param2 = 1}) + elseif is_rail(4) == true and is_rail(8) == true then + minetest.set_node(pos, {name = prefix.."diagonal", param2 = 0}) + elseif is_rail(2) == true and is_rail(6) == true then + minetest.set_node(pos, {name = prefix.."diagonal", param2 = 1}) + elseif is_rail(1) == true and is_rail(4) == true then + minetest.set_node(pos, {name = prefix.."curve", param2 = 0}) + elseif is_rail(2) == true and is_rail(7) == true then + minetest.set_node(pos, {name = prefix.."curve", param2 = 1}) + elseif is_rail(5) == true and is_rail(8) == true then + minetest.set_node(pos, {name = prefix.."curve", param2 = 2}) + elseif is_rail(3) == true and is_rail(6) == true then + minetest.set_node(pos, {name = prefix.."curve", param2 = 3}) + elseif is_rail(1) == true and is_rail(6) == true then + minetest.set_node(pos, {name = prefix.."diagonal_curve", param2 = 3}) + elseif is_rail(4) == true and is_rail(7) == true then + minetest.set_node(pos, {name = prefix.."diagonal_curve", param2 = 0}) + elseif is_rail(2) == true and is_rail(5) == true then + minetest.set_node(pos, {name = prefix.."diagonal_curve", param2 = 1}) + elseif is_rail(3) == true and is_rail(8) == true then + minetest.set_node(pos, {name = prefix.."diagonal_curve", param2 = 2}) + elseif is_rail(1) == true or is_rail(5) == true then + minetest.set_node(pos, {name = prefix.."straight", param2 = 0}) + elseif is_rail(3) == true or is_rail(7) == true then + minetest.set_node(pos, {name = prefix.."straight", param2 = 1}) + elseif is_rail(4) == true or is_rail(8) == true then + minetest.set_node(pos, {name = prefix.."diagonal", param2 = 0}) + elseif is_rail(2) == true or is_rail(6) == true then + minetest.set_node(pos, {name = prefix.."diagonal", param2 = 1}) + end +end + +advcarts.update_nodes_around = function(pos, node) + node_dict = { + {x = pos.x, y = pos.y, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y, z = pos.z}, + {x = pos.x + 1, y = pos.y, z = pos.z + 1}, + {x = pos.x, y = pos.y, z = pos.z + 1}, + {x = pos.x - 1, y = pos.y, z = pos.z + 1}, + {x = pos.x - 1, y = pos.y, z = pos.z}, + {x = pos.x - 1, y = pos.y, z = pos.z - 1}, + } + local is_rail = function(i) + if minetest.get_item_group(minetest.get_node(node_dict[i]).name, "advcarts_rail") == 1 then + return true + else + return false + end + end + for i = 1, 8 do + if is_rail(i) then + advcarts.autoconnect_rails(node_dict[i], minetest.get_node(node_dict[i])) + end + end +end + +advcarts.register_track_node = function(name_prefix, name_suffix, mesh, texture, track, rail_type, creative_inv, collision, selection) + minetest.register_node(name_prefix, { + description = name_suffix, + drawtype = "mesh", + mesh = mesh, + tiles = {texture}, + inventory_image = "advcarts_track_"..track.."_inv.png", + wield_image = "advcarts_track_"..track.."_inv.png", + selection_box = {type = "fixed", fixed = selection or {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}}, + collision_box = {type = "fixed", fixed = collision or {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + advcarts_rail_type = rail_type, + drop = "advcarts:track_"..track.."_000straight", + groups = {oddly_breakable_by_hand = 3, advcarts_rail = 1, not_in_creative_inventory = creative_inv or 1}, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos) + local node = minetest.get_node(pos) + advcarts.autoconnect_rails(pos, node) + advcarts.update_nodes_around(pos, node) + end, + after_dig_node = function(pos) + local node = minetest.get_node(pos) + advcarts.update_nodes_around(pos, node) + end, + }) +end + +advcarts.register_track = function(track, track_desc) + advcarts.register_track_node("advcarts:track_"..track.."_000straight", track_desc.." Rail", "advcarts_track_straight.obj", "advcarts_track_"..track.."_straight.png", track, "regular", 0) + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal", track_desc.." Rail (Diagonal)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000curve", track_desc.." Rail (Curved)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_curve.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_curve", track_desc.." Rail (Opposite Curved)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_curve.png^[transformFXR270", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000right_switch", track_desc.." Rail (Right Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_switch.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000left_switch", track_desc.." Rail (Left Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_switch.png^[transformFX", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_right_switch", track_desc.." Rail (Diagonal Right Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal_switch.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_left_switch", track_desc.." Rail (Diagonal Left Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal_switch.png^[transformFXR270", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000y_switch", track_desc.." Rail (Split Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_switch_y.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_y_switch", track_desc.." Rail (Diagonal Split Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal_switch_y.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000ty_switch", track_desc.." Rail (Triple Split Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_switch_ty.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_ty_switch", track_desc.." Rail (Triple Diagonal Split Switch)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal_switch_ty.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_0004_crossing", track_desc.." Rail (4-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_4_crossing", track_desc.." Rail (Diagonal 4-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000skewed_4_crossing", track_desc.." Rail (Skewed 4-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_skewed_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_skewed_4_crossing", track_desc.." Rail (Diagonal Skewed 4-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_skewed_crossing.png^[transformFYR90", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_0006_crossing", track_desc.." Rail (6-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_6_way_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_6_crossing", track_desc.." Rail (Diagonal 6-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_diagonal_6_way_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_0008_crossing", track_desc.." Rail (8-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_8_way_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_8_crossing", track_desc.." Rail (8-Way Crossing)", "advcarts_track_normal.obj", "advcarts_track_"..track.."_8_way_crossing.png", track, "regular") + advcarts.register_track_node("advcarts:track_"..track.."_000slope_bottom", track_desc.." Rail (Slope Bottom)", "advcarts_track_slope_bottom.obj", "advcarts_track_"..track.."_inv.png", track, "slope", 1, {{-0.5, -0.4375, -0.5, 0.5, -0.375, -0.25}, + {-0.5, -0.375, -0.375, 0.5, -0.3125, -0.125}, + {-0.5, -0.3125, -0.25, 0.5, -0.25, 6.70552e-008}, + {-0.5, -0.25, -0.125, 0.5, -0.1875, 0.125}, + {-0.5, -0.1875, 0, 0.5, -0.125, 0.25}, + {-0.5, -0.125, 0.125, 0.5, -0.0625, 0.375}, + {-0.5, -0.0625, 0.25, 0.5, -1.49012e-008, 0.5}, + {-0.5, 0, 0.375, 0.5, 0.0625, 0.5}, + {-0.5, -0.5, -0.5, 0.5, -0.4375, -0.375}}, {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}}) + advcarts.register_track_node("advcarts:track_"..track.."_000slope_top", track_desc.." Rail (Slope Top)", "advcarts_track_slope_top.obj", "advcarts_track_"..track.."_inv.png", track, "slope", 1, {{-0.5, 0.375, 0.25, 0.5, 0.4375, 0.5}, + {-0.5, 0.3125, 0.125, 0.5, 0.375, 0.375}, + {-0.5, 0.25, -6.70552e-008, 0.5, 0.3125, 0.25}, + {-0.5, 0.1875, -0.125, 0.5, 0.25, 0.125}, + {-0.5, 0.125, -0.25, 0.5, 0.1875, -0}, + {-0.5, 0.0625, -0.375, 0.5, 0.125, -0.125}, + {-0.5, 1.49012e-008, -0.5, 0.5, 0.0625, -0.25}, + {-0.5, -0.0625, -0.5, 0.5, -0, -0.375}, + {-0.5, 0.4375, 0.375, 0.5, 0.5, 0.5}}, {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}) + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_slope_bottom", track_desc.." Rail (Diagonal Slope Bottom)", "advcarts_track_diagonal_slope_bottom.obj", "advcarts_track_"..track.."_diagonal_slope.png", track, "slope", 1, {{-0.5, -0.5, -0.5, 0, -0.4375, -0.375}, + {-0.5, -0.5, -0.5, -0.375, -0.4375, 0}, + {-0.5, -0.4375, -0.5, -0.25, -0.375, 0}, + {-0.5, -0.4375, -0.5, 0, -0.375, -0.25}, + {-0.375, -0.375, -0.375, 0.125, -0.3125, -0.125}, + {-0.375, -0.375, -0.375, -0.125, -0.3125, 0.125}, + {-0.25, -0.3125, -0.25, -4.47035e-008, -0.25, 0.25}, + {-0.25, -0.3125, -0.25, 0.25, -0.25, 0}, + {-0.125, -0.25, -0.125, 0.375, -0.1875, 0.125}, + {-0.125, -0.25, -0.125, 0.125, -0.1875, 0.375}, + {0, -0.1875, 0, 0.25, -0.125, 0.5}, + {0, -0.1875, 0, 0.5, -0.125, 0.25}, + {0.125, -0.125, 0.125, 0.625, -0.0625, 0.375}, + {0.125, -0.125, 0.125, 0.375, -0.0625, 0.625}, + {0.25, -0.0625, 0.25, 0.5, -2.23517e-008, 0.75}, + {0.25, -0.0625, 0.25, 0.75, -2.23517e-008, 0.5}, + {0.375, 0, 0.375, 0.75, 0.0625, 0.5}, + {0.375, 0, 0.375, 0.5, 0.0625, 0.75}}, {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}}) + advcarts.register_track_node("advcarts:track_"..track.."_000diagonal_slope_top", track_desc.." Rail (Diagonal Slope Top)", "advcarts_track_diagonal_slope_top.obj", "advcarts_track_"..track.."_diagonal_slope.png", track, "slope", 1, {{0.375, 0.4375, -0, 0.5, 0.5, 0.5}, + {-0, 0.4375, 0.375, 0.5, 0.5, 0.5}, + {-0, 0.375, 0.25, 0.5, 0.4375, 0.5}, + {0.25, 0.375, -0, 0.5, 0.4375, 0.5}, + {0.125, 0.3125, -0.125, 0.375, 0.375, 0.375}, + {-0.125, 0.3125, 0.125, 0.375, 0.375, 0.375}, + {-0.25, 0.25, 4.47035e-008, 0.25, 0.3125, 0.25}, + {-0, 0.25, -0.25, 0.25, 0.3125, 0.25}, + {-0.125, 0.1875, -0.375, 0.125, 0.25, 0.125}, + {-0.375, 0.1875, -0.125, 0.125, 0.25, 0.125}, + {-0.5, 0.125, -0.25, -0, 0.1875, -0}, + {-0.25, 0.125, -0.5, -0, 0.1875, -0}, + {-0.375, 0.0625, -0.625, -0.125, 0.125, -0.125}, + {-0.625, 0.0625, -0.375, -0.125, 0.125, -0.125}, + {-0.75, 2.23517e-008, -0.5, -0.25, 0.0625, -0.25}, + {-0.5, 2.23517e-008, -0.75, -0.25, 0.0625, -0.25}, + {-0.5, -0.0625, -0.75, -0.375, -0, -0.375}, + {-0.75, -0.0625, -0.5, -0.375, -0, -0.375}}, {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}) +end + +advcarts.register_track("steel", "Steel") + +minetest.register_craftitem("advcarts:railworker", { + description = "\nRail Worker\n\nLeft-click: Change a rail type\nRight-click: Rotate a rail\nSneak + Left-click: Change to a slope\n", + inventory_image = "advcarts_hammer.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == "nothing" then + return + end + local pos = minetest.get_pointed_thing_position(pointed_thing) + local node = minetest.get_node(pos) + local is_rail = function() + if minetest.get_item_group(node.name, "advcarts_rail") == 1 then + return true + else + return false + end + end + if is_rail() == true then + local prefix = node.name:sub(0, node.name:find("000") + 2) + local suffix = node.name:sub(node.name:find("000") + 3, node.name:len()) + local facedir = node.param2 + local ctrl = user:get_player_control() + if ctrl and ctrl.sneak then + if suffix:sub(0, 8) == "diagonal" then + suffix = "diagonal_slope_bottom" + else + suffix = "slope_bottom" + end + else + if suffix == "straight" then + suffix = "curve" + elseif suffix == "diagonal" then + suffix = "diagonal_curve" + elseif suffix == "curve" and minetest.registered_nodes[node.name].advcarts_rail_type == "simple" then + suffix = "straight" + elseif suffix == "diagonal_curve" and minetest.registered_nodes[node.name].advcarts_rail_type == "simple" then + suffix = "diagonal" + elseif suffix == "curve" and minetest.registered_nodes[node.name].advcarts_rail_type == "regular" then + suffix = "right_switch" + elseif suffix == "diagonal_curve" and minetest.registered_nodes[node.name].advcarts_rail_type == "regular" then + suffix = "diagonal_right_switch" + elseif suffix == "right_switch" then + suffix = "left_switch" + elseif suffix == "diagonal_right_switch" then + suffix = "diagonal_left_switch" + elseif suffix == "left_switch" then + suffix = "y_switch" + elseif suffix == "diagonal_left_switch" then + suffix = "diagonal_y_switch" + elseif suffix == "y_switch" then + suffix = "ty_switch" + elseif suffix == "diagonal_y_switch" then + suffix = "diagonal_ty_switch" + elseif suffix == "ty_switch" then + suffix = "4_crossing" + elseif suffix == "diagonal_ty_switch" then + suffix = "diagonal_4_crossing" + elseif suffix == "4_crossing" then + suffix = "skewed_4_crossing" + elseif suffix == "diagonal_4_crossing" then + suffix = "diagonal_skewed_4_crossing" + elseif suffix == "skewed_4_crossing" then + suffix = "6_crossing" + elseif suffix == "diagonal_skewed_4_crossing" then + suffix = "diagonal_6_crossing" + elseif suffix == "6_crossing" then + suffix = "8_crossing" + elseif suffix == "diagonal_6_crossing" then + suffix = "diagonal_8_crossing" + elseif suffix == "8_crossing" then + suffix = "slope_bottom" + elseif suffix == "diagonal_8_crossing" then + suffix = "diagonal_slope_bottom" + elseif suffix == "slope_bottom" then + suffix = "slope_top" + elseif suffix == "diagonal_slope_bottom" then + suffix = "diagonal_slope_top" + elseif suffix == "slope_top" then + suffix = "straight" + elseif suffix == "diagonal_slope_top" then + suffix = "diagonal" + end + end + minetest.set_node(pos, {name = prefix..suffix, param2 = facedir}) + end + end, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "nothing" then + return + end + local pos = minetest.get_pointed_thing_position(pointed_thing) + local node = minetest.get_node(pos) + local is_rail = function() + if minetest.get_item_group(node.name, "advcarts_rail") == 1 then + return true + else + return false + end + end + if is_rail() == true then + local prefix = node.name:sub(0, node.name:find("000") + 2) + local suffix = node.name:sub(node.name:find("000") + 3, node.name:len()) + local facedir = node.param2 + if suffix == "straight" then + suffix = "diagonal" + elseif suffix == "diagonal" then + suffix = "straight" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "curve" then + suffix = "diagonal_curve" + elseif suffix == "diagonal_curve" then + suffix = "curve" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "right_switch" then + suffix = "diagonal_right_switch" + elseif suffix == "diagonal_right_switch" then + suffix = "right_switch" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "left_switch" then + suffix = "diagonal_left_switch" + elseif suffix == "diagonal_left_switch" then + suffix = "left_switch" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "y_switch" then + suffix = "diagonal_y_switch" + elseif suffix == "diagonal_y_switch" then + suffix = "y_switch" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "ty_switch" then + suffix = "diagonal_ty_switch" + elseif suffix == "diagonal_ty_switch" then + suffix = "ty_switch" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "4_crossing" then + suffix = "diagonal_4_crossing" + elseif suffix == "diagonal_4_crossing" then + suffix = "4_crossing" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "skewed_4_crossing" then + suffix = "diagonal_skewed_4_crossing" + elseif suffix == "diagonal_skewed_4_crossing" then + suffix = "skewed_4_crossing" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "6_crossing" then + suffix = "diagonal_6_crossing" + elseif suffix == "diagonal_6_crossing" then + suffix = "6_crossing" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "8_crossing" then + suffix = "diagonal_8_crossing" + elseif suffix == "diagonal_8_crossing" then + suffix = "8_crossing" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "slope_bottom" then + suffix = "diagonal_slope_bottom" + elseif suffix == "diagonal_slope_bottom" then + suffix = "slope_bottom" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + if suffix == "slope_top" then + suffix = "diagonal_slope_top" + elseif suffix == "diagonal_slope_top" then + suffix = "slope_top" + facedir = facedir + 1 + if facedir >= 4 then + facedir = 0 + end + end + minetest.set_node(pos, {name = prefix..suffix, param2 = facedir}) + end + end +}) \ No newline at end of file