mirror of
				https://github.com/HybridDog/nether-pack.git
				synced 2025-10-31 10:35:24 +01:00 
			
		
		
		
	Fixed rare bug that causes minetest to crash
This commit is contained in:
		| @@ -589,13 +589,13 @@ end | ||||
| -- Read portals to nether | ||||
| function nether:read_portals_to_nether() | ||||
| 	local array = {} | ||||
| 	NETHER_PORTALS_TO_NETHER = {} | ||||
| 	local array2 = {} | ||||
| 	local file = io.open(NETHER_PORTALS_TO_NETHER_FILE, "r") | ||||
| 	if file ~= nil then | ||||
| 		for line in io.lines(NETHER_PORTALS_TO_NETHER_FILE) do | ||||
| 			if not (line == "" or line == nil) then | ||||
| 				if line:sub(1, 1) == "p" then | ||||
| 					NETHER_PORTALS_TO_NETHER[table.getn(NETHER_PORTALS_TO_NETHER)+1] = array | ||||
| 					array2[table.getn(array2)+1] = array | ||||
| 				elseif line:sub(1, 1) == "x" then | ||||
| 					array.x = tonumber(split(line, "x")[1]) | ||||
| 				elseif line:sub(1, 1) == "y" then | ||||
| @@ -612,19 +612,19 @@ function nether:read_portals_to_nether() | ||||
| 			file:close() | ||||
| 		end | ||||
| 	end | ||||
| 	table_unique(NETHER_PORTALS_TO_NETHER) | ||||
| 	NETHER_PORTALS_TO_NETHER = table_unique(array2) | ||||
| end | ||||
|  | ||||
| -- Read portals from nether | ||||
| function nether:read_portals_from_nether() | ||||
| 	local array = {} | ||||
| 	NETHER_PORTALS_FROM_NETHER = {} | ||||
| 	local array2 = {} | ||||
| 	local file = io.open(NETHER_PORTALS_FROM_NETHER_FILE, "r") | ||||
| 	if file ~= nil then | ||||
| 		for line in io.lines(NETHER_PORTALS_FROM_NETHER_FILE) do | ||||
| 			if not (line == "" or line == nil) then | ||||
| 				if line:sub(1, 1) == "p" then | ||||
| 					NETHER_PORTALS_FROM_NETHER[table.getn(NETHER_PORTALS_FROM_NETHER)+1] = array | ||||
| 					array2[table.getn(array2)+1] = array | ||||
| 				elseif line:sub(1, 1) == "x" then | ||||
| 					array.x = tonumber(split(line, "x")[1]) | ||||
| 				elseif line:sub(1, 1) == "y" then | ||||
| @@ -641,7 +641,7 @@ function nether:read_portals_from_nether() | ||||
| 			file:close() | ||||
| 		end | ||||
| 	end | ||||
| 	table_unique(NETHER_PORTALS_FROM_NETHER) | ||||
| 	NETHER_PORTALS_FROM_NETHER = table_unique(array2) | ||||
| end | ||||
|  | ||||
| nether:read_portals_to_nether() | ||||
| @@ -702,6 +702,9 @@ minetest.register_abm({ | ||||
| 	interval = 1.0, | ||||
| 	chance = 1, | ||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||
| 		local nodemeta = minetest.env:get_meta(pos) | ||||
| 		if nodemeta:get_string("generatingportal") == "" or nodemeta:get_string("generatingportal") == nil then | ||||
| 			nodemeta:set_string("generatingportal", "true") | ||||
| 			for i,v in ipairs(NETHER_PORTAL) do | ||||
| 				v.pos.x = v.pos.x + pos.x | ||||
| 				v.pos.y = v.pos.y + pos.y | ||||
| @@ -718,6 +721,7 @@ minetest.register_abm({ | ||||
| 				nether:read_portals_from_nether() | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| }) | ||||
|  | ||||
| -- Portal Stuff | ||||
|   | ||||
| @@ -277,7 +277,6 @@ for i,v in ipairs(HADES_THRONE_ABS) do | ||||
| 	end | ||||
| end | ||||
| HADES_THRONE_ENDPOS_ABS = {x=htx, y=hty, z=htz} | ||||
| print("HTY:" .. hty) | ||||
| local nether = {} | ||||
|  | ||||
| -- Check if file exists | ||||
| @@ -590,13 +589,13 @@ end | ||||
| -- Read portals to nether | ||||
| function nether:read_portals_to_nether() | ||||
| 	local array = {} | ||||
| 	NETHER_PORTALS_TO_NETHER = {} | ||||
| 	local array2 = {} | ||||
| 	local file = io.open(NETHER_PORTALS_TO_NETHER_FILE, "r") | ||||
| 	if file ~= nil then | ||||
| 		for line in io.lines(NETHER_PORTALS_TO_NETHER_FILE) do | ||||
| 			if not (line == "" or line == nil) then | ||||
| 				if line:sub(1, 1) == "p" then | ||||
| 					NETHER_PORTALS_TO_NETHER[table.getn(NETHER_PORTALS_TO_NETHER)+1] = array | ||||
| 					array2[table.getn(array2)+1] = array | ||||
| 				elseif line:sub(1, 1) == "x" then | ||||
| 					array.x = tonumber(split(line, "x")[1]) | ||||
| 				elseif line:sub(1, 1) == "y" then | ||||
| @@ -613,19 +612,19 @@ function nether:read_portals_to_nether() | ||||
| 			file:close() | ||||
| 		end | ||||
| 	end | ||||
| 	table_unique(NETHER_PORTALS_TO_NETHER) | ||||
| 	NETHER_PORTALS_TO_NETHER = table_unique(array2) | ||||
| end | ||||
|  | ||||
| -- Read portals from nether | ||||
| function nether:read_portals_from_nether() | ||||
| 	local array = {} | ||||
| 	NETHER_PORTALS_FROM_NETHER = {} | ||||
| 	local array2 = {} | ||||
| 	local file = io.open(NETHER_PORTALS_FROM_NETHER_FILE, "r") | ||||
| 	if file ~= nil then | ||||
| 		for line in io.lines(NETHER_PORTALS_FROM_NETHER_FILE) do | ||||
| 			if not (line == "" or line == nil) then | ||||
| 				if line:sub(1, 1) == "p" then | ||||
| 					NETHER_PORTALS_FROM_NETHER[table.getn(NETHER_PORTALS_FROM_NETHER)+1] = array | ||||
| 					array2[table.getn(array2)+1] = array | ||||
| 				elseif line:sub(1, 1) == "x" then | ||||
| 					array.x = tonumber(split(line, "x")[1]) | ||||
| 				elseif line:sub(1, 1) == "y" then | ||||
| @@ -642,7 +641,7 @@ function nether:read_portals_from_nether() | ||||
| 			file:close() | ||||
| 		end | ||||
| 	end | ||||
| 	table_unique(NETHER_PORTALS_FROM_NETHER) | ||||
| 	NETHER_PORTALS_FROM_NETHER = table_unique(array2) | ||||
| end | ||||
|  | ||||
| nether:read_portals_to_nether() | ||||
| @@ -703,6 +702,8 @@ minetest.register_abm({ | ||||
| 	interval = 1.0, | ||||
| 	chance = 1, | ||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||
| 		local nodemeta = minetest.env:get_meta(pos) | ||||
| 		if nodemeta:get_string("generatingportal") == "" or nodemeta:get_string("generatingportal") == nil then | ||||
| 			for i,v in ipairs(NETHER_PORTAL) do | ||||
| 				v.pos.x = v.pos.x + pos.x | ||||
| 				v.pos.y = v.pos.y + pos.y | ||||
| @@ -719,6 +720,7 @@ minetest.register_abm({ | ||||
| 				nether:read_portals_from_nether() | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| }) | ||||
|  | ||||
| -- Portal Stuff | ||||
|   | ||||
		Reference in New Issue
	
	Block a user