From 40eeaac2ecb25dbc55f7315342e74723d6248534 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sat, 30 Sep 2017 20:16:00 +0100 Subject: internal refactoring of flowable node registration in preparation for enhanced flow checking logic --- init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 470db2e..a64be4e 100644 --- a/init.lua +++ b/init.lua @@ -115,12 +115,16 @@ dofile(pipeworks.modpath.."/filter-injector.lua") dofile(pipeworks.modpath.."/trashcan.lua") dofile(pipeworks.modpath.."/wielder.lua") +-- note that pipes still don't appear until registered in the files below this one, so can still be turned off +dofile(pipeworks.modpath.."/flowable_node_registry.lua") + if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end --- individual enable flags also checked in register_flow_logic.lua +-- individual enable flags also checked in flowable_nodes_add_pipes.lua if pipeworks.enable_new_flow_logic then dofile(pipeworks.modpath.."/new_flow_logic.lua") + dofile(pipeworks.modpath.."/flowable_nodes_add_pipes.lua") dofile(pipeworks.modpath.."/register_flow_logic.lua") end -- cgit v1.2.3 From d69941a0ae763d6681ede2185ad88e25b11fead5 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sat, 30 Sep 2017 23:22:04 +0100 Subject: temporarily move ABM registration out of register_flow_logic.lua to allow refactoring it into flowable registry --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index a64be4e..d70e4f4 100644 --- a/init.lua +++ b/init.lua @@ -124,8 +124,8 @@ if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") -- individual enable flags also checked in flowable_nodes_add_pipes.lua if pipeworks.enable_new_flow_logic then dofile(pipeworks.modpath.."/new_flow_logic.lua") - dofile(pipeworks.modpath.."/flowable_nodes_add_pipes.lua") dofile(pipeworks.modpath.."/register_flow_logic.lua") + dofile(pipeworks.modpath.."/flowable_nodes_add_pipes.lua") end if pipeworks.enable_redefines then -- cgit v1.2.3 From c3627551b091d27819c242da204ed1e9dd8f15f0 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sat, 30 Sep 2017 23:42:26 +0100 Subject: move all current new_flow_logic code to dedicated sub-directory --- init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index d70e4f4..a081759 100644 --- a/init.lua +++ b/init.lua @@ -115,17 +115,18 @@ dofile(pipeworks.modpath.."/filter-injector.lua") dofile(pipeworks.modpath.."/trashcan.lua") dofile(pipeworks.modpath.."/wielder.lua") +local logicdir = "/new_flow_logic/" -- note that pipes still don't appear until registered in the files below this one, so can still be turned off -dofile(pipeworks.modpath.."/flowable_node_registry.lua") +dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end --- individual enable flags also checked in flowable_nodes_add_pipes.lua +-- individual enable flags also checked in register_local_pipes.lua if pipeworks.enable_new_flow_logic then - dofile(pipeworks.modpath.."/new_flow_logic.lua") - dofile(pipeworks.modpath.."/register_flow_logic.lua") - dofile(pipeworks.modpath.."/flowable_nodes_add_pipes.lua") + dofile(pipeworks.modpath..logicdir.."abms.lua") + dofile(pipeworks.modpath..logicdir.."abm_register.lua") + dofile(pipeworks.modpath..logicdir.."register_local_pipes.lua") end if pipeworks.enable_redefines then -- cgit v1.2.3 From 21892456f529e099a0c1d47ae780101d172f818a Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sat, 30 Sep 2017 23:55:16 +0100 Subject: init.lua: move non-destructive new_flow_logic code outside if-guard --- init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index a081759..d6067e5 100644 --- a/init.lua +++ b/init.lua @@ -116,7 +116,10 @@ dofile(pipeworks.modpath.."/trashcan.lua") dofile(pipeworks.modpath.."/wielder.lua") local logicdir = "/new_flow_logic/" --- note that pipes still don't appear until registered in the files below this one, so can still be turned off + +-- note that even with these files the new flow logic is not yet default +dofile(pipeworks.modpath..logicdir.."abms.lua") +dofile(pipeworks.modpath..logicdir.."abm_register.lua") dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end @@ -124,8 +127,6 @@ if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end -- individual enable flags also checked in register_local_pipes.lua if pipeworks.enable_new_flow_logic then - dofile(pipeworks.modpath..logicdir.."abms.lua") - dofile(pipeworks.modpath..logicdir.."abm_register.lua") dofile(pipeworks.modpath..logicdir.."register_local_pipes.lua") end -- cgit v1.2.3 From f7b17197677ea3675eee6bc667370fe3e23ac099 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sun, 1 Oct 2017 15:18:00 +0100 Subject: new flow logic: node registry: split registration functions into seperate file to allow ABM code to inspect tables --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index d6067e5..e91c4dc 100644 --- a/init.lua +++ b/init.lua @@ -118,9 +118,10 @@ dofile(pipeworks.modpath.."/wielder.lua") local logicdir = "/new_flow_logic/" -- note that even with these files the new flow logic is not yet default +dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") dofile(pipeworks.modpath..logicdir.."abms.lua") dofile(pipeworks.modpath..logicdir.."abm_register.lua") -dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") +dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua") if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end -- cgit v1.2.3 From f3cd1b61d771824ed9f42b32caa95ae08538bb64 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sun, 1 Oct 2017 16:17:35 +0100 Subject: new flow logic: flowable_node_registry_install.lua: add registration tracing --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'init.lua') diff --git a/init.lua b/init.lua index e91c4dc..e8a8d2f 100644 --- a/init.lua +++ b/init.lua @@ -94,6 +94,10 @@ function pipeworks.replace_name(tbl,tr,name) return ntbl end +pipeworks.logger = function(msg) + print("[pipeworks] "..msg) +end + ------------------------------------------- -- Load the various other parts of the mod -- cgit v1.2.3 From 396a4fdacdd6f80e3bba55cd6c26a2ae321179d1 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sun, 1 Oct 2017 18:23:58 +0100 Subject: remove register_local_pipes.lua as node registration has been moved to more appropriate files --- init.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index e8a8d2f..2a95be6 100644 --- a/init.lua +++ b/init.lua @@ -121,7 +121,9 @@ dofile(pipeworks.modpath.."/wielder.lua") local logicdir = "/new_flow_logic/" --- note that even with these files the new flow logic is not yet default +-- note that even with these files the new flow logic is not yet default. +-- registration will take place but no actual ABMs/node logic will be installed, +-- unless pipeworks.enable_new_flow_logic has been set. dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") dofile(pipeworks.modpath..logicdir.."abms.lua") dofile(pipeworks.modpath..logicdir.."abm_register.lua") @@ -130,10 +132,6 @@ dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua") if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end --- individual enable flags also checked in register_local_pipes.lua -if pipeworks.enable_new_flow_logic then - dofile(pipeworks.modpath..logicdir.."register_local_pipes.lua") -end if pipeworks.enable_redefines then dofile(pipeworks.modpath.."/compat-chests.lua") -- cgit v1.2.3 From 894ea5174fb8c3be9038698cb119b24acbec8cea Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Tue, 3 Oct 2017 20:38:56 +0100 Subject: move new flow logic flag to dedicated toggles table --- init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 2a95be6..8bae8e8 100644 --- a/init.lua +++ b/init.lua @@ -17,14 +17,16 @@ dofile(pipeworks.modpath.."/default_settings.lua") -- Read the external config file if it exists. +-- please add any new feature toggles to be a flag in this table... +pipeworks.toggles = {} local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt" local worldsettingsfile = io.open(worldsettingspath, "r") if worldsettingsfile then worldsettingsfile:close() dofile(worldsettingspath) end -if pipeworks.enable_new_flow_logic then - minetest.log("warning", "pipeworks new_flow_logic is WIP and incomplete!") +if pipeworks.toggles.pressure_logic then + minetest.log("warning", "pipeworks pressure-based logic is WIP and incomplete!") end -- Random variables @@ -123,7 +125,7 @@ local logicdir = "/new_flow_logic/" -- note that even with these files the new flow logic is not yet default. -- registration will take place but no actual ABMs/node logic will be installed, --- unless pipeworks.enable_new_flow_logic has been set. +-- unless the toggle flag is specifically enabled in the per-world settings flag. dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") dofile(pipeworks.modpath..logicdir.."abms.lua") dofile(pipeworks.modpath..logicdir.."abm_register.lua") -- cgit v1.2.3 From 750612181a67b9bf4ad4bd01c2d90472e8a41a6d Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Tue, 3 Oct 2017 20:53:49 +0100 Subject: add finite water feature toggle and auto-detect code --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 8bae8e8..8974005 100644 --- a/init.lua +++ b/init.lua @@ -103,6 +103,11 @@ end ------------------------------------------- -- Load the various other parts of the mod +-- early auto-detection for finite water mode if not explicitly disabled +if pipeworks.toggles.finite_water == nil then + dofile(pipeworks.modpath.."/autodetect-finite-water.lua") +end + dofile(pipeworks.modpath.."/common.lua") dofile(pipeworks.modpath.."/models.lua") dofile(pipeworks.modpath.."/autoplace_pipes.lua") -- cgit v1.2.3