Page 1 of 3

[Mod] A simple bedrock mod [20120316] [bedrock]

PostPosted: Sun Mar 11, 2012 22:06
by jn
As I felt it was lacking, I made a simple mod to add "bedrock" to minetest, a stone that you can't destroy.

Image

You can get it here: version history zip tar.gz (the license is WTFPL)


Notes:
- Using this mod together with mods like Moreores or Gemstones may lead to ores being placed at the bedrock layer. If this happens, please tell me if putting the name of the other mod into depends.txt helps.
- I will not announce new versions when I release them, but you can always find the version history (with previous versions) above.

PostPosted: Sun Mar 11, 2012 22:11
by Temperest
Wouldn't you be able to dig through this in 1000000 seconds? :P

This would be pretty useful for making impenetrable sections of the map if there was a fly mode privilege that prevented one from just flying past it.

Otherwise it's a nice way to show the end of the map.

PostPosted: Sun Mar 11, 2012 22:17
by jn
Temperest wrote:Wouldn't you be able to dig through this in 1000000 seconds? :P

Have fun spending two weeks pressing your mouse button :P

Temperest wrote:This would be pretty useful for making impenetrable sections of the map if there was a fly mode privilege that prevented one from just flying past it.

Indeed.

Temperest wrote:Otherwise it's a nice way to show the end of the map.

I'm glad you like it :)

PostPosted: Sun Mar 11, 2012 22:22
by sdzen
what if my pick has a basetime of 0?

PostPosted: Sun Mar 11, 2012 22:32
by jn
sdzen wrote:what if my pick has a basetime of 0?

Constant dig time (which is what I used) isn't influenced by the tool's basetime.

PostPosted: Sun Mar 11, 2012 22:46
by Temperest
jn wrote:
Temperest wrote:Wouldn't you be able to dig through this in 1000000 seconds? :P

Have fun spending two weeks pressing your mouse button :P


Apparently it would only take 11.574074 days...

PostPosted: Sun Mar 11, 2012 22:59
by jn
Ah, well, I estimated it in my head. (And did hope someone would actually calculate this, so I could compare)

PostPosted: Sun Mar 11, 2012 23:01
by Utilisatrice
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
23:58:45: INFO[main]: Server: Loading mod "jn"
23:58:45: INFO[main]: Loading and running script from C:\Users\****\Desktop\minetest\bin\bin\..\data\mods\jn\init.lua
23:58:45: ERROR[main]: Failed to load and run script from C:\Users\****\Desktop\minetest\bin\bin\..\data\mods\jn\init.lua:
23:58:45: ERROR[main]: [LUA]
23:58:45: ERROR[main]: [LUA] ...p\minetest\bin\bin\..\data\builtin.lua:531: Name bedrock:bedrock does not follow naming conventions: "modname:" or ":" prefix required
23:58:45: ERROR[main]: stack traceback:
23:58:45: ERROR[main]:     [C]: in function 'error'
23:58:45: ERROR[main]:     ...p\minetest\bin\bin\..\data\builtin.lua:531: in function 'check_modname_prefix'
23:58:45: ERROR[main]:     ...p\minetest\bin\bin\..\data\builtin.lua:567: in function 'register_item'
23:58:45: ERROR[main]:     ...p\minetest\bin\bin\..\data\builtin.lua:623: in function 'register_node'
23:58:45: ERROR[main]:     ...si-minetest\bin\bin\..\data\mods\jn\init.lua:25: in main chunk
23:58:45: ERROR[main]: [LUA]
23:58:45: ERROR[main]: Server: Failed to load and run C:\Users\****\Desktop\minetest\bin\bin\..\data\mods\jn\init.lua
BanManager: saving to C:\Users\****\Desktop\minetest\bin\bin\..\world\ipban.txt
BanManager: failed loading from C:\Users\****Desktop\minetest\bin\bin\..\world\ipban.txt

PostPosted: Mon Mar 12, 2012 00:00
by Temperest
Utilisatrice wrote:
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
23:58:45: INFO[main]: Server: Loading mod "jn"
23:58:45: INFO[main]: Loading and running script from C:\Users\****\Desktop\minetest\bin\bin\..\data\mods\jn\init.lua
23:58:45: ERROR[main]: Failed to load and run script from C:\Users\****\Desktop\minetest\bin\bin\..\data\mods\jn\init.lua:
23:58:45: ERROR[main]: [LUA]
23:58:45: ERROR[main]: [LUA] ...p\minetest\bin\bin\..\data\builtin.lua:531: Name bedrock:bedrock does not follow naming conventions: "modname:" or ":" prefix required
23:58:45: ERROR[main]: stack traceback:
23:58:45: ERROR[main]:     [C]: in function 'error'
23:58:45: ERROR[main]:     ...p\minetest\bin\bin\..\data\builtin.lua:531: in function 'check_modname_prefix'
23:58:45: ERROR[main]:     ...p\minetest\bin\bin\..\data\builtin.lua:567: in function 'register_item'
23:58:45: ERROR[main]:     ...p\minetest\bin\bin\..\data\builtin.lua:623: in function 'register_node'
23:58:45: ERROR[main]:     ...si-minetest\bin\bin\..\data\mods\jn\init.lua:25: in main chunk
23:58:45: ERROR[main]: [LUA]
23:58:45: ERROR[main]: Server: Failed to load and run C:\Users\****\Desktop\minetest\bin\bin\..\data\mods\jn\init.lua
BanManager: saving to C:\Users\****\Desktop\minetest\bin\bin\..\world\ipban.txt
BanManager: failed loading from C:\Users\****Desktop\minetest\bin\bin\..\world\ipban.txt


Your mod folder name must be "bedrock", not "jn".

PostPosted: Mon Mar 12, 2012 04:21
by jordan4ibanez
very cool

PostPosted: Mon Mar 12, 2012 07:27
by Jordach
must add to mc 4 mt.

PostPosted: Mon Mar 12, 2012 13:18
by sfan5
Nice Mod!

PostPosted: Mon Mar 12, 2012 18:20
by IPushButton2653
Needed this for a while. Implemented a bedrock node in my personal minetest, and now I can use it :D

PostPosted: Fri Mar 16, 2012 21:19
by Calinou
Quick texture, better than an uniform color (:P): http://ompldr.org/vZDFxbg/bedrock.png

PostPosted: Fri Mar 16, 2012 22:57
by jn
Calinou wrote:Quick texture, better than an uniform color (:P): http://ompldr.org/vZDFxbg/bedrock.png

Yes, definately. But it looks a bit like rubber.
May I include the texture? Under which basic license?

PostPosted: Fri Mar 16, 2012 23:05
by Calinou
Feel free to, license is "do whatever you want with it".
You can edit it if you want.

PostPosted: Fri Mar 16, 2012 23:35
by jn
Thanks, I brightened it up a bit to match the brightness of stone (I'm not sure if that's a good idea, but at least it's not too minecrafty).

PostPosted: Wed Apr 11, 2012 16:15
by Demostan
is there a /giveme and if it has what is it?

PostPosted: Wed Apr 11, 2012 22:38
by LolManKuba
I do not know why this mod is needed.

PostPosted: Tue Apr 24, 2012 09:32
by Troy6879
Temperest wrote:
jn wrote:
Temperest wrote:Wouldn't you be able to dig through this in 1000000 seconds? :P

Have fun spending two weeks pressing your mouse button :P


Apparently it would only take 11.574074 days...

Bit of a math freak arn't you?(No offence)

PostPosted: Tue Apr 24, 2012 14:09
by Death Dealer
LolManKuba wrote:I do not know why this mod is needed.

To keep certain monsters from digging to low, or to section off the nether do you can't dig to it. Or there placed at-32000 and they would be put there to make things a bit more realistic when you get to it. Instead of seeing into the void.

PostPosted: Tue Apr 24, 2012 19:57
by Temperest
Troy6879 wrote:
Temperest wrote:...

Bit of a math freak arn't you?(No offence)


It's what happens when you have a calculator built into your launcher... :P

PostPosted: Tue Apr 24, 2012 21:29
by LolManKuba
What would happen if you flew below that point?

PostPosted: Tue Apr 24, 2012 21:35
by jn
LolManKuba wrote:What would happen if you flew below that point?

Well, just that -- you flew below there. ;-)

PostPosted: Sat Jul 14, 2012 17:24
by xxxeasternxxx
How deep is the bedrock

PostPosted: Sat Jul 14, 2012 18:52
by jn
xxxeasternxxx wrote:How deep is the bedrock

By default it is at y=-30976, but you can change that by editing init.lua.

PostPosted: Mon Sep 23, 2013 19:33
by Element
the unuke(tnt) mod can destroy bedrock...is there a way you can make it so it cant

PostPosted: Tue Sep 24, 2013 20:44
by Element
thanks to this, my world has a bottom at -1000 nodes

PostPosted: Tue Sep 24, 2013 20:51
by Wuzzy
Element wrote:the unuke(tnt) mod can destroy bedrock...


This is both a bug in unuke and bedrock.

Element wrote:is there a way you can make it so it cant

Yes, by fixing the bugs. I fixed one of them. :-)

Now to the bugs:
unuke bug: A nuke destroys ANY node, no matter what it is, completely ignoring the properties of the node. This is a bit rude. This is also true for the TNT mod, for the same reasons.
bedrock bug: It does not use on_blast. By the way, bedrock’s code is kinda dated, I am surprised that you made the mod work at all.

On_blast is a neat little function defined in the modding API as a node callback if an explosion is close to a node. The engine does not use this function yet, but it is intended to be called by mods that cause explosions for every node that is affected by the explosion.
on_blast syntax: on_blast(pos, intensity)
pos = position
intensity = intensity of explosion. The intensity of a regular TNT is defined to be 1.

The trick is, on_blast will only be called if it’s not nil. If it’s nil, a standard behaviour will be done to the mod (removing it, for example). Well, at least that’s the idea how the mods handle on_blast. Mods still may screw this up.

Also there were no groups back in the days where this olden mod had been created. For nodes like bedrocks, there is now the group “immortal”. :-) Now you can dig forever on a bedrock and it will never break. It may be still possible to remove bedrock with special tools like the admin pickaxe, or stuff like that.

Here is a fresh version of Bedrock:
init.lua:
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 bedrock = {}

bedrock.layer = -30912 -- determined as appropriate by experiment
bedrock.node = {name = "bedrock:bedrock"}

minetest.register_on_generated(function(minp, maxp)
    if maxp.y >= bedrock.layer and minp.y <= bedrock.layer then
        local p = {y = bedrock.layer}
        local n = bedrock.node
        for x = minp.x,maxp.x do
        for z = minp.z,maxp.z do
            p.x=x; p.z=z
            minetest.env:set_node(p, n)
        end
        end
    end
end)

minetest.register_node("bedrock:bedrock", {
    description = "Bedrock",
    tiles = {"bedrock.png"},
    groups = {immortal=1, stone=1, not_in_creative_inventory=1},
    on_blast = function() end,
})

(the other files keep unchanged)

Above code was tested with 0.4.7. It’s usable again. :-)
I call this version of bedrock “20130924”.
Funnily, the lowest possible Y coordinate has changed over the years.

See the trick? On_blast here is defined as a function which does literally nothing, not caring about the position and the explosion intensity. Because that’s exactly what we want: No matter how big the explosion, bedrock shall stay bedrock forever.

Note that the unuke mod and the TNT mod both do not respect on_blast yet. So these mods have to be changed, too, so that bedrock does not get destroyed by explosions. I should start complaining in their respective threads soon. ;-)

For the future I would like the bedrock mod to:
  1. have sounds for bedrock (preferably not the default sounds! ;-))
  2. use LuaVoxelManip instead of set_node for better performance (I do not understand LuaVoxelManip yet :-(. )

My changes fall under the WTFPL, of course.

PostPosted: Tue Sep 24, 2013 20:56
by Element
is there a way to make the bedrock layer be thicker than one node