Digging with scripts

Post Reply
User avatar
desertmouse
New member
Posts: 1
Joined: Mon Aug 28, 2017 01:39

Digging with scripts

by desertmouse » Post

Hello Minetest!

I'm new to Minetest modding and Lua - but have been reading up
on the methods.

Possible bug report here. Minetest 0.4.16. More likely I just don't know what
I'm doing. I occaisionally use other mods - but this issue comes up when no
other mods are present.

After using programs and scripts to alter other (non Minetest) things over the
years - I thought I would try it in Minetest.

Goal:
HAC - houses as code
DAC - dungeons as code, etc.

Goal is to create any number of things via scripting. Somewhat like
raspberryjammod (very cool arpuss!) only without the Raspberry Pi and I'm also
trying to do it as a Lua mod as the developers intended.

Issue I'm running into (I think) is trying to operate on chunks not yet generated.
Not sure I'm Doing It Right.

Sample issue / steps to reproduce problem (on Linux):
* create sample mod 'q': mkdir ~/.minetest/mods/q
* setup init.lua with a simple script to make a pit

Code: Select all

minetest.register_chatcommand("pit100", {
    -- create a pit 100 meters deep
    -- by using a script!
    func = function(name)
        local player = minetest.get_player_by_name(name)
        pos = player:get_pos()
        for my_y=1, 100, 1
        do
            for my_z=1, 10, 1
            do
                for my_x=1, 10, 1
                do
                    -- minetest.dig_node({x=pos.x - my_x - 2 , y=pos.y - my_y, z=pos.z - my_z})
                    minetest.remove_node({x=pos.x - my_x - 2 , y=pos.y - my_y, z=pos.z - my_z})
                end
            end
        end
    end,
})
* run minetest, generate a world, load the 'q' mod', then run /pit100
* Seems to make a pit 7 meters deep - THEN A FLOOR - then the rest
of the pit underneath the floor (which I can see after a bit of
manual digging)
* Floor should not be there - just a pit 10 x 10 meters across and
100 meters deep. See attached screen shot.
* Is this a bug? Am I doing it wrong? Should I just shut up and dig
with a pick like everyone else?

Thanks for any input anyone has. Bonus points for answering in Lua, Python... (just kidding).

- desertmouse
Attachments
Mystery floor - not sure why it is here.
Mystery floor - not sure why it is here.
2.png (824.05 KiB) Viewed 104 times

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: Digging with scripts

by hajo » Post

desertmouse wrote:Goal is to create any number of things via scripting
Have a look at WorldEdit and handle_schematics.
Also robots, see sig.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests