[Server] Jungle

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

Glowing blocks available in circular saw

by tagada » Tue Apr 17, 2018 19:43

Hello all,

I've made an improvment to the mod caverealms. All the blocks now work with the mods
- moreblocks (circular saw)
- stairs
- columnia
and preserve their glowing and transparency.
I've tested it on my own solo world without issue.

screenshot :
scr_caverealms2csaw.png
(542.5 KiB) Not downloaded yet


Copy the code below in a file "subnodes.lua" and read the explanations provided in it.
Have fun :)

Code: Select all
--[[ this lua file was made by Tagada the April 16th 2018

   in the following comments I distinguish the mod "stairs" (with quotes)
   from the stair-shaped node stair (without quotes), as i write mods "names" with quotes.

   The goal is to register the full blocks provided by this mod in :
   1°) the circular saw ('c-saw') provided by the mod "moreblocks\stairsplus";
   2°) the mod "stairs" optionaly as fallback if moreblocks is not present;
   3°) the mod "columnia"
   
   Note that it is not possible to register all the blocks in the workbench from "xdecor" because
   "xdecor" have rules that exclude nodes with some fields (for example 'light_source') from
   being processed by the workbench.
   
   
   by this way we can obtain
   1°) slopes, microblocks, stairs and all sub-nodes by c-saw;
   2°) recipes for stairs and slabs from "stairs";
   3°) the columns blocks by "columnia";
   
   if those mods are installed of course ! (we test that first of all)   
   
   Why "stairs" and/or/not c-saw ?
   -------------------------------------------
      c-saw provide more subnodes than "stairs";
      c-saw preserve the name of the original mod while "stairs" do not.
            for example with stairs c-saw register "caverealm:stair_glow_crystal" while
               "stairs" register "stairs:stair_glow_crystal";
      c-saw preserve all the fields from the original blocks, like 'use_texture_alpha' for transparency;
      "stairs" do not preserve some fields like transparency, so we have to override the nodes created to preserve all the fields;
      
   so you may want to register -or not- with c-saw and/or "stairs" (optionaly as fallback) : see below

   
   
   WHAT YOU HAVE TO DO :
   =====================
   
   1°) Edit the depends.txt file of this mod and add (if they are not present) the lines :
   
      moreblocks?
      stairs?
      columnia?
      
   to be sure that those mods will be loaded prior to this one and then their registering functions can be call by us
   
   2°) Edit the init.lua of this mod "caverealms" and add the line :
   
      dofile(modpath.."/subnodes.lua")
      
   actualy at line n°19, just after the existing line :
      dofile(modpath.."/abms.lua") --abm definitions
      
   Our "dofile()" will make this subnodes.lua processed
   
   3°) copy this file subnodes.lua in the directory of the mod "caverealms"
   
   
   License: as this mod, code WTFPL (the only work i've done is to call the registering functions of
   the mods moreblocks-circular saw, stairs and columnia)
   Have fun :)   
   contact : tagacraft@free.fr
]]

--[[ the folowing booleans behave to register :
   1°) first with c-saw;
   2°) if c-saw is not present, with "stairs" as fallback;
   3°) not with "stairs", no matter if c-saw was called or not;
   4°) with "columnia"

]]
local allow_c_saw = true      -- register with circular saw;
local fallback_to_stairs = true  -- with "stairs" only if "moreblocks" is not installed
local also_stairs = false        -- register with "stairs" even if registered with circular saw
local allow_columnia = true      -- register with "columnia"

local c_saw_installed = false
local stairs_installed = false
local columnia_installed = false

if minetest.get_modpath("moreblocks") then
   c_saw_installed = true
end

if minetest.get_modpath("stairs") then
   stairs_installed = true
end

if minetest.get_modpath("columnia") then
   columnia_installed = true
end

-- construct the list of the nodes to register in "moreblocks", "stairs" and "columnia" :
local nodes2register = {
   "glow_crystal",
   "glow_emerald",
   "glow_mese",
   "glow_ruby",
   "glow_amethyst",
   "glow_ore",
   "glow_emerald_ore",
   "glow_ruby_ore",
   "glow_amethyst_ore",
   "thin_ice",
   "salt_crystal",
   "stone_with_salt",
   "hot_cobble",
   "glow_obsidian",
   "glow_obsidian_2",
   "coal_dust",
   "mushroom_stem",
   "mushroom_cap",
}

if c_saw_installed and allow_c_saw then
   -- ==================================================
   -- Registering for 'circular saw' from "moreblocks" :

   --[[ for memory, the function in moreblocks/stairsplus/init.lua is :
      function stairsplus:register_all(modname, subname, recipeitem, fields)
   ]]
   local node_name=""
   for i,v in ipairs(nodes2register) do
      node_name = "caverealms:"..v
      stairsplus:register_all("caverealms", v, node_name,   minetest.registered_nodes[node_name])
      table.insert(circular_saw.known_stairs, node_name)
   end   
end

if stairs_installed and (also_stairs or ( not c_saw_installed and fallback_to_stairs)) then
--[[
   for memory the registering function from stairs/init.lua is :
      function stairs.register_stair_and_slab(subname, recipeitem,
            groups, images, desc_stair, desc_slab, sounds)
         stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
         stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
      end
   And nodes will be called stairs:{stair,slab}_<subname> example : stairs:stair_glow_crystal
]]

--function to override "stairs" registered nodes to preserve fields not taken in account by "stairs" :
   local function override_stairs(generic_name, main_node)
      local fields_to_add = {}
      local name_prefix = "stairs:"
      local name_mids = {"stair_","slab_"}
      local node_name = ""   
      -- retrieve all the fields from the main node :
      for k,v in pairs(minetest.registered_nodes[main_node]) do
         -- keep all the field that are not functions because we look only for fields like "light_source", "use_texture_alpha", etc.
         if type(v)~="function" then fields_to_add[k] = v end
      end
      
      for key, value in pairs(name_mids) do -- construct the sub_nodes names to override (slab, stair)
         node_name = name_prefix..value..generic_name -- example: stairs:stair_glow_crystal
         local node = {}
         for k,v in pairs(minetest.registered_nodes[node_name]) do node[k] = v end -- clone the node created by "stairs";
         for k2add, v2add in pairs(fields_to_add) do
            if not node[k2add] then node[k2add] = v2add end-- add fields/values from fields_to_add if they not yet exist;
         end   
         node_name = ":"..node_name
         minetest.register_node(node_name, node) -- override node
      end      
   end

   local node_name_short= ""
   local node_name_full = ""
   local groups={}
   local images={}
   local desc=""
   local desc_slab=""
   local desc_stair=""
   local sounds={}
   
   for i,v in ipairs(nodes2register) do
      node_name_short = v
      node_name_full = "caverealms:"..node_name_short
      groups = minetest.registered_nodes[node_name_full].groups
      images = minetest.registered_nodes[node_name_full].tiles
      desc =  minetest.registered_nodes[node_name_full].description
      desc_stair = desc.." stair"
      desc_slab = desc.." slab"
      sounds =  minetest.registered_nodes[node_name_full].sounds
      
      stairs.register_stair_and_slab(node_name_short, node_name_full,   groups, images, desc_stair, desc_slab, sounds)
      override_stairs(node_name_short, node_name_full)    
   end

end


-- ================================
-- Registering for 'columnia' mod :

if columnia_installed and allow_columnia then

--function to override "columnia" registered nodes to preserve fields not taken in account by "columnia" :
   local function override_column(generic_name, main_node)
   -- for example generic_name = "glow_crystal" and main_node = "caverealms:glow_crystal"
      local fields_to_add = {}
      local name_prefix = "columnia:column_"
      local name_mids = {"mid_","bottom_","top_","crosslink_","link_","linkdown_"}
      local node_name = ""      
      
      -- retrieve all the fields from the main node :
      for k,v in pairs(minetest.registered_nodes[main_node]) do
         -- keep all the field that are not functions because we look only for fields like "light_source", "use_texture_alpha", etc.
         if type(v)~="function" then fields_to_add[k] = v end
      end

      for key, value in pairs(name_mids) do -- construct each node name to override
         node_name = name_prefix..value..generic_name -- example: columnia:column_mid_glow_crystal
         local node = {}
         for k,v in pairs(minetest.registered_nodes[node_name]) do node[k] = v end -- clone the node created by "columnia";
         for k2add, v2add in pairs(fields_to_add) do
            if not node[k2add] then node[k2add] = v2add end -- add fields/values from fields_to_add if they not yet exist;
         end   
         node_name = ":"..node_name
         minetest.register_node(node_name, node) -- override node
      end      
   end

   local node_name_short=""
   local node_name_full=""
   local groups={}
   local images={}
   local desc=""
   
   for i,v in ipairs(nodes2register) do
      node_name_short = v
      node_name_full = "caverealms:"..v
      groups = minetest.registered_nodes[node_name_full].groups
      images = minetest.registered_nodes[node_name_full].tiles
      desc =  minetest.registered_nodes[node_name_full].description
      sounds =  minetest.registered_nodes[node_name_full].sounds
   
      columnia.register_column_ia(node_name_short, node_name_full,
         groups, images,
         desc.." Column",
         desc.." Column Top",
         desc.." Column Bottom",
         desc.." Column Crosslink",
         desc.." Column Link",
         desc.." Column Linkdown",
         sounds)
      -- override nodes to add some missing fields :
      override_column(node_name_short, node_name_full)      
   end   
end

contact: tagacraft at free dot fr
 

Gundul
Member
 
Posts: 316
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: Glowing blocks available in circular saw

by Gundul » Wed Apr 18, 2018 17:17

tagada wrote:Hello all,

I've made an improvment to the mod caverealms. All the blocks now work with the mods
- moreblocks (circular saw)
- stairs
- columnia


Thank you Tagada, I just tried it out.

I can say it works for the circularsaw :) columnia I did not try so far.
I will make a repo on my github tomorrow.
 

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

Re: [Server] Jungle

by tagada » Thu Apr 19, 2018 06:12

cool.
I'm now working on a mod that provide an in-game tool to punch a node: then this node will be registered (if suitable) to be automaticaly registered with circular saw, stairs and columnia at the next server restart, no matter what mod it came from.
much more usefull : you see a block you would have the derivated slopes, stairs and others microblocks : just punch it and it will be available on next restart :)
of course i take a big care to options, checks, consequencies of mod uninstalling, etc.
I hope to finish it by a few days. Work in a good progress at this time.
 

Gundul
Member
 
Posts: 316
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: [Server] Jungle

by Gundul » Thu Apr 19, 2018 16:20

tagada wrote:cool.
I'm now working on a mod that provide an in-game tool to punch a node: then this node will be registered (if suitable) to be automaticaly registered with circular saw, stairs and columnia at the next server restart, no matter what mod it came from.
much more usefull : you see a block you would have the derivated slopes, stairs and others microblocks : just punch it and it will be available on next restart :)
of course i take a big care to options, checks, consequencies of mod uninstalling, etc.
I hope to finish it by a few days. Work in a good progress at this time.



That sounds interesting. We will check it out. Do you plan to use a new priv for the tool or only server priv owner
will be able to use it ?


Caverealm mod by Hero of the Winds with Tagada's additions:
Download: https://github.com/berengma/caverealms/archive/master.zip
Code: https://github.com/berengma/caverealms
 

Gundul
Member
 
Posts: 316
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: [Server] Jungle

by Gundul » Thu Apr 19, 2018 16:47

Server just restarted with Tagada's addition to the circular saw


happy mining

Gundul
 

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

Re: [Server] Jungle

by tagada » Thu Apr 19, 2018 19:09

at this time any player can punch a node;
to avoid server overload with click-spamming, each click show a formspec to summarize the checks executed and what you can obtain from what you have clicked, while the mod precalculated which blocks will be created.
Then the player can confirm or cancel the whole work to be done on next restart.
The mod is not intended at this time to restart the server automaticaly, it is to the Admin to do it.
Perhaps a right-click (with admin priv) to preview what is to be done, allow it or not, then force restart.
perhaps also an option to force the mod to wait for Admin's check before processing... if the admin is not too far too often, causing players to wait an unknown amout of time to benefit from the choiced new block :)
 

Gundul
Member
 
Posts: 316
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: [Server] Jungle

by Gundul » Fri Apr 20, 2018 16:19

tagada wrote:at this time any player can punch a node;
to avoid server overload with click-spamming, each click show a formspec to summarize the checks executed and what you can obtain from what you have clicked, while the mod precalculated which blocks will be created.
Then the player can confirm or cancel the whole work to be done on next restart.


I would suggest to only made it available with a special priv. You will burden a lot of work to admins, specialy on servers with usually more players online than I have. Admins have to filter out which clicks have been serious and which requests have been just fake or not knowing what he is doing.
With a priv I can give the possibility to players I already trust, or if I am a lazy admin I can just make the priv available to each new player who joins in.
 

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

Re: [Server] Jungle

by tagada » Sun Apr 22, 2018 03:50

If i understand well, as admin you expect to can designate, trought special priv, some player to allow the work to be done on next restart, or with some option to automatically do the work asked.
Ok, I will do that.
Perhaps i had not been suficiently accurate :
At this step of my work, if the player punch a node that is not suitable to be registered by circular saw, stairs or columnia, the player is warned by a formspec that explain the reason why the node is not suitable : not a node, an entity, a mesh, already registered, forbidden block (for example, you arbitrary decide that nyancat is specialy exclude from being processed just because you are the admin and you decide to put this block in forbidden list while it is technicaly possible) etc.
So the admin (or a special privilegied player) is not informed about nothing as there is nothing to be done.
pictures of that :
nothing_to_do_already.png
already registered
(38.07 KiB) Not downloaded yet

nothing_to_do_mesh.png
a mesh is clicked...
(39.38 KiB) Not downloaded yet

On the other way, if the block punched pass the exam of rules, the player is warned with a form that summarize what should be done (with the option of approval from acredited player) so the player can confirm (or cancel) that he realy want to ask (not to do) for that work to be done.
register4_2mods.png
processable block
(28.69 KiB) Not downloaded yet


As i progress, i discover a very big amount of possibilities that grow a simple mod to a great big project (if i done it, it will be my first mod in any game) so i'd better stay simple : i think to make a first version with basic behaviours, then perhaps think to a next version with more accurate possibilities.

So for this time i keep in mind that server's admin will be glad to
- decide if yes or not a certain block technicaly proccessable into stairs, slope, etc will be proccessed or not;
- decide to delegate this responsability to a specialy acredited player or to automate the process;

For the moment I must make a break for few days in programming, so the work is in stand by probably for a week... (nothing bad, just IRL :) )
glad to have admin's point of view.
thanks.
 

Gundul
Member
 
Posts: 316
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: [Server] Jungle

by Gundul » Sun Apr 22, 2018 06:09

tagada wrote:If i understand well, as admin you expect to can designate, trought special priv, some player to allow the work to be done on next restart, or with some option to automatically do the work asked.
Ok, I will do that.

Not exactly :)
You said you made a tool with which you can punch nodes to add to circular saw.
I would suggest that the tool is only useable if you own a special priv. For people without
that priv the tool does not even exists.

tagada wrote:Perhaps i had not been suficiently accurate :

I understood your plans with the formspec :)

tagada wrote:
So for this time i keep in mind that server's admin will be glad to
- decide if yes or not a certain block technicaly proccessable into stairs, slope, etc will be proccessed or not;
- decide to delegate this responsability to a specialy acredited player or to automate the process;

For the moment I must make a break for few days in programming, so the work is in stand by probably for a week... (nothing bad, just IRL :) )
glad to have admin's point of view.
thanks.

No hurry, take your time :)
Are you owning a github account ?
 

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

Re: [Server] Jungle

by tagada » Sun Apr 22, 2018 11:34

ok. tool accessible/useable only with special priv.
no personal github account yet.
as i don't have in mind to develop other mods, i will think about that when time will be up for that
 

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

Re: [Server] Jungle

by tagada » Tue Apr 24, 2018 22:42

Last edited by tagada on Wed Apr 25, 2018 10:22, edited 1 time in total.
 

User avatar
Pyrollo
Member
 
Posts: 42
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: [Server] Jungle

by Pyrollo » Wed Apr 25, 2018 08:00

Tagada, you should open a specific topic for your mod development in WIP Mods.

This current topic is about Jungle Server.
 

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

Re: [Server] Jungle

by tagada » Wed Apr 25, 2018 09:41

Hello Pyrollo,
You are right, sorry. I will open a WIP topic about my work.
Thanks for your judicious remark.

edit :
new topic at :
https://forum.minetest.net/viewtopic.php?f=9&t=20018&p=317226#p317226
Last edited by tagada on Wed Apr 25, 2018 10:26, edited 1 time in total.
 

User avatar
Pyrollo
Member
 
Posts: 42
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: [Server] Jungle

by Pyrollo » Wed Apr 25, 2018 09:43

This will be much better for people interrested in your mod and to get feedback about it :)
 

Gundul
Member
 
Posts: 316
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

Re: [Server] Jungle

by Gundul » Wed Apr 25, 2018 16:35

Pyrollo wrote:This will be much better for people interrested in your mod and to get feedback about it :)



Yes that is a very good idea. I am sure many people will be interested and it will get lots of feedback there.
 

Previous

Return to Servers



Who is online

Users browsing this forum: No registered users and 5 guests

cron