Page 1 of 2

[Mod] Deploy Nodes [deploy_nodes] nodes that turn into big structures

PostPosted: Wed Sep 26, 2012 01:35
by cornernote
Deploy Nodes for Minetest

Craftable nodes that when placed turn into shapes or structures.

Documentation | GitHub Project

Requirements

Image

About

This module is open source, so it's distributed freely. If you find it useful then I ask not for your wealth, but simply to spare your time to consider the world we share by watching Earthlings, a multi-award winning film available to watch online for free. A must-see for anyone who wishes to make the world a better place.

Credits

mauvebic - author of multinode which provided code for spheres and cylinders
Echo - author of maze which provided code for spheres
Temperest - autory of worldedit which provided code for pyramids
neko259 - author of livehouse which inspired building spawning
VanessaE - contributed buildings
kddekadenz - contributed buildings
ACDC - contributed buildings
Nanuk - contributed buildings
irksomeduck - contributed buildings

License

BSD-3-Clause, Copyright © 2014 Brett O'Donnell

PostPosted: Wed Sep 26, 2012 07:10
by tkerwel
+1

pls add a simple example how to use this, makes it much easier to understand. like a short code example to crate a wood sphere with your function deploy_sphere ...

i think this has a big potential

PostPosted: Wed Sep 26, 2012 07:42
by cornernote
its not really indended to call the shape function in lua, its more intended that you craft a sphere node, like this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-M-   M=dirt/wood/brick/cobble/stone/glass
MMM   make bigger spheres by using small spere as the material
-M-


then you place it, and you get a sphere.

if you want to make a sphere using an API, worldedit will be better

PostPosted: Wed Sep 26, 2012 07:54
by tkerwel
hmmmm...

whatever i try i got the message when i try to placed a small cobble sphere

no room to build because deploy_sphere:cobble_small is in the way at ( y = 14, x =37, z =-2)

there is plenty of room so i really dont know waht to do

PostPosted: Wed Sep 26, 2012 08:02
by cornernote
it thinks itself is in the way, i'll check

PostPosted: Wed Sep 26, 2012 08:03
by tkerwel
thanks...

PostPosted: Wed Sep 26, 2012 08:07
by cornernote
fixed, please try again now

PostPosted: Wed Sep 26, 2012 08:16
by VanessaE
The suggested wood and glass sphere recipes conflict with round wood and glass tables in Homedecor, just FYI :-)

PostPosted: Wed Sep 26, 2012 08:22
by tkerwel
working now...thx for the fast fix

PostPosted: Wed Sep 26, 2012 08:29
by tkerwel
maze and cylinder works too.... lots of work now to remove that from my map again *lol*

how do i use the buliding? i see examples but dont know to place them...

for example, how do i place the 12.we from the small buildings file into my world ?

PostPosted: Wed Sep 26, 2012 08:31
by cornernote
the only thing you can choose is small, medium or large... the actual building is random

if you want 12.we to appear then you would have to remove all the other *.we files from that folder

PostPosted: Wed Sep 26, 2012 08:53
by tkerwel
okay now check everything and its working, just some probs with the large building, cause i dont finde space to place that...

a suggestion from my side:
maybe its possible to choose a building with a kind of function. maybe have different recipies (paper or craftplan) so its possible to choose the building you want.
so you have a block for a bulding (small, medium, big) and then add a craftplan to choose the type of house.

anyway its a gread tool for minetest, somebody should programm a editor for the building.... i guess when i start doing this a lot of ppl are again faster then me....hehehe...

PostPosted: Wed Sep 26, 2012 09:11
by cornernote
i was thinking about a mod to add to this pack that kindof does that... very much the same as the deploy_building mod, except it does not auto-deploy. you have to right click it (it opens like a chest), and there is a button added for each building found in the folder. you click which one you want, it checks space then builds

PostPosted: Wed Sep 26, 2012 09:25
by tkerwel
sounds good, maybe you add a kind of function to organize buildings so its easy to add more buildings of the *we type.
maybe a textfile where the buildingstypes can be added. so at the start this file is read and then all availible builldingtypes.

in this way you dont need 3 different folders...

also you should check what kind of building type is placed, just imagine somebody take a big building in the small building folder, i am not sure how the checking works for the space... maybe thiss could be a problem.

can you pls explain the format of the *we fille a bit more..

-1 0 -1 default:wood 0 0 <= thats to place one block whats the 0 0 behind the wood ?

PostPosted: Wed Sep 26, 2012 09:34
by cornernote
its even easier than that, no txt file needed... just put them in the folder and they will be detected and made into a button on the deploy node

the 0 0 is param1, param2

eg:

local node = {}
node.name = name
node.param1 = param1
node.param2 = param2
minetest.env:add_node(pos, node)


Oh, i should note... you make *.we files using worldedit mod. =)

PostPosted: Wed Sep 26, 2012 10:13
by cornernote
added spiral and fixed recipies (see homepage)

PostPosted: Wed Sep 26, 2012 10:19
by cornernote
cornernote wrote:i was thinking about a mod to add to this pack that kindof does that... very much the same as the deploy_building mod, except it does not auto-deploy. you have to right click it (it opens like a chest), and there is a button added for each building found in the folder. you click which one you want, it checks space then builds


i have had a think about this and decided i probably wont do it. if you want to load a specific building in a specific place then worldedit is probably better.

PostPosted: Wed Sep 26, 2012 10:20
by tkerwel
so fast ...WOOWOOOO....blueprint i love this idea...

sadly no time today anymore to test this

gud job !!!!

PostPosted: Wed Sep 26, 2012 11:57
by Ragnarok
Could you implement... cones? 4:1, 3:1, 2:1, 1:1, 1:2, 1:3, 1:4 height to diameter ratios.

PostPosted: Wed Sep 26, 2012 12:04
by Echo
Great job!
You could add the braid-maze code (a few lines to detect dead ends and open some of them) to make it harder to get out of the maze. With the "simple" maze you just have to keep right to get out.

PostPosted: Wed Sep 26, 2012 12:24
by cornernote
Hi echo, that maze code is too hardcore, I just skipped over most of it and prayed it worked. Would you be able to put that change in?

PostPosted: Wed Sep 26, 2012 14:11
by Echo
I think there are three changes:
1. two more variables to detect dead ends (two new lines)
old:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        local pos = {x = 0, y = 0, l = 0}
        table.insert(moves, {x = pos_x, y = pos_y, l = pos_l})

new:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        local pos = {x = 0, y = 0, l = 0}
        local forward = true
        local dead_end = {}
        table.insert(moves, {x = pos_x, y = pos_y, l = pos_l})


2. set generation direction "forward" (one new line)
old:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
            if #possible_ways > 0 then
                direction = possible_ways[math.random(# possible_ways)]

new:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
            if #possible_ways > 0 then
                forward = true
                direction = possible_ways[math.random(# possible_ways)]


3. dectect dead ends and remove them if possible with 20% chance (math.random(5) == 1 -- 100% would be too easy again)
old:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
            else
                pos = table.remove(moves)
                pos_x = pos.x
                pos_y = pos.y
                pos_l = pos.l
            end
        until pos_x == start_x and pos_y == start_y

-- create exit on opposite end of maze and make sure it is reachable

new:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
            else -- there is no possible way forward
                if forward then -- the last step was forward, now back, so we're in a dead end
                    -- mark dead end for possible braid
                    if not maze[pos_l][pos_x - 1][pos_y] then -- dead end to E, only way is W
                        table.insert(dead_end, {x = pos_x, y = pos_y, l = pos_l, dx = 1, dy = 0})
                    elseif not maze[pos_l][pos_x + 1][pos_y] then -- dead end to W, only way is E
                        table.insert(dead_end, {x = pos_x, y = pos_y, l = pos_l, dx = -1, dy = 0})
                    elseif not maze[pos_l][pos_x][pos_y - 1] then -- dead end to S, only way is N
                        table.insert(dead_end, {x = pos_x, y = pos_y, l = pos_l, dx = 0, dy = 1})
                    elseif not maze[pos_l][pos_x][pos_y + 1] then -- dead end to N, only way is S
                        table.insert(dead_end, {x = pos_x, y = pos_y, l = pos_l, dx = 0, dy = -1})
                    end
                    forward = false
                end
                pos = table.remove(moves)
                pos_x = pos.x
                pos_y = pos.y
                pos_l = pos.l
            end
        until pos_x == start_x and pos_y == start_y
-- create partial braid maze, about 20%
        for _, braid_pos in pairs(dead_end) do
            -- print(braid_pos.x.."/"..braid_pos.y.."/"..braid_pos.l.." "..braid_pos.dx.."/"..braid_pos.dy)
            x = braid_pos.x + braid_pos.dx * 2
            y = braid_pos.y + braid_pos.dy * 2
            if math.random(5) == 1 and x > 0 and x < maze_size_x - 1 and y > 0 and y < maze_size_y - 1 and not maze[braid_pos.l][x][y] then
                -- remove wall if behind is corridor with 20% chance
                maze[braid_pos.l][braid_pos.x + braid_pos.dx][braid_pos.y + braid_pos.dy] = false
                -- print("removed "..braid_pos.l.."/"..braid_pos.x + braid_pos.dx.."/"..braid_pos.y + braid_pos.dy)
            end
        end
-- create exit on opposite end of maze and make sure it is reachable


Maybe it would be better to make it braid only for medium and large mazes. For small mazes it could open too many ways to the exit instead of confusing the player.

PostPosted: Wed Sep 26, 2012 19:30
by cornernote
I added it, and I made it only do it if the size is above 15 (which means only medium and large). Havent tested it yet but will try later on today.

Thanks for the help with the maze code!

p.s. I would also like to see the maze code added to WorldEdit. Are you interested in doing that?

PostPosted: Thu Sep 27, 2012 06:35
by cornernote
added more buildings, screenshots on homepage

PostPosted: Thu Sep 27, 2012 13:03
by cornernote
added deploy_pyramid and created some initial textures (better than nothing)

PostPosted: Mon Oct 01, 2012 04:54
by cornernote
Now has shooting arrows to place structures!

PostPosted: Tue Oct 02, 2012 18:29
by BZab
error_message = ServerError: LuaError: error running function 'on_step': .../mods/minetest/deploy_nodes/deploy_building/init.lua:28: 'popen' not supported

And game crushes...

PostPosted: Tue Oct 02, 2012 22:47
by cornernote
Which OS are you running?

PostPosted: Thu Oct 04, 2012 06:01
by Feorth
Woah, great mod! Thanks!

PostPosted: Thu Oct 04, 2012 16:41
by BZab
cornernote wrote:Which OS are you running?


Linux Ubuntu... one of newest...