Page 1 of 1

[Mod] The Origin [1.3.1] [origin]

PostPosted: Thu Feb 05, 2015 17:19
by Wuzzy
This is a very simple map generating mod for the map generator “singlenode”. It places a single indestructible block, called “The Origin” directly below the spawn position. It also forces the map generator to be “singlenode” unless disabled via settings.
This prevents the player to fall immediately down on spawning.

Screenshot:
Image

By default, the block will spawn at (0,-1,0), but if the setting “static_spawnpoint” is present, it will spawn the block one node length below that position.

I am unsure if this mod is capable of handling a static_spawnpoint which is changed often. The intention is that the block only spawns once for the entire lifetime of the world and that's it. If you somehow noticed that a second origin block spawned, please report it here as bug.

I consider this mod to be finished.

Version: 1.3.1
License of everything: WTFPL
Mandatory dependencies: None!
Optional dependencies: intllib, doc_items
Download: In the attachment
Git project page (for developers): http://repo.or.cz/minetest_origin.git

Re: [Mod] The Origin [1.0.0] [origin]

PostPosted: Fri Feb 06, 2015 09:54
by Krock
Well, it's possible to create multiple origin nodes if static_spawn is changed to a not generated coordinate.
This mod can be helpful for people who want to create their own world.
Could you add some nodes around the origin, so it's not possible to fall off by a mistake?

Re: [Mod] The Origin [1.1.0] [origin]

PostPosted: Fri Feb 06, 2015 23:55
by Wuzzy
Thanks for the feedback. I made a small update to version 1.1.0.

This mod now writes a file “origin.mt” into the world folder when the Origin is first placed. If the file is present when the world is loaded later, the mod will not place the Origin again.
I hope this ensures the Origin will only be placed once in the world.

I also added a short readme file.

Hmm, I am not sure if I change the stuff that spawns around the spawn position. I don't want this initial block to get in the way too much. For now, if you fall down, you could teleport back with /teleport. Not the best solution …

Maybe I will extend this mod later to spawn more fancy structures at the spawnpoint, and make this mod more configurable. But for now I keep things just simple and stupid. :D

Release 1.1.1

PostPosted: Fri Feb 20, 2015 01:41
by Wuzzy
Quick bugfix release 1.1.1!

The origin node could theoretically be removed by the cave generation of the map generator. Now this should not be possible anymore.

Re: [Mod] The Origin [1.1.1] [origin]

PostPosted: Sat Mar 07, 2015 17:58
by Sokomine
Good idea. Falling through the map when mapgen is singlenode is always a bit annoying. It takes some time to type the /grant singleplayer all command. There are also some skyblock games which are pretty nice.

Release 1.2.0

PostPosted: Sat Jul 02, 2016 16:05
by Wuzzy
I just released version 1.2.0. This is a minor update which adds mod.conf and tweaks the readme file a bit.
I also added a Git repository (see first post).

Re: [Mod] The Origin [1.2.0] [origin]

PostPosted: Sat Jul 02, 2016 18:48
by TheReaperKing
I'm sure you can add this easily yourself but I'd be more than happy to add the simple code but I made a modified version of your Mod that defaults to the singlenode mapgen. Just kinda makes sense :) Thanks for this mod!

Re: [Mod] The Origin [1.2.0] [origin]

PostPosted: Sat Jul 23, 2016 11:27
by Wuzzy
Since the singlenode mapgen is now deeply hidden in Minetest and hard to select, should I change this mod that it automatically forces the singlenode mapgen on loading?
Or is there maybe an usecase for an origin block in any of the other mapgens?

Re: [Mod] The Origin [1.2.0] [origin]

PostPosted: Sat Jul 23, 2016 12:12
by TheReaperKing
Maybe if you are worried about people wanting a choice you could make it called "The Origin + Singlenode Mod" Here is what I have. I did make the block destructible because in case I need to destroy it when building.

Edit - In case you were wondering why I changed your license to DWYWPL I work at a school :) Same license but actually offers you some protection from getting sued too.

--Enable Singlenode
minetest.set_mapgen_params({mgname = "singlenode"})


--Origin Mod thanks to Wuzzy and his code is licensed DWYWPL
origin = {}

do
local filepath = minetest.get_worldpath().."/origin.mt"
local file = io.open(filepath, "r")
if file then
io.close(file)
origin.exists = true
else
origin.exists = false
end
end

minetest.register_node("singlenode:origin",{
description = "The Origin",
is_ground_content = true,
groups = { not_in_creative_inventory = 1, immortal = 0 },
tiles = {"origin_origin.png"},
sounds = { footstep = "origin_origin_footstep" },
is_ground_content = false,
})

minetest.register_on_mapgen_init(function(mgparams)
origin.mgparams = mgparams
end)

minetest.register_on_generated(function(minp, maxp, seed)
local spawn = minetest.setting_get_pos("static_spawnpoint")
if origin.exists ~= true and origin.mgparams.mgname == "singlenode" then
local blockpos
if spawn ~= nil then
blockpos = { x=spawn.x, y=spawn.y-1, z=spawn.z }
else
blockpos = { x=0, y=-1, z=0 }
end
if(minp.x <= blockpos.x and maxp.x >= blockpos.x and minp.y <= blockpos.y and maxp.y >= blockpos.y and minp.z <= blockpos.z and maxp.z >= blockpos.z) then
minetest.set_node(blockpos, {name = "singlenode:origin"})
minetest.log("action", "[origin] The Origin has been set at "..minetest.pos_to_string(blockpos)..".")
origin.exists = true
local filepath = minetest.get_worldpath().."/origin.mt"
local file = io.open(filepath, "w")
if file then
file:write(minetest.pos_to_string(blockpos))
else
minetest.log("error", "[origin] Failed to write origin data into "..filepath..". The Origin may be placed again if you change static_spawnpoint.")
end
end
end
end)

Version 1.3.0

PostPosted: Mon Aug 08, 2016 04:01
by Wuzzy
Version 1.3.0 released!

Changes:

- Force singlenode mapgen on loading
- Add setting (origin_force_singlenode) to disable aforementioned behaviour
- intllib support
- German translation
- Item Documentation support
- Minor bugfixes

Version 1.3.1 released!

PostPosted: Fri Nov 18, 2016 23:26
by Wuzzy
Version 1.3.1 released! Changes:

- Fix mod not working if both intllib and mod security are enabled
- Use larger screenshot
- Minor refactoring
- Compability to version 0.7.0 of doc_items (Documentation System modpack)