[Mod] Quartz [1.0] [quartz]

tagada
Member
 
Posts: 14
Joined: Wed Feb 21, 2018 17:09
In-game: tagada

Quartz mod register columns in colmnia mod

by tagada » Fri Feb 23, 2018 01:46

Hello,

this new release provide columns by registering quartz blocs through the mod columnia (if present) :

Add the line "columnia?" into the depends.txt file of quartz mod ;

replace the content of init.lua file of the mod quartz with the following :

============= New init.lua file : ==============
Code: Select all
--[[
   Patched by Tagada on 2018 february 21th :
   
   - solved conflict names between stairs, stairsplus and the recipes of quartz mod :
         all the names 'block', 'chiseled' and 'pillar' became 'quartzblock', 'quartzchiseled' and 'quartzpillar';
   - stairsplus is called first (if installed and enabled in settings.txt) and
   - stairs is called as fallback if stairsplus is not called;
   
   then with stairsplus :
      - all the names will be 'quartz:The_Name_Of_The_Block';
      - all the stairs, slabs, microblocks, slopes and panels are available using the circular saw;
      - all precedents (micro)blocks are NOT visible in the creative inventory unless you modify the
         moreblocks\config.lua (at the last line) to set :
                  setting("bool", "stairsplus_in_creative_inventory", true)
               (it is set to false by default)
         note that if you do that, you will see in the creative inventory ALL the possible microblocks
         from all the nodes (not only this mod): this might represent a lot of pages for your inventory.
         
   And with stairs as fallback (if you disable stairsplus in settings.txt or if moreblocks isn't installed) :
      - all the names will be 'stairs:The_Name_Of_The_Block' ('stairs', not 'quartz');
      - only blocks, stairs and slabs are available and visible in creative inventory;
      - circular saw will reject the quartz blocks so you can't use it with quartz blocks;
      - some panels and microblocks stay available using the workbench (xdecor mod)
   
   - stairs and slabs added or fixed for chiseled and pillar
   
   02, 23rd, 2018 :
   - integration of columnia mod if present :
    /\
   /! \  be sure to insert a line 'columnia?' in the quartz\depends.txt file !
      
]]
local settings = Settings(minetest.get_modpath("quartz").."/settings.txt")

-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")

--
--  Item Registration
--

--  Quartz Crystal
minetest.register_craftitem("quartz:quartz_crystal", {
   description = S("Quartz Crystal"),
   inventory_image = "quartz_crystal_full.png",
})
minetest.register_craftitem("quartz:quartz_crystal_piece", {
   description = S("Quartz Crystal Piece"),
   inventory_image = "quartz_crystal_piece.png",
})

--
-- Node Registration
--

--  Ore
minetest.register_node("quartz:quartz_ore", {
   description = S("Quartz Ore"),
   tiles = {"default_stone.png^quartz_ore.png"},
   groups = {cracky=3, stone=1},
   drop = 'quartz:quartz_crystal',
   sounds = default.node_sound_stone_defaults(),
})

minetest.register_ore({
   ore_type = "scatter",
   ore = "quartz:quartz_ore",
   wherein = "default:stone",
   clust_scarcity = 10*10*10,
   clust_num_ores = 6,
   clust_size = 5,
   y_min = -31000,
   y_max = -5,
})

-- Quartz Block
minetest.register_node("quartz:quartzblock", {
   description = S("Quartz Block"),
   tiles = {"quartz_block.png"},
   groups = {cracky=3, oddly_breakable_by_hand=1},
   sounds = default.node_sound_glass_defaults(),
})

-- Chiseled Quartz
minetest.register_node("quartz:quartzchiseled", {
   description = S("Chiseled Quartz"),
   tiles = {"quartz_chiseled.png"},
   groups = {cracky=3, oddly_breakable_by_hand=1},
   sounds = default.node_sound_glass_defaults(),
})

-- Quartz Pillar
minetest.register_node("quartz:quartzpillar", {
   description = S("Quartz Pillar"),
   paramtype2 = "facedir",
   tiles = {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"},
   groups = {cracky=3, oddly_breakable_by_hand=1},
   sounds = default.node_sound_glass_defaults(),
   on_place = minetest.rotate_node
})

--
-- If stairsplus mod is installed and enabled (see: quartz\settings.txt) then
--    register slabs, stairs and others microblocks with stairsplus which is better than stairs because it use
--    microblocks and slopes with circular saw;
--    note : if you want to see stairs, slabs but also microblocs and slopes in creative inventory (like for crafting guide),
--             then you must modify the last line of moreblocks\config.lua to setting( ... true) !
-- if not enabled, fall back to register with stairs
--

if minetest.get_modpath("moreblocks") and settings:get_bool("ENABLE_STAIRSPLUS") then
   register_stair_slab_panel_micro("quartz", "quartzblock", "quartz:quartzblock",
      {cracky=3},
      {"quartz_block.png"},
      "Quartz Block",
      "quartzblock",
      0
   )

   register_stair_slab_panel_micro("quartz", "quartzchiseled", "quartz:quartzchiseled",
      {cracky=3},
      {"quartz_chiseled.png"},
      "Chiseled Quartz",
      "quartzchiseled",
      0
   )

   register_stair_slab_panel_micro("quartz", "quartzpillar", "quartz:quartzpillar",
      {cracky=3},
      {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"},
      "Quartz Pillar",
      "quartzpillar",
      0
   )

   table.insert(circular_saw.known_stairs, "quartz:quartzblock")
   table.insert(circular_saw.known_stairs, "quartz:quartzchiseled")
   table.insert(circular_saw.known_stairs, "quartz:quartzpillar")
   
else

-- fall back to register slabs and stairs with stairs mod :
-- Stairs & Slabs
   stairs.register_stair_and_slab("quartzblock", "quartz:quartzblock",
      {cracky=3, oddly_breakable_by_hand=1},
      {"quartz_block.png"},
      S("Quartz stair"),
      S("Quartz slab"),
      default.node_sound_glass_defaults())

   stairs.register_stair_and_slab("quartzpillar", "quartz:quartzpillar",
      {cracky=3, oddly_breakable_by_hand=1},
      {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"},
      S("Quartz Pillar stair"),
      S("Quartz Pillar slab"),
      default.node_sound_glass_defaults())

   stairs.register_stair_and_slab("quartzchiseled", "quartz:quartzchiseled",
      {cracky=3, oddly_breakable_by_hand=1},
      {"quartz_chiseled.png"},
      S("Quartz Chiseled stair"),
      S("Quartz Chiseled slab"),
      default.node_sound_glass_defaults())


end



--
-- Crafting
--

-- Quartz Crystal Piece
minetest.register_craft({
   output = '"quartz:quartz_crystal_piece" 3',
   recipe = {
      {'quartz:quartz_crystal'}
   }
})

-- Quartz Block
minetest.register_craft({
   output = '"quartz:quartzblock" 4',
   recipe = {
      {'quartz:quartz_crystal', 'quartz:quartz_crystal', ''},
      {'quartz:quartz_crystal', 'quartz:quartz_crystal', ''},
      {'', '', ''}
   }
})

-- Chiseled Quartz
minetest.register_craft({
   output = 'quartz:quartzchiseled 2',
   recipe = {
      {'stairs:slab_quartzblock', '', ''},
      {'stairs:slab_quartzblock', '', ''},
      {'', '', ''},
   }
})

-- Chiseled Quartz (for stairsplus)
minetest.register_craft({
   output = 'quartz:quartzchiseled 2',
   recipe = {
      {'quartz:slab_quartzblock', '', ''},
      {'quartz:slab_quartzblock', '', ''},
      {'', '', ''},
   }
})

-- Quartz Pillar
minetest.register_craft({
   output = 'quartz:quartzpillar 2',
   recipe = {
      {'quartz:quartzblock', '', ''},
      {'quartz:quartzblock', '', ''},
      {'', '', ''},
   }
})

--
-- ABMS
--

local dirs2 = {12, 9, 18, 7, 12}

-- Replace all instances of the horizontal quartz pillar with the
minetest.register_abm({
   nodenames = {"quartz:pillar_horizontal"},
   interval = 1,
   chance = 1,
   action = function(pos, node, active_object_count, active_object_count_wider)
      local fdir = node.param2 or 0
         nfdir = dirs2[fdir+1]
      minetest.add_node(pos, {name = "quartz:quartzpillar", param2 = nfdir})
   end,
})

--
-- Deprecated
--

if settings:get_bool("ENABLE_HORIZONTAL_PILLAR") then
   -- Quartz Pillar (horizontal)
   minetest.register_node("quartz:pillar_horizontal", {
         description = "Quartz Pillar Horizontal",
         tiles = {"quartz_pillar_side.png", "quartz_pillar_side.png", "quartz_pillar_side.png^[transformR90",
         "quartz_pillar_side.png^[transformR90", "quartz_pillar_top.png", "quartz_pillar_top.png"},
         paramtype2 = "facedir",
         drop = 'quartz:quartzpillar',
         groups = {cracky=3, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
         sounds = default.node_sound_glass_defaults(),
   })
end

-- alias for compatibility with original names :
-- full blocks :
minetest.register_alias("quartz:block", "quartz:quartzblock")
minetest.register_alias("quartz:chiseled", "quartz:quartzchiseled")
minetest.register_alias("quartz:pillar", "quartz:quartzpillar")
-- slabs by stairs mod :
minetest.register_alias("stairs:slab_block", "stairs:slab_quartzblock")
minetest.register_alias("stairs:slab_pillar", "stairs:slab_quartzpillar")
minetest.register_alias("stairs:slab_quartzstair", "stairs:slab_quartzpillar")
-- stairs by stairs mod :
minetest.register_alias("stairs:stair_quartzstair", "stairs:stair_quartzpillar")


-- use benefit of 'columnia' mod if present, registering quartz blocks as columns :
if minetest.get_modpath("columnia") then

   columnia.register_column_ia("quartzblock", "quartz:quartzblock",
      {cracky=3, oddly_breakable_by_hand=1},
      {"quartz_block.png"},
      "Quartz Solid Column",
      "Quartz Solid Column Top",
      "Quartz Solid Column Bottom",
      "Quartz Solid Column Crosslink",
      "Quartz Solid Column Link",
      "Quartz Solid Column Linkdown",
      default.node_sound_glass_defaults())
      
   columnia.register_column_ia("quartzchiseled", "quartz:quartzchiseled",
      {cracky=3, oddly_breakable_by_hand=1},
      {"quartz_chiseled.png"},
      "Quartz Chiseled Column",
      "Quartz Chiseled Column Top",
      "Quartz Chiseled Column Bottom",
      "Quartz Chiseled Column Crosslink",
      "Quartz Chiseled Column Link",
      "Quartz Chiseled Column Linkdown",
      default.node_sound_glass_defaults())
      
   columnia.register_column_ia("quartzpillar", "quartz:quartzpillar",
      {cracky=3, oddly_breakable_by_hand=1},
      {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"},
      "Quartz Pillar Column",
      "Quartz Pillar Column Top",
      "Quartz Pillar Column Bottom",
      "Quartz Pillar Column Crosslink",
      "Quartz Pillar Column Link",
      "Quartz Pillar Column Linkdown",
      default.node_sound_glass_defaults())

end

============= End of file ===================
 

User avatar
Evil_Gabe
New member
 
Posts: 4
Joined: Tue Apr 24, 2018 06:34
Location: Finland
GitHub: thecow275
In-game: thecow275 - HermanFarman - Evil_Gabe

Re: [Mod] Quartz [1.0] [quartz]

by Evil_Gabe » Tue Apr 24, 2018 06:52

I will be removing quartz from my mod Electrica which can be found in Electrica_Github and making this a necessary dependency so that the mod i am developing wont be having items that other mods have already so ..yeah if all this is fine with you i will remove Quartz from my mod and give you full permission to use any Quartz textures from my mod if you want and make your mod a dependency for the mod to make it a lighter weight mod
-if you cant find the issue in your code rewrite the sphagetti you wrote
 

tagada
Member
 
Posts: 14
Joined: Wed Feb 21, 2018 17:09
In-game: tagada

Re: [Mod] Quartz [1.0] [quartz]

by tagada » Tue Apr 24, 2018 14:57

This is NOT my mod : i just made a patch, a subtile modification of the quartz/init.lua file to make it call (in a correct order) the registrations functions provided by the 3 others mods "moreblocks", "stairs", and "columnia".
with those modifications i made in init.lua file, the mod Quartz have it's blocks registered by:
1°) the circular saw from the mod "Moreblocks",
2°) the mod "Stairs" (whom come with the minetest's minimal game),
3°) the mod "Columnia";
if those mods are installed of course.
But i repeat, i haven't made any mod, just a few line in the existing Quartz mod.

That said, there is an entirely different world :
I'm actualy working on my really first mod, all from scratch, that intend to give the opportunity to a player to designate in-game any block the player can see and punch to be registered by the moreblocks's circular saw, stairs, columnia and eventually by any mod that provide sub-blocks from a full block (like stairs provide slab and stairs of stone from the full block of stone).
You can read news about that on the topic [server] Jungle at :
https://forum.minetest.net/viewtopic.php?f=10&t=13125&p=317006#p317006
have fun :)
 

User avatar
Evil_Gabe
New member
 
Posts: 4
Joined: Tue Apr 24, 2018 06:34
Location: Finland
GitHub: thecow275
In-game: thecow275 - HermanFarman - Evil_Gabe

Re: [Mod] Quartz [1.0] [quartz]

by Evil_Gabe » Wed Apr 25, 2018 05:30

That is nice to hear i like what you are doing keep the work up and it will be successfull :)
-if you cant find the issue in your code rewrite the sphagetti you wrote
 

Previous

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 13 guests