[Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

Do you use this mod?

Yes, I like it.
7
88%
No, I'm not interested.
1
13%
 
Total votes : 8

User avatar
Linuxdirk
Member
 
Posts: 2426
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Linuxdirk » Tue Jan 07, 2020 18:43

Yeah :(

Maybe hacking into the existing code is easier. The mentioned air detection in combination with simple replacement of all that was placed already allows various different “logic nodes”:

1. Floor (normal node, air above, anything below)
2. Subceiling (normal node, air above and below)
3. Ceiling (normal node, air below, anything above)
4. Outer Walls (normal nodes, air on one side, anything else on the opposite side)
5. Inner walls (normal nodes, air on opposite sides)
6. Stairs (well, stairs, regardless of whats around it)
7. Corridor stairs (stars with dungeon nodes on opposite sides that are not front and back)
 

User avatar
paramat
Developer
 
Posts: 3580
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by paramat » Sat Jan 11, 2020 01:39

Hamlet,

I quickly looked through your code on 21 Dec, enough to see what method you were using.
More recently, i could not remember noticing anything that might remove dungeons from the surface, but as i did not study the code in detail it is possible i might have missed something.

My "unless this mod does something weird" was just perplexed speculation because dungeons missing from the surface is very mysterious, not a known or reported engine bug now or in the past, and i was perplexed as to what the cause could be. Technically it was possible your mod did something intentionally that i missed.
I actually think it is unlikely your mod removes them from the surface, i was not blaming you.

> For example, the fact that floating islands are broken since at least two years; no matter how you turn them off, be it either via GUI settings or minetest.conf - the mapgen V7 will keep spawning floating pieces of land.

If you created a world with Mapgen V7 floatlands enabled, those mapgen flags will be stored in the world's map_meta.txt file and always in effect. The only way to disable floatlands again is to edit the map_meta.txt file in the world folder. Altering settings in GUI or .conf will have no effect.
So this is probably not a bug, you can use the above method to find out.

It is the inherent and unavoidable nature of perlin noise based mapgen generation that a floatland may be a few nodes, just as an island in the ocean may be a few nodes.

Linuxdirk,

> Yes, after years of nagging I decided to exclusively go this route because I learned that nothing will ever really addressed and takes dozens of releases or will simply be ignored forever. Everything that annoys me and that is ignored by the devs I fix by myself using a mod.

'Nothing' is a 'slight' exaggeration =)
Nothing is 'ignored', we attended to and discussed all your suggestions, some were rejected for good reason. This is disagreeing, not 'ignoring'.
Your very negative and obsessive delusions and demonising of core devs is damaging to MT and misleads others into delusion and resentment.
You have also been very unpleasant on Github, to the point we almost started considering banning you from the repository.
 

kestral
Member
 
Posts: 88
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by kestral » Sat Jan 11, 2020 02:55

I guess this might be my fault, with my comment about having trouble finding dungeons on the surface in 5.2dev. I went back to 0.4.16 and realized it was the lack of protruding dungeons that made me think there were less dungeons on the surface. Flying around in 5.x, I found several dungeons on the surface—they're just harder to see when you're not flying around. I do prefer the current scheme without the protruding dungeons.
 

User avatar
Linuxdirk
Member
 
Posts: 2426
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Linuxdirk » Sat Jan 11, 2020 03:00

paramat wrote:we attended to and discussed all your suggestions, some were rejected for good reason. This is disagreeing, not 'ignoring'.

Whatever you say, man. I’m not discussing Minetest dev stuff with you. You (you devs, not only you personally) do your thing, fine. I do mine and see what and where I need to manually alter things to my liking using mods.

Also: It is not about me, it is about the 901 issues and about the 144 pull requests that are open and no-one is assigned to for Minetest alone.

paramat wrote:You have also been very unpleasant on Github,

I am not using GitHub since mid-2019.
 

User avatar
Hamlet
Member
 
Posts: 700
Joined: Sat Jul 29, 2017 21:09
Location: Lombardy, Italy
GitHub: h4ml3t
IRC: H4mlet

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Hamlet » Thu Jan 23, 2020 13:10

Linuxdirk wrote:Maybe hacking into the existing code is easier. The mentioned air detection in combination with simple replacement of all that was placed already allows various different “logic nodes”: [...]


I have taken note of the various "logic nodes", and I have been thinking about how to actually implement them.
I will work on this, maybe I'll manage to obtain something nice, perhaps even customizable by the end-user.

Thanks for your suggestions!
 

User avatar
Hamlet
Member
 
Posts: 700
Joined: Sat Jul 29, 2017 21:09
Location: Lombardy, Italy
GitHub: h4ml3t
IRC: H4mlet

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Hamlet » Tue Jan 28, 2020 19:47

An image is worth a thousand words.

Image

Not yet complete though: that is, it does not achieve all the goals defined by Linuxdirk; furthermore, it does not allow to choose the replacer nodes via Settings menu.
But it's a start.
Attachments
dungeon.png
(335.76 KiB) Not downloaded yet
 

User avatar
Linuxdirk
Member
 
Posts: 2426
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Linuxdirk » Wed Jan 29, 2020 14:54

Glorious! This looks very very promising already!

I'll totally keep this on my "watch list" :)
 

User avatar
Hamlet
Member
 
Posts: 700
Joined: Sat Jul 29, 2017 21:09
Location: Lombardy, Italy
GitHub: h4ml3t
IRC: H4mlet

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Hamlet » Thu Jan 30, 2020 17:21

Linuxdirk wrote:Glorious! This looks very very promising already!

I'll totally keep this on my "watch list" :)


:) Thank you!
 

User avatar
Hamlet
Member
 
Posts: 700
Joined: Sat Jul 29, 2017 21:09
Location: Lombardy, Italy
GitHub: h4ml3t
IRC: H4mlet

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by Hamlet » Thu Jan 30, 2020 17:35

Some updates on the ongoing development:
(source code at page bottom)


ADDED:
1a - Option to keep the existing cobblestone floor.
2a - Six predefined dungeon styles using the default MaterialName_brick, MaterialName_block, etc. ranging from stone to obsidian.
3a - Option to choose whether if dungeons' style should be random or biome-based; the latter excludes obsidian dungeons.
4a - Biome check to prevent useless scanning on dungeons not using cobblestone nodes; examples: ice-dungeons, sandstone-brick dungeons.
5a - Option to select the preferred node replacement method; default: VoxelManipulator, optional: minetest.set_node.
6a - Currently available logic nodes: dungeon wall (outer wall), dungeon inner wall, dungeon column, dungeon stair, dungeon floor, dungeon ceiling.

REMOVED:
1r - Native support for Castle Masonry.

TO-DO:
1td - Improve the detection of the logic nodes.
2td - Allow to change the options via the Settings menu.
3td - Allow the customization of the dungeon styles via the Settings menu.

NOTE:
About 5a: it is common knowledge that VoxelManipulators are faster, more performant than minetest.set_node; but according to lua_api.txt at line 3287 (MT v5.1.1) this may not be always true, specifically for areas equal or smaller than 3x3x3 nodes - which I think should be the minority of the cases, given that dungeons' rooms are bigger and corridors are generally a minor part of said dungeons.
However, as a general rule of thumb I prefer not to force my choices on end-users, thus the ability to switch the replacement method; if you prefer minetest.set_node for some reason, you can select it.

About 6a: the list is currently missing two logic nodes defined by Linuxdirk,
2. Subceiling (normal node, air above and below)
7. Corridor stairs (stars with dungeon nodes on opposite sides that are not front and back)

Given the heavy random nature of the dungeons, I doubt that it would be useful to detect them to try to customize them; the following image shows two logic nodes, inner walls (number 2), and columns (number 1).

Image

As you can see, customization of said nodes makes the dungeon look strange, as if made with randomly found materials; therefore even if such logic nodes are detected they are actually replaced with the same node of the other walls, which I think gives a better feeling of consistence and realism - but then again, that is my taste: if you want you can customize them.


THIS IS TESTING CODE, USE IT FOR TESTING PURPOSES ONLY
Code: Select all
--[[
   Stonebrick Dungeons - Turns newly generated cobblestone dungeons into
   stonebrick.
   Copyright © 2017, 2020 Hamlet and contributors.

   Licensed under the EUPL, Version 1.2 or – as soon they will be
   approved by the European Commission – subsequent versions of the
   EUPL (the "Licence");
   You may not use this work except in compliance with the Licence.
   You may obtain a copy of the Licence at:

   https://joinup.ec.europa.eu/software/page/eupl
   https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32017D0863

   Unless required by applicable law or agreed to in writing,
   software distributed under the Licence is distributed on an
   "AS IS" basis,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   implied.
   See the Licence for the specific language governing permissions
   and limitations under the Licence.

--]]


--
-- Variables
--

local b_DungeonNotify = true
local b_ChangeFloor = false
local b_RandomDungeonSet = false
local b_UseVoxelManipulator = true
local s_LogLevel = minetest.settings:get('debug_log_level')
local f_ReplacementDelay = 2.0
local s_DungeonWall = 'default:stonebrick'
local s_DungeonInnerWall = 'default:stonebrick'
local s_DungeonColumn = 'default:stonebrick'
local s_DungeonStair = 'stairs:stair_stonebrick'
local s_DungeonFloor = 'default:stone'
local s_DungeonCeiling = 'default:stone_block'
local i_MaxOffset = 22
-- See mapgen_v6.cpp 'room_size_large_max'.
-- See mapgen.cpp 'room_size_large_max'.


--
-- Constants
--

local s_COBBLE = 'default:cobble'
local s_COBBLE_MOSSY = 'default:mossycobble'
local s_STAIR_COBBLE = 'stairs:stair_cobble'
local s_STAIR_COBBLE_MOSSY = 'stairs:stair_mossycobble'


--
-- Functions
--

-- Used to determine wheter if a node should be considered as 'air'.
local ToBeIgnored = function(a_s_node_name)
   local t_IgnoreList = {
      'air',
      'default:snow',
      'default:chest',
      'default:mese_post_light',
      'default:water_source',
      'default:water_flowing',
      'default:river_water_source',
      'default:river_water_flowing',
      'default:lava_source',
      'default:lava_flowing'
   }
   local b_ToBeIgnored = false

   for i_Element = 1, #t_IgnoreList do
      if (b_ToBeIgnored == false) then
         if (a_s_node_name == t_IgnoreList[i_Element]) then
            b_ToBeIgnored = true
         end
      end
   end

   return b_ToBeIgnored
end


-- Used to determine a biome's name.
local BiomeName = function(a_t_coordinates)
   local t_BiomeData =   minetest.get_biome_data(a_t_coordinates)
   local s_BiomeName = minetest.get_biome_name(t_BiomeData.biome)

   return s_BiomeName
end


-- Used to determine wheter if a dungeon should be ignored, that is, not using
-- default:cobble, default:mossycobble, stairs:stair_cobble and
-- stairs:stair_mossycobble.
local IgnoreDungeon = function(a_s_biome_name)
   local b_IgnoreDungeon = false
   local t_IgnoredBiomes = {
      'desert',
      'desert_ocean',
      'icesheet',
      'icesheet_ocean',
      'icesheet_under',
      'sandstone_desert',
      'sandstone_desert_ocean'
   }

   for i_Element = 1, #t_IgnoredBiomes do
      if (b_IgnoreDungeon == false) then
         if (a_s_biome_name == t_IgnoredBiomes[i_Element]) then
            b_IgnoreDungeon = true
         end
      end
   end

   return b_IgnoreDungeon
end


-- Used to replace a node at a given position.
local NodeReplacer = function(a_t_coordinates, a_s_replacer)
   minetest.set_node(a_t_coordinates, {name = a_s_replacer})
end


-- Used to replace a node at a given position.
-- Allows to keep the former node's metadata, for example a stair's rotation.
local VoxelManipulator = function(a_t_coordinates, a_s_replacer)
   local VoxelManip = minetest.get_voxel_manip(a_t_coordinates,
      a_t_coordinates)

   local Data = VoxelManip:get_node_at(a_t_coordinates)
   Data.name = a_s_replacer

   VoxelManip:set_node_at(a_t_coordinates, Data)
   VoxelManip:write_to_map()
end


-- Used to determine if a node belongs to the floor, a wall or to the ceiling
local NodeType = function(a_t_node_coordinates)
   local t_NodeCoordinates = a_t_node_coordinates
   local t_NodeAboveCoordinates = {
      z = t_NodeCoordinates.z,
      y = (t_NodeCoordinates.y + 1),
      x = t_NodeCoordinates.x
   }
   local t_NodeBelowCoordinates = {
      z = t_NodeCoordinates.z,
      y = (t_NodeCoordinates.y - 1),
      x = t_NodeCoordinates.x
   }
   local t_NorthernNodeCoordinates = {
      z = (t_NodeCoordinates.z + 1),
      y = t_NodeCoordinates.y,
      x = t_NodeCoordinates.x
   }
   local t_EasternNodeCoordinates = {
      z = t_NodeCoordinates.z,
      y = t_NodeCoordinates.y,
      x = (t_NodeCoordinates.x + 1)
   }
   local t_SouthernNodeCoordinates = {
      z = (t_NodeCoordinates.z - 1),
      y = t_NodeCoordinates.y,
      x = t_NodeCoordinates.x
   }
   local t_WesternNodeCoordinates = {
      z = t_NodeCoordinates.z,
      y = t_NodeCoordinates.y,
      x = (t_NodeCoordinates.x - 1)
   }
   local s_NorthernNodeName =
      minetest.get_node(t_NorthernNodeCoordinates).name

   local s_EasternNodeName =
      minetest.get_node(t_EasternNodeCoordinates).name

   local s_SouthernNodeName =
      minetest.get_node(t_SouthernNodeCoordinates).name

   local s_WesternNodeName =
      minetest.get_node(t_WesternNodeCoordinates).name

   local s_NodeAboveName =   minetest.get_node(t_NodeAboveCoordinates).name
   local s_NodeBelowName =   minetest.get_node(t_NodeBelowCoordinates).name
   local s_NorthernNodeName =
      minetest.get_node(t_NorthernNodeCoordinates).name

   local s_EasternNodeName =
      minetest.get_node(t_EasternNodeCoordinates).name

   local s_SouthernNodeName =
      minetest.get_node(t_SouthernNodeCoordinates).name

   local s_WesternNodeName =
      minetest.get_node(t_WesternNodeCoordinates).name
   local s_NodeType = nil


   -- Flush the coordinates tables for memory saving.
   t_NodeAboveCoordinates = nil
   t_NodeBelowCoordinates = nil
   t_NorthernNodeCoordinates = nil
   t_EasternNodeCoordinates = nil
   t_SouthernNodeCoordinates = nil
   t_WesternNodeCoordinates = nil


   -- Determine the node type.
   if (ToBeIgnored(s_NodeAboveName) == true)
   and (ToBeIgnored(s_NodeBelowName) == false)
   and (ToBeIgnored(s_NorthernNodeName) == false)
   and (ToBeIgnored(s_EasternNodeName) == false)
   and (ToBeIgnored(s_SouthernNodeName) == false)
   and (ToBeIgnored(s_WesternNodeName) == false)
   then
      s_NodeType = 'floor'

   -- If the node is part of a wall, or a column.
   elseif (ToBeIgnored(s_NodeAboveName) == false)
   and (ToBeIgnored(s_NodeBelowName) == false)
   then
      -- Air on two opposite sides.
      -- Case number 1
      if (
         (ToBeIgnored(s_NorthernNodeName) == true)
         and
         (ToBeIgnored(s_SouthernNodeName) == true)
      )
      and (
         (ToBeIgnored(s_EasternNodeName) == false)
         and
         (ToBeIgnored(s_WesternNodeName) == false)
      )

      -- Case number 2
      or (
         (ToBeIgnored(s_EasternNodeName) == true)
         and
         (ToBeIgnored(s_WesternNodeName) == true)
      )
      and (
         (ToBeIgnored(s_NorthernNodeName) == false)
         and
         (ToBeIgnored(s_SouthernNodeName) == false)
      )

      -- Air on threee sides.
      -- Case number 1
      or (
         (ToBeIgnored(s_NorthernNodeName) == true)
         and
         (ToBeIgnored(s_SouthernNodeName) == true)
      )
      and (
         (ToBeIgnored(s_EasternNodeName) == true)
         and
         (ToBeIgnored(s_WesternNodeName) == false)
      )

      -- Case number 2
      or (
         (ToBeIgnored(s_NorthernNodeName) == true)
         and
         (ToBeIgnored(s_SouthernNodeName) == true)
      )
      and (
         (ToBeIgnored(s_EasternNodeName) == false)
         and
         (ToBeIgnored(s_WesternNodeName) == true)
      )

      -- Case number 3
      or (
         (ToBeIgnored(s_EasternNodeName) == true)
         and
         (ToBeIgnored(s_WesternNodeName) == true)
      )
      and (
         (ToBeIgnored(s_NorthernNodeName) == true)
         and
         (ToBeIgnored(s_SouthernNodeName) == false)
      )

      -- Case number 4
      or (
         (ToBeIgnored(s_EasternNodeName) == true)
         and
         (ToBeIgnored(s_WesternNodeName) == true)
      )
      and (
         (ToBeIgnored(s_NorthernNodeName) == false)
         and
         (ToBeIgnored(s_SouthernNodeName) == true)
      )

      then
         s_NodeType = 'inner_wall'

      -- Air on four sides.
      elseif (
            (ToBeIgnored(s_NorthernNodeName) == true)
            and
            (ToBeIgnored(s_EasternNodeName) == true)
            and
            (ToBeIgnored(s_SouthernNodeName) == true)
            and
            (ToBeIgnored(s_WesternNodeName) == true)
      )
      then
         s_NodeType = 'column'

      else
         s_NodeType = 'wall'

      end

   elseif (ToBeIgnored(s_NodeBelowName) == true) then
      s_NodeType = 'ceiling'

   end

   return s_NodeType
end


-- Used to choose a random nodes' set from the default ones.
local RandomDungeonSet = function()
   local i_RandomNumber = math.random(1, 6)

   if (i_RandomNumber == 1) then
      s_DungeonWall = 'default:stonebrick'
      s_DungeonInnerWall = 'default:stonebrick'
      s_DungeonColumn = 'default:stonebrick'
      s_DungeonStair = 'stairs:stair_stonebrick'
      s_DungeonFloor = 'default:stone'
      s_DungeonCeiling = 'default:stone_block'

   elseif (i_RandomNumber == 2) then
      s_DungeonWall = 'default:desert_stonebrick'
      s_DungeonInnerWall = 'default:desert_stonebrick'
      s_DungeonColumn = 'default:desert_stonebrick'
      s_DungeonStair = 'stairs:stair_desert_stonebrick'
      s_DungeonFloor = 'default:desert_stone'
      s_DungeonCeiling = 'default:desert_stone_block'

   elseif (i_RandomNumber == 3) then
      s_DungeonWall = 'default:sandstonebrick'
      s_DungeonInnerWall = 'default:sandstonebrick'
      s_DungeonColumn = 'default:sandstonebrick'
      s_DungeonStair = 'stairs:stair_sandstonebrick'
      s_DungeonFloor = 'default:sandstone'
      s_DungeonCeiling = 'default:sandstone_block'

   elseif (i_RandomNumber == 4) then
      s_DungeonWall = 'default:desert_sandstone_brick'
      s_DungeonInnerWall = 'default:desert_sandstone_brick'
      s_DungeonColumn = 'default:desert_sandstone_brick'
      s_DungeonStair = 'stairs:stair_desert_sandstone_brick'
      s_DungeonFloor = 'default:desert_sandstone'
      s_DungeonCeiling = 'default:desert_sandstone_block'

   elseif (i_RandomNumber == 5) then
      s_DungeonWall = 'default:silver_sandstone_brick'
      s_DungeonInnerWall = 'default:silver_sandstone_brick'
      s_DungeonColumn = 'default:silver_sandstone_brick'
      s_DungeonStair = 'stairs:stair_silver_sandstone_brick'
      s_DungeonFloor = 'default:silver_sandstone'
      s_DungeonCeiling = 'default:silver_sandstone_block'

   elseif (i_RandomNumber == 6) then
      s_DungeonWall = 'default:obsidianbrick'
      s_DungeonInnerWall = 'default:obsidianbrick'
      s_DungeonColumn = 'default:obsidianbrick'
      s_DungeonStair = 'stairs:stair_obsidianbrick'
      s_DungeonFloor = 'default:obsidian'
      s_DungeonCeiling = 'default:obsidian_block'

   end
end


-- Used to select a default dungeon set depending on the biome.
local BiomeDungeonSet = function(a_s_biome_name)
   if (a_s_biome_name == 'coniferous_forest')
   or (a_s_biome_name == 'coniferous_forest_dunes')
   or (a_s_biome_name == 'coniferous_forest_ocean')
   or (a_s_biome_name == 'coniferous_forest_under')
   or (a_s_biome_name == 'deciduous_forest')
   or (a_s_biome_name == 'deciduous_forest_shore')
   or (a_s_biome_name == 'deciduous_forest_ocean')
   or (a_s_biome_name == 'deciduous_forest_under')
   or (a_s_biome_name == 'grassland')
   or (a_s_biome_name == 'grassland_dunes')
   or (a_s_biome_name == 'grassland_ocean')
   or (a_s_biome_name == 'grassland_under')
   or (a_s_biome_name == 'rainforest')
   or (a_s_biome_name == 'rainforest_swamp')
   or (a_s_biome_name == 'rainforest_ocean')
   or (a_s_biome_name == 'rainforest_under')
   or (a_s_biome_name == 'savanna')
   or (a_s_biome_name == 'savanna_shore')
   or (a_s_biome_name == 'savanna_ocean')
   or (a_s_biome_name == 'savanna_under')
   or (a_s_biome_name == 'snowy_grassland')
   or (a_s_biome_name == 'snowy_grassland_ocean')
   or (a_s_biome_name == 'snowy_grassland_under')
   or (a_s_biome_name == 'taiga')
   or (a_s_biome_name == 'taiga_ocean')
   or (a_s_biome_name == 'taiga_under')
   or (a_s_biome_name == 'tundra')
   or (a_s_biome_name == 'tundra_highland')
   or (a_s_biome_name == 'tundra_beach')
   or (a_s_biome_name == 'tundra_ocean')
   or (a_s_biome_name == 'tundra_under')
   then
      s_DungeonWall = 'default:stonebrick'
      s_DungeonInnerWall = 'default:stonebrick'
      s_DungeonColumn = 'default:stonebrick'
      s_DungeonStair = 'stairs:stair_stonebrick'
      s_DungeonFloor = 'default:stone'
      s_DungeonCeiling = 'default:stone_block'

   elseif (a_s_biome_name == 'desert_under') then
      local i_RandomNumber = math.random(0, 1)

      if (i_RandomNumber == 0) then
         s_DungeonWall = 'default:desert_stonebrick'
         s_DungeonInnerWall = 'default:desert_stonebrick'
         s_DungeonColumn = 'default:desert_stonebrick'
         s_DungeonStair = 'stairs:stair_desert_stonebrick'
         s_DungeonFloor = 'default:desert_stone'
         s_DungeonCeiling = 'default:desert_stone_block'

      else
         s_DungeonWall = 'default:desert_sandstone_brick'
         s_DungeonInnerWall = 'default:desert_sandstone_brick'
         s_DungeonColumn = 'default:desert_sandstone_brick'
         s_DungeonStair = 'stairs:stair_desert_sandstone_brick'
         s_DungeonFloor = 'default:desert_sandstone'
         s_DungeonCeiling = 'default:desert_sandstone_block'

      end

   elseif (a_s_biome_name == 'sandstone_desert_under')   then
      s_DungeonWall = 'default:sandstonebrick'
      s_DungeonInnerWall = 'default:sandstonebrick'
      s_DungeonColumn = 'default:sandstonebrick'
      s_DungeonStair = 'stairs:stair_sandstonebrick'
      s_DungeonFloor = 'default:sandstone'
      s_DungeonCeiling = 'default:sandstone_block'

   elseif (a_s_biome_name == 'cold_desert')
   or (a_s_biome_name == 'cold_desert_ocean')
   or (a_s_biome_name == 'cold_desert_under')
   then
      local i_RandomNumber = math.random(0, 1)

      if (i_RandomNumber == 0) then
         s_DungeonWall = 'default:stonebrick'
         s_DungeonInnerWall = 'default:stonebrick'
         s_DungeonColumn = 'default:stonebrick'
         s_DungeonStair = 'stairs:stair_stonebrick'
         s_DungeonFloor = 'default:stone'
         s_DungeonCeiling = 'default:stone_block'

      else
         s_DungeonWall = 'default:silver_sandstone_brick'
         s_DungeonInnerWall = 'default:silver_sandstone_brick'
         s_DungeonColumn = 'default:silver_sandstone_brick'
         s_DungeonStair = 'stairs:stair_silver_sandstone_brick'
         s_DungeonFloor = 'default:silver_sandstone'
         s_DungeonCeiling = 'default:silver_sandstone_block'

      end
   end
end


local DungeonModifier = function(a_t_dungeon_coordinates)
   local t_DungeonCoordinates = a_t_dungeon_coordinates

   -- Scan the area for the nodes to be replaced.
   for i_Element = 1, #t_DungeonCoordinates.dungeon do
      local s_NodeName = ''
      local t_CoordinatesCenter = t_DungeonCoordinates.dungeon[i_Element]
      local t_NodeCoordinates = {z = 0.0, y = 0.0, x = 0.0}

      if (b_DungeonNotify == true) then
         NodeReplacer(t_CoordinatesCenter, 'default:mese_post_light')
      end

      for i_Value = -i_MaxOffset, i_MaxOffset do
         t_NodeCoordinates.z = (t_CoordinatesCenter.z + i_Value)

         for i_Value = -i_MaxOffset, i_MaxOffset do
            t_NodeCoordinates.y = (t_CoordinatesCenter.y + i_Value)

            for i_Value = -i_MaxOffset, i_MaxOffset do
               t_NodeCoordinates.x = (t_CoordinatesCenter.x + i_Value)

               local s_NodeName =
                  minetest.get_node(t_NodeCoordinates).name

               -- If there's a match, substitute the node.
               if (s_NodeName == s_COBBLE)
               or (s_NodeName == s_COBBLE_MOSSY)
               then
                  local s_NodeType = NodeType(t_NodeCoordinates)

                  if (s_NodeType == 'floor')
                  and (b_ChangeFloor == true)
                  then
                     if (b_UseVoxelManipulator == true) then
                        VoxelManipulator(t_NodeCoordinates,
                           s_DungeonFloor)

                     else
                        NodeReplacer(t_NodeCoordinates,   s_DungeonFloor)

                     end

                  elseif (s_NodeType == 'wall') then
                     if (b_UseVoxelManipulator == true) then
                        VoxelManipulator(t_NodeCoordinates,
                           s_DungeonWall)

                     else
                        NodeReplacer(t_NodeCoordinates,   s_DungeonWall)

                     end

                  elseif (s_NodeType == 'inner_wall') then
                     if (b_UseVoxelManipulator == true) then
                        VoxelManipulator(t_NodeCoordinates,
                           s_DungeonInnerWall)

                     else
                        NodeReplacer(t_NodeCoordinates,
                           s_DungeonInnerWall)

                     end

                  elseif (s_NodeType == 'column') then
                     if (b_UseVoxelManipulator == true) then
                        VoxelManipulator(t_NodeCoordinates,
                           s_DungeonColumn)

                     else
                        NodeReplacer(t_NodeCoordinates,   s_DungeonColumn)

                     end

                  elseif (s_NodeType == 'ceiling') then
                     if (b_UseVoxelManipulator == true) then
                        VoxelManipulator(t_NodeCoordinates,
                           s_DungeonCeiling)

                     else
                        NodeReplacer(t_NodeCoordinates,
                           s_DungeonCeiling)

                     end
                  end
               end

               -- If there's a match, substitute the stair node.
               if (s_NodeName == s_STAIR_COBBLE)
               or (s_NodeName == s_STAIR_COBBLE_MOSSY)
               then
                  VoxelManipulator(t_NodeCoordinates, s_DungeonStair)
               end
            end
         end
      end
   end
end


--
-- Map manipulator
--

minetest.set_gen_notify('dungeon')

minetest.register_on_generated(function(minp, maxp, blockseed)
   local t_DungeonCoordinates = minetest.get_mapgen_object('gennotify')

   -- If the table is not empty
   if (t_DungeonCoordinates.dungeon) then
      local s_BiomeName = BiomeName(t_DungeonCoordinates.dungeon[1])

      if (b_DungeonNotify == true) then
         local s_Message = 'Dungeon: ' ..
            minetest.pos_to_string(t_DungeonCoordinates.dungeon[1])

         minetest.chat_send_all(s_Message)
      end

      if (IgnoreDungeon(s_BiomeName) == false) then
         if (b_RandomDungeonSet == true) then
            RandomDungeonSet()

         else
            BiomeDungeonSet(s_BiomeName)

         end

         minetest.after(f_ReplacementDelay, function()
            DungeonModifier(t_DungeonCoordinates)
         end)
      end
   end
end)


--
-- Minetest engine debug logging
--

if (s_LogLevel == nil)
or (s_LogLevel == 'action')
or (s_LogLevel == 'info')
or (s_LogLevel == 'verbose')
then
   s_LogLevel = nil
   minetest.log('action', '[Mod] Stonebrick Dungeons [v0.4.0-dev] loaded.')
end

Attachments
dungeon2.png
(356.22 KiB) Not downloaded yet
 

User avatar
Linuxdirk
Member
 
Posts: 2426
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk
 

User avatar
paramat
Developer
 
Posts: 3580
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod] Stonebrick Dungeons [0.3.0] [stonebrick_dungeons]

by paramat » Fri Mar 06, 2020 23:28

Linuxdirk wrote:Also: It is not about me, it is about the 901 issues and about the 144 pull requests that are open and no-one is assigned to for Minetest alone.

Issues and PRs are rarely assigned to particular people, it makes no sense to usually do that as many core devs are able to work on or review various aspects of Minetest.
Assignment greatly reduces the chance of all other core devs attending to that issue or PR.
A lack of assignment obviously does not mean they are being ignored, they are all read by at least 1 core dev and tags are usually added.
 

Previous

Return to Mod Releases



Who is online

Users browsing this forum: runs and 37 guests