diff --git a/init.lua b/init.lua index 4bb2ead..7d8d5be 100644 --- a/init.lua +++ b/init.lua @@ -22,8 +22,9 @@ local S = minetest.get_translator("nether") -- Global Nether namespace -nether = {} -nether.path = minetest.get_modpath("nether") +nether = {} +nether.modname = minetest.get_current_modname() +nether.path = minetest.get_modpath(nether.modname) nether.get_translator = S -- Settings @@ -108,5 +109,31 @@ The expedition parties have found no diamonds or gold, and after an experienced destination_pos.y = nether.find_surface_target_y(destination_pos.x, destination_pos.z, "nether_portal") return destination_pos end + end, + + on_ignite = function(portalDef, anochorPos, orientation) + + local make_sparks_fly = function(pos) + minetest.add_particlespawner({ + amount = 14, + time = 0.1, + minpos = {x = pos.x - 0.25, y = pos.y - 0.25, z = pos.z - 0.25}, + maxpos = {x = pos.x + 0.25, y = pos.y + 0.25, z = pos.z + 0.25}, + minvel = {x = -5, y = -1, z = -5}, + maxvel = {x = 5, y = 1, z = 5}, + minacc = {x = 0, y = 0, z = 0}, + maxacc = {x = 0, y = 0, z = 0}, + minexptime = 0.1, + maxexptime = 0.5, + minsize = 0.2, + maxsize = 0.8, + collisiondetection = false, + texture = portalDef.particle_texture .. "^[colorize:#F4F:alpha", + glow = 8 + }) + end + + portalDef.shape.apply_func_to_wormhole_nodes(anochorPos, orientation, make_sparks_fly) end + }) \ No newline at end of file diff --git a/portal_api.txt b/portal_api.txt index fd2c557..005a552 100644 --- a/portal_api.txt +++ b/portal_api.txt @@ -68,11 +68,19 @@ Used by `nether.register_portal`. wormhole_node_color = 0, -- A value from 0 to 7 corresponding to the color of pixels in - -- nether_portals_palette.png + -- nether_portals_palette.png: + -- 0 traditional/magenta + -- 1 black + -- 2 blue + -- 3 green + -- 4 cyan + -- 5 red + -- 6 yellow + -- 7 white particle_color = "#808", - -- Optional. Will default to the same colour as wormhole_node_color if - -- not specified. + -- Optional. Will default to a colour matching the wormhole_node_color + -- if not specified. frame_node_name = "default:obsidian", -- Required. For best results, have your portal constructed of a @@ -97,7 +105,10 @@ Used by `nether.register_portal`. -- surface_anchorPos will link to. -- Return an anchorPos or anchorPos, orientation -- If orientation is not specified then the orientation of the surface - -- portal will be used. + -- portal will be used. + -- If the location of an existing portal is returned then include the + -- orientation, otherwise the existing portal could be overwritten by + -- a new one with the orientation of the surface portal. find_surface_anchorPos = function(realm_anchorPos), -- Optional. If you don't implement this then a position near the @@ -105,6 +116,9 @@ Used by `nether.register_portal`. -- Return an anchorPos or (anchorPos, orientation) -- If orientation is not specified then the orientation of the realm -- portal will be used. + -- If the location of an existing portal is returned then include the + -- orientation, otherwise the existing portal could be overwritten by + -- a new one with the orientation of the realm portal. on_run_wormhole = function(portalDef, anochorPos, orientation), -- invoked once per second per portal