diff --git a/doc/index.html b/doc/index.html index ac57498..4b9b0a8 100644 --- a/doc/index.html +++ b/doc/index.html @@ -31,9 +31,11 @@

Modules

@@ -44,10 +46,6 @@

Modules

- - - - @@ -56,6 +54,18 @@ + + + + + + + + + + + +
worldgenutilProvides various utility functions for generation worlds.
ramps.rampplacer RampPlacer is an object that allows to place ramps in the world.ramps.ramputil Utility functions for the creation and registration of ramps.
corners.rampplacerRampPlacer is an object that allows to place ramps in the world.
corners.cornerutilUtility functions for the creation and registration of corners.
worldgenutilProvides various utility functions for generation worlds.
diff --git a/doc/modules/corners.cornerutil.html b/doc/modules/corners.cornerutil.html new file mode 100644 index 0000000..bcef9cc --- /dev/null +++ b/doc/modules/corners.cornerutil.html @@ -0,0 +1,107 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module corners.cornerutil

+

Utility functions for the creation and registration of corners.

+

+ + +

Functions

+ + + + + +
create_corner_nodebox (detail)Creates the nodebox for a corner.
+ +
+
+ + +

Functions

+
+
+ + create_corner_nodebox (detail) +
+
+ Creates the nodebox for a corner. + + +

Parameters:

+
    +
  • detail + The level of detail, basically how many steps the corner will + have. +
  • +
+ +

Returns:

+
    + + The nodebox for a corner. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.2 +
+
+ + diff --git a/doc/modules/corners.rampplacer.html b/doc/modules/corners.rampplacer.html new file mode 100644 index 0000000..787881a --- /dev/null +++ b/doc/modules/corners.rampplacer.html @@ -0,0 +1,341 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module corners.rampplacer

+

RampPlacer is an object that allows to place ramps in the world.

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RampPlacer:new ()Creates a new instance of RampPlacer.
RampPlacer.mask_value_equals (actual, mask)Equals function for the mask values.
RampPlacer:is_air (node)Checks if the given node is "air".
RampPlacer:place_ramp (x, z, y, manipulator, template, node_info, node_mask, below_air, above_air)Places a ramp here if possible.
RampPlacer:register_air_like (node)Allows to register nodes that are treated like air.
RampPlacer:register_ramp (node, ramp_node, inner_corner_node, outer_corner_node, floor, ceiling)Registers a ramp with this RampPlacer.
RampPlacer:run (manipulator, minp, maxp)Places ramps in the given area.
RampPlacer:run_on_node (manipulator, x, z, y)Places a ramp (or not) on the given location.
+ +
+
+ + +

Functions

+
+
+ + RampPlacer:new () +
+
+ Creates a new instance of RampPlacer. + + + +

Returns:

+
    + + A new instance of RampPlacer. +
+ + + + +
+
+ + RampPlacer.mask_value_equals (actual, mask) +
+
+ Equals function for the mask values. + + +

Parameters:

+
    +
  • actual + The atual value, generated from the map. +
  • +
  • mask + The mask value, from the templates. +
  • +
+ +

Returns:

+
    + + true if the values equal. +
+ + + + +
+
+ + RampPlacer:is_air (node) +
+
+ Checks if the given node is "air". + + +

Parameters:

+
    +
  • node + The node to check. +
  • +
+ +

Returns:

+
    + + true if the node is air. +
+ + + + +
+
+ + RampPlacer:place_ramp (x, z, y, manipulator, template, node_info, node_mask, below_air, above_air) +
+
+ Places a ramp here if possible. + + +

Parameters:

+
    +
  • x + The x coordinate. +
  • +
  • z + The z coordinate. +
  • +
  • y + The y coordinate. +
  • +
  • manipulator + The manipulator. +
  • +
  • template + The ramp template to use. +
  • +
  • node_info + The node information to use. +
  • +
  • node_mask + The mask of the node. +
  • +
  • below_air + If the node is below air. +
  • +
  • above_air + If the node is above air. +
  • +
+ +

Returns:

+
    + + true If a ramp is placed. +
+ + + + +
+
+ + RampPlacer:register_air_like (node) +
+
+ Allows to register nodes that are treated like air. + + +

Parameters:

+
    +
  • node + The node to register as air like. +
  • +
+ + + + + +
+
+ + RampPlacer:register_ramp (node, ramp_node, inner_corner_node, outer_corner_node, floor, ceiling) +
+
+ Registers a ramp with this RampPlacer. + + +

Parameters:

+
    +
  • node + The base node. +
  • +
  • ramp_node + The ramp node. +
  • +
  • inner_corner_node + The inner corner node. +
  • +
  • outer_corner_node + The outer corner node. +
  • +
  • floor + If ramps should appear on the floor. +
  • +
  • ceiling + If ramps should appear on the ceiling. +
  • +
+ + + + + +
+
+ + RampPlacer:run (manipulator, minp, maxp) +
+
+ Places ramps in the given area. + + +

Parameters:

+
    +
  • manipulator + The MapManipulator to use. +
  • +
  • minp + The minimum point. +
  • +
  • maxp + The maximum point. +
  • +
+ + + + + +
+
+ + RampPlacer:run_on_node (manipulator, x, z, y) +
+
+ Places a ramp (or not) on the given location. + + + +

Parameters:

+
    +
  • manipulator + The MapManipulator to use. +
  • +
  • x + The x coordinate. +
  • +
  • z + The z coordinate. +
  • +
  • y + The y coordinate. +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.2 +
+
+ + diff --git a/doc/modules/ramps.rampplacer.html b/doc/modules/ramps.rampplacer.html index 19e6838..dfdcee4 100644 --- a/doc/modules/ramps.rampplacer.html +++ b/doc/modules/ramps.rampplacer.html @@ -38,9 +38,11 @@

Modules

diff --git a/doc/modules/ramps.ramputil.html b/doc/modules/ramps.ramputil.html index 317bb11..819fe4d 100644 --- a/doc/modules/ramps.ramputil.html +++ b/doc/modules/ramps.ramputil.html @@ -38,9 +38,11 @@

Modules

diff --git a/doc/modules/worldgenutil.html b/doc/modules/worldgenutil.html index a8ea13a..c0df955 100644 --- a/doc/modules/worldgenutil.html +++ b/doc/modules/worldgenutil.html @@ -38,9 +38,11 @@

Modules

diff --git a/mods/worldgen_utils/corners/cornerutil.lua b/mods/worldgen_utils/corners/cornerutil.lua new file mode 100644 index 0000000..b05db40 --- /dev/null +++ b/mods/worldgen_utils/corners/cornerutil.lua @@ -0,0 +1,50 @@ +--[[ +Copyright (c) 2015, Robert 'Bobby' Zenz +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--]] + + +--- Utility functions for the creation and registration of corners. +cornerutil = {} + + +--- Creates the nodebox for a corner. +-- +-- @param detail The level of detail, basically how many steps the corner will +-- have. +-- @return The nodebox for a corner. +function cornerutil.create_corner_nodebox(detail) + local part = 1 / detail + local nodebox = {} + + for step = 0, detail - 1, 1 do + table.insert(nodebox, { + 0.5 - part * step, -0.5, part * step - 0.5, + 0.5 - part * step - part, 0.5, 0.5 + }) + end + + return nodebox +end + diff --git a/mods/worldgen_utils/init.lua b/mods/worldgen_utils/init.lua index 30a5008..5c68793 100644 --- a/mods/worldgen_utils/init.lua +++ b/mods/worldgen_utils/init.lua @@ -28,6 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. base_path = minetest.get_modpath(minetest.get_current_modname()) dofile(base_path .. "/worldgenutil.lua") +dofile(base_path .. "/corners/cornerutil.lua") dofile(base_path .. "/ramps/rampplacer.lua") dofile(base_path .. "/ramps/ramputil.lua") diff --git a/mods/worldgen_utils/models/corner.blend b/mods/worldgen_utils/models/corner.blend new file mode 100644 index 0000000..650b0e0 Binary files /dev/null and b/mods/worldgen_utils/models/corner.blend differ diff --git a/mods/worldgen_utils/models/corner.obj b/mods/worldgen_utils/models/corner.obj new file mode 100644 index 0000000..34f2d97 --- /dev/null +++ b/mods/worldgen_utils/models/corner.obj @@ -0,0 +1,26 @@ +# Blender v2.69 (sub 0) OBJ File: 'corner.blend' +# www.blender.org +o Cube +v -0.500000 0.500000 -0.500000 +v -0.499998 -0.500000 -0.500000 +v -0.499998 -0.500000 0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 0.500000 0.500000 +vt -0.000000 1.000000 +vt 0.000050 0.000050 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt -0.000000 0.000000 +vt 1.000050 -0.000050 +vn -1.000000 -0.000002 0.000000 +vn 0.707107 0.000001 -0.707106 +vn 0.000000 -1.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn 0.000000 1.000000 -0.000000 +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 1/4/2 6/1/2 5/5/2 2/3/2 +f 3/5/3 2/6/3 5/1/3 +f 3/5/4 5/3/4 6/4/4 4/1/4 +f 4/1/5 6/5/5 1/4/5