forked from minetest-mods/nether
Add settingtypes.txt settings
This commit is contained in:
parent
a971e0359e
commit
43f1f24d53
19
init.lua
19
init.lua
@ -28,19 +28,26 @@ nether.path = minetest.get_modpath(nether.modname)
|
|||||||
nether.get_translator = S
|
nether.get_translator = S
|
||||||
|
|
||||||
-- Settings
|
-- Settings
|
||||||
nether.DEPTH = -5000
|
nether.DEPTH = -5000 -- The y location of the Nether
|
||||||
nether.FASTTRAVEL_FACTOR = 8 -- 10 could be better value for Minetest, since there's no sprint, but ex-Minecraft players will be mathing for 8
|
nether.FASTTRAVEL_FACTOR = 8 -- 10 could be better value for Minetest, since there's no sprint, but ex-Minecraft players will be mathing for 8
|
||||||
nether.PORTAL_BOOK_LOOT_WEIGHTING = 0.9 -- Likelyhood of finding the Book of Portals (guide) in dungeon chests. Set to 0 to disable.
|
nether.PORTAL_BOOK_LOOT_WEIGHTING = 0.9 -- Likelyhood of finding the Book of Portals (guide) in dungeon chests. Set to 0 to disable.
|
||||||
nether.ENABLE_EXAMPLE_PORTALS = false -- Enables extra portal types - examples of how to create your own portal types using the Nether's portal API. Once enabled, their shapes will be shown in the book of portals.
|
nether.NETHER_REALM_ENABLED = true -- Setting to false disables the Nether and Nether portal
|
||||||
|
|
||||||
|
|
||||||
|
-- Override default settings with values from the .conf file, if any are present.
|
||||||
|
nether.FASTTRAVEL_FACTOR = tonumber(minetest.settings:get("nether_fasttravel_factor") or nether.FASTTRAVEL_FACTOR)
|
||||||
|
nether.PORTAL_BOOK_LOOT_WEIGHTING = tonumber(minetest.settings:get("nether_portalBook_loot_weighting") or nether.PORTAL_BOOK_LOOT_WEIGHTING)
|
||||||
|
nether.NETHER_REALM_ENABLED = minetest.settings:get_bool("nether_realm_enabled", nether.NETHER_REALM_ENABLED)
|
||||||
|
|
||||||
|
|
||||||
-- Load files
|
-- Load files
|
||||||
dofile(nether.path .. "/portal_api.lua")
|
dofile(nether.path .. "/portal_api.lua")
|
||||||
dofile(nether.path .. "/nodes.lua")
|
dofile(nether.path .. "/nodes.lua")
|
||||||
|
if nether.NETHER_REALM_ENABLED then
|
||||||
dofile(nether.path .. "/mapgen.lua")
|
dofile(nether.path .. "/mapgen.lua")
|
||||||
|
|
||||||
if nether.ENABLE_EXAMPLE_PORTALS then
|
|
||||||
dofile(nether.path .. "/portal_examples.lua")
|
|
||||||
end
|
end
|
||||||
|
dofile(nether.path .. "/portal_examples.lua")
|
||||||
|
|
||||||
|
|
||||||
-- Portals are ignited by right-clicking with a mese crystal fragment
|
-- Portals are ignited by right-clicking with a mese crystal fragment
|
||||||
nether.register_portal_ignition_item(
|
nether.register_portal_ignition_item(
|
||||||
@ -49,6 +56,7 @@ nether.register_portal_ignition_item(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if nether.NETHER_REALM_ENABLED then
|
||||||
-- Use the Portal API to add a portal type which goes to the Nether
|
-- Use the Portal API to add a portal type which goes to the Nether
|
||||||
-- See portal_api.txt for documentation
|
-- See portal_api.txt for documentation
|
||||||
nether.register_portal("nether_portal", {
|
nether.register_portal("nether_portal", {
|
||||||
@ -148,3 +156,4 @@ The expedition parties have found no diamonds or gold, and after an experienced
|
|||||||
end
|
end
|
||||||
|
|
||||||
})
|
})
|
||||||
|
end
|
@ -1,10 +1,11 @@
|
|||||||
--[[
|
--[[
|
||||||
|
|
||||||
Nether mod portal examples for Minetest
|
Nether mod portal examples for Minetest
|
||||||
|
|
||||||
These portal API examples are independent of the Nether.
|
These portal API examples work independently of the Nether realm and Nether portal.
|
||||||
To use this file, set nether.ENABLE_EXAMPLE_PORTALS to true in init.lua
|
To try these examples, enable them in Mintest -> Settings -> All settings -> Mods -> nether
|
||||||
|
Once enabled, their shapes/plans will be shown in the book of portals.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
Copyright (C) 2019 Treer
|
Copyright (C) 2019 Treer
|
||||||
|
|
||||||
@ -24,6 +25,10 @@
|
|||||||
]]--
|
]]--
|
||||||
local S = nether.get_translator
|
local S = nether.get_translator
|
||||||
|
|
||||||
|
|
||||||
|
local ENABLE_PORTAL_EXAMPLE_FLOATLANDS = false
|
||||||
|
local ENABLE_PORTAL_EXAMPLE_SURFACETRAVEL = false
|
||||||
|
|
||||||
-- Sets how far a Surface Portal will travel, measured in cells along the Moore curve,
|
-- Sets how far a Surface Portal will travel, measured in cells along the Moore curve,
|
||||||
-- which are about 117 nodes square each. Larger numbers will generally mean further distance
|
-- which are about 117 nodes square each. Larger numbers will generally mean further distance
|
||||||
-- as-the-crow-flies, but for small adjustments this will not always be true due to the how
|
-- as-the-crow-flies, but for small adjustments this will not always be true due to the how
|
||||||
@ -33,8 +38,14 @@ local S = nether.get_translator
|
|||||||
local SURFACE_TRAVEL_DISTANCE = 26
|
local SURFACE_TRAVEL_DISTANCE = 26
|
||||||
|
|
||||||
|
|
||||||
|
--=================================================--
|
||||||
|
-- Portal to the Floatlands, playable code example --
|
||||||
|
--==================================================--
|
||||||
local FLOATLANDS_ENABLED = false
|
local FLOATLANDS_ENABLED = false
|
||||||
local FLOATLAND_LEVEL = 1280
|
local FLOATLAND_LEVEL = 1280
|
||||||
|
|
||||||
|
if minetest.settings:get_bool("nether_enable_portal_example_floatlands", ENABLE_PORTAL_EXAMPLE_FLOATLANDS) then
|
||||||
|
|
||||||
local floatlands_flavortext = ""
|
local floatlands_flavortext = ""
|
||||||
if minetest.get_mapgen_setting("mg_name") == "v7" then
|
if minetest.get_mapgen_setting("mg_name") == "v7" then
|
||||||
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags")
|
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags")
|
||||||
@ -91,7 +102,7 @@ This portal is different to the others, rather than acting akin to a doorway it
|
|||||||
local destination_pos = {x = surface_anchorPos.x ,y = FLOATLAND_LEVEL + 2, z = surface_anchorPos.z}
|
local destination_pos = {x = surface_anchorPos.x ,y = FLOATLAND_LEVEL + 2, z = surface_anchorPos.z}
|
||||||
|
|
||||||
-- a y_factor of 0 makes the search ignore the altitude of the portals (as long as they are in the Floatlands)
|
-- a y_factor of 0 makes the search ignore the altitude of the portals (as long as they are in the Floatlands)
|
||||||
local existing_portal_location, existing_portal_orientation = nether.find_nearest_working_portal("floatlands_portal", destination_pos, 20, 0)
|
local existing_portal_location, existing_portal_orientation = nether.find_nearest_working_portal("floatlands_portal", destination_pos, 10, 0)
|
||||||
if existing_portal_location ~= nil then
|
if existing_portal_location ~= nil then
|
||||||
return existing_portal_location, existing_portal_orientation
|
return existing_portal_location, existing_portal_orientation
|
||||||
else
|
else
|
||||||
@ -100,12 +111,20 @@ This portal is different to the others, rather than acting akin to a doorway it
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--==============================================--
|
||||||
|
-- Surface-travel portal, playable code example --
|
||||||
|
--==============================================--
|
||||||
|
|
||||||
-- These Moore Curve functions requred by surface_portal's find_surface_anchorPos() will
|
-- These Moore Curve functions requred by surface_portal's find_surface_anchorPos() will
|
||||||
-- be assigned later in this file.
|
-- be assigned later in this file.
|
||||||
local get_moore_distance -- will be function get_moore_distance(cell_count, x, y): integer
|
local get_moore_distance -- will be function get_moore_distance(cell_count, x, y): integer
|
||||||
local get_moore_coords -- will be function get_moore_coords(cell_count, distance): pos2d
|
local get_moore_coords -- will be function get_moore_coords(cell_count, distance): pos2d
|
||||||
|
|
||||||
|
if minetest.settings:get_bool("nether_enable_portal_example_surfacetravel", ENABLE_PORTAL_EXAMPLE_SURFACETRAVEL) then
|
||||||
|
|
||||||
nether.register_portal("surface_portal", {
|
nether.register_portal("surface_portal", {
|
||||||
shape = nether.PortalShape_Circular,
|
shape = nether.PortalShape_Circular,
|
||||||
frame_node_name = "default:tinblock",
|
frame_node_name = "default:tinblock",
|
||||||
@ -141,7 +160,7 @@ These travel a distance along the ground, and even when constructed deep undergr
|
|||||||
find_surface_anchorPos = function(realm_anchorPos)
|
find_surface_anchorPos = function(realm_anchorPos)
|
||||||
-- A portal definition doesn't normally need to provide a find_surface_anchorPos() function,
|
-- A portal definition doesn't normally need to provide a find_surface_anchorPos() function,
|
||||||
-- since find_surface_target_y() will be used by default, but these portals travel around the
|
-- since find_surface_target_y() will be used by default, but these portals travel around the
|
||||||
-- surface (following a Moore curve) so will be using a different x and z to realm_anchorPos.
|
-- surface (following a Moore curve) so will be calculating a different x and z to realm_anchorPos.
|
||||||
|
|
||||||
local cellCount = 512
|
local cellCount = 512
|
||||||
local maxDistFromOrigin = 30000 -- the world edges are at X=30927, X=−30912, Z=30927 and Z=−30912
|
local maxDistFromOrigin = 30000 -- the world edges are at X=30927, X=−30912, Z=30927 and Z=−30912
|
||||||
@ -201,7 +220,7 @@ These travel a distance along the ground, and even when constructed deep undergr
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--=========================================--
|
--=========================================--
|
||||||
-- Hilbert curve and Moore curve functions --
|
-- Hilbert curve and Moore curve functions --
|
||||||
@ -211,9 +230,9 @@ These travel a distance along the ground, and even when constructed deep undergr
|
|||||||
-- to place portals. https://en.wikipedia.org/wiki/Moore_curve
|
-- to place portals. https://en.wikipedia.org/wiki/Moore_curve
|
||||||
|
|
||||||
|
|
||||||
-- Flip a quadrant on its diagonal axis
|
-- Flip a quadrant on a diagonal axis
|
||||||
-- cell_count is the number of cells across the square is split into, and must be a power of 2
|
-- cell_count is the number of cells across the square is split into, and must be a power of 2
|
||||||
-- if flip_twice is true then pos does not change (any even numbers of flips would cancel out)
|
-- if flip_twice is true then pos does not change (even numbers of flips cancel out)
|
||||||
-- if flip_direction is true then the position is flipped along the \ diagonal
|
-- if flip_direction is true then the position is flipped along the \ diagonal
|
||||||
-- if flip_direction is false then the position is flipped along the / diagonal
|
-- if flip_direction is false then the position is flipped along the / diagonal
|
||||||
local function hilbert_flip(cell_count, pos, flip_direction, flip_twice)
|
local function hilbert_flip(cell_count, pos, flip_direction, flip_twice)
|
||||||
|
19
settingtypes.txt
Normal file
19
settingtypes.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Travelling a short distance in the Nether can correspond to a much further distance on the surface.
|
||||||
|
#
|
||||||
|
# A factor of 10 might be a better value for Minetest, since there's no sprint, but ex-Minecraft players will be mathing for 8.
|
||||||
|
nether_fasttravel_factor (Nether fast-travel factor) int 8
|
||||||
|
|
||||||
|
# The likelyhood of finding a Book containing all the portal plans in a dungeon chest.
|
||||||
|
# Set to 0 to disable, or 10 to have it extremely common.
|
||||||
|
#
|
||||||
|
# (This value is automatically halved when the Nether portal is the only type of portal, since few players will need instruction)
|
||||||
|
nether_portalBook_loot_weighting (Likelyhood of finding Book of Portals in dungeon chests) int 9
|
||||||
|
|
||||||
|
# Turn off to disable the Nether and Nether portal
|
||||||
|
nether_realm_enabled (Enable Nether realm & portal) bool true
|
||||||
|
|
||||||
|
# Enables the Floatlands portal api code example
|
||||||
|
nether_enable_portal_example_floatlands (Enable example portal: Floatlands) bool false
|
||||||
|
|
||||||
|
# Enables the Surface travel portal api code example
|
||||||
|
nether_enable_portal_example_surfacetravel (Enable example portal: Surface travel) bool false
|
Loading…
Reference in New Issue
Block a user