Standardize files as LF without CR, and UTF-8 without BOM

UTF-8 with BOM crashes some systems according to 6551f5c120 comment, and there are several cases where Minetest is buggy with files that use CRLF line endings (though none I'm aware that affect these files), so strip CRs and BOM
This commit is contained in:
Treer 2019-08-07 07:23:06 +10:00 committed by SmallJoker
parent 58eb65c0c8
commit 11a818212a
4 changed files with 2021 additions and 2021 deletions

330
nodes.lua
View File

@ -1,165 +1,165 @@
-- Portal node -- Portal node
minetest.register_node("nether:portal", { minetest.register_node("nether:portal", {
description = "Nether Portal", description = "Nether Portal",
tiles = { tiles = {
"nether_transparent.png", "nether_transparent.png",
"nether_transparent.png", "nether_transparent.png",
"nether_transparent.png", "nether_transparent.png",
"nether_transparent.png", "nether_transparent.png",
{ {
name = "nether_portal.png", name = "nether_portal.png",
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 16, aspect_w = 16,
aspect_h = 16, aspect_h = 16,
length = 0.5, length = 0.5,
}, },
}, },
{ {
name = "nether_portal.png", name = "nether_portal.png",
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
aspect_w = 16, aspect_w = 16,
aspect_h = 16, aspect_h = 16,
length = 0.5, length = 0.5,
}, },
}, },
}, },
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
paramtype2 = "colorfacedir", paramtype2 = "colorfacedir",
palette = "nether_portals_palette.png", palette = "nether_portals_palette.png",
post_effect_color = { post_effect_color = {
-- post_effect_color can't be changed dynamically in Minetest like the portal colour is. -- post_effect_color can't be changed dynamically in Minetest like the portal colour is.
-- If you need a different post_effect_color then create a custom node and set it as the -- If you need a different post_effect_color then create a custom node and set it as the
-- wormhole_node_name in your portaldef. -- wormhole_node_name in your portaldef.
-- Hopefully this colour is close enough to magenta to work with the traditional magenta -- Hopefully this colour is close enough to magenta to work with the traditional magenta
-- portals, close enough to red to work for a red portal, and also close enough to red to -- portals, close enough to red to work for a red portal, and also close enough to red to
-- work with blue & cyan portals - since blue portals are sometimes portrayed as being red -- work with blue & cyan portals - since blue portals are sometimes portrayed as being red
-- from the opposite side / from the inside. -- from the opposite side / from the inside.
a = 160, r = 128, g = 0, b = 80 a = 160, r = 128, g = 0, b = 80
}, },
sunlight_propagates = true, sunlight_propagates = true,
use_texture_alpha = true, use_texture_alpha = true,
walkable = false, walkable = false,
diggable = false, diggable = false,
pointable = false, pointable = false,
buildable_to = false, buildable_to = false,
is_ground_content = false, is_ground_content = false,
drop = "", drop = "",
light_source = 5, light_source = 5,
alpha = 192, alpha = 192,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.1, 0.5, 0.5, 0.1}, {-0.5, -0.5, -0.1, 0.5, 0.5, 0.1},
}, },
}, },
groups = {not_in_creative_inventory = 1} groups = {not_in_creative_inventory = 1}
}) })
-- Nether nodes -- Nether nodes
minetest.register_node("nether:rack", { minetest.register_node("nether:rack", {
description = "Netherrack", description = "Netherrack",
tiles = {"nether_rack.png"}, tiles = {"nether_rack.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky = 3, level = 2}, groups = {cracky = 3, level = 2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_node("nether:sand", { minetest.register_node("nether:sand", {
description = "Nethersand", description = "Nethersand",
tiles = {"nether_sand.png"}, tiles = {"nether_sand.png"},
is_ground_content = true, is_ground_content = true,
groups = {crumbly = 3, level = 2, falling_node = 1}, groups = {crumbly = 3, level = 2, falling_node = 1},
sounds = default.node_sound_gravel_defaults({ sounds = default.node_sound_gravel_defaults({
footstep = {name = "default_gravel_footstep", gain = 0.45}, footstep = {name = "default_gravel_footstep", gain = 0.45},
}), }),
}) })
minetest.register_node("nether:glowstone", { minetest.register_node("nether:glowstone", {
description = "Glowstone", description = "Glowstone",
tiles = {"nether_glowstone.png"}, tiles = {"nether_glowstone.png"},
is_ground_content = true, is_ground_content = true,
light_source = 14, light_source = 14,
paramtype = "light", paramtype = "light",
groups = {cracky = 3, oddly_breakable_by_hand = 3}, groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
minetest.register_node("nether:brick", { minetest.register_node("nether:brick", {
description = "Nether Brick", description = "Nether Brick",
tiles = {"nether_brick.png"}, tiles = {"nether_brick.png"},
is_ground_content = false, is_ground_content = false,
groups = {cracky = 2, level = 2}, groups = {cracky = 2, level = 2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
local fence_texture = local fence_texture =
"default_fence_overlay.png^nether_brick.png^default_fence_overlay.png^[makealpha:255,126,126" "default_fence_overlay.png^nether_brick.png^default_fence_overlay.png^[makealpha:255,126,126"
minetest.register_node("nether:fence_nether_brick", { minetest.register_node("nether:fence_nether_brick", {
description = "Nether Brick Fence", description = "Nether Brick Fence",
drawtype = "fencelike", drawtype = "fencelike",
tiles = {"nether_brick.png"}, tiles = {"nether_brick.png"},
inventory_image = fence_texture, inventory_image = fence_texture,
wield_image = fence_texture, wield_image = fence_texture,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
}, },
groups = {cracky = 2, level = 2}, groups = {cracky = 2, level = 2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
-- Register stair and slab -- Register stair and slab
stairs.register_stair_and_slab( stairs.register_stair_and_slab(
"nether_brick", "nether_brick",
"nether:brick", "nether:brick",
{cracky = 2, level = 2}, {cracky = 2, level = 2},
{"nether_brick.png"}, {"nether_brick.png"},
"nether stair", "nether stair",
"nether slab", "nether slab",
default.node_sound_stone_defaults() default.node_sound_stone_defaults()
) )
-- StairsPlus -- StairsPlus
if minetest.get_modpath("moreblocks") then if minetest.get_modpath("moreblocks") then
stairsplus:register_all( stairsplus:register_all(
"nether", "brick", "nether:brick", { "nether", "brick", "nether:brick", {
description = "Nether Brick", description = "Nether Brick",
groups = {cracky = 2, level = 2}, groups = {cracky = 2, level = 2},
tiles = {"nether_brick.png"}, tiles = {"nether_brick.png"},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
end end
-- Crafting -- Crafting
minetest.register_craft({ minetest.register_craft({
output = "nether:brick 4", output = "nether:brick 4",
recipe = { recipe = {
{"nether:rack", "nether:rack"}, {"nether:rack", "nether:rack"},
{"nether:rack", "nether:rack"}, {"nether:rack", "nether:rack"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "nether:fence_nether_brick 6", output = "nether:fence_nether_brick 6",
recipe = { recipe = {
{"nether:brick", "nether:brick", "nether:brick"}, {"nether:brick", "nether:brick", "nether:brick"},
{"nether:brick", "nether:brick", "nether:brick"}, {"nether:brick", "nether:brick", "nether:brick"},
}, },
}) })

File diff suppressed because it is too large Load Diff

View File

@ -1,184 +1,184 @@
Portal API Reference Portal API Reference
==================== ====================
The portal system used to get to the Nether can be used to create portals The portal system used to get to the Nether can be used to create portals
to other realms. to other realms.
Pick a node type to have your portals built from, a shape in which the Pick a node type to have your portals built from, a shape in which the
portals must be built, and provide 3 functions for portals to find their portals must be built, and provide 3 functions for portals to find their
destination with: destination with:
* `find_realm_anchorPos(surface_anchorPos)` * `find_realm_anchorPos(surface_anchorPos)`
* `find_surface_anchorPos(realm_anchorPos)` * `find_surface_anchorPos(realm_anchorPos)`
* `is_within_realm(pos)` * `is_within_realm(pos)`
Optionally decorate by choosing portal colors, particles, media etc. Optionally decorate by choosing portal colors, particles, media etc.
See `init.lua` and `portal_examples.lua` for examples of 3 different portals. See `init.lua` and `portal_examples.lua` for examples of 3 different portals.
Portal code is more efficient when each type of portal uses a different type Portal code is more efficient when each type of portal uses a different type
of node to build its frame out of, however it is possible to register more than of node to build its frame out of, however it is possible to register more than
one kind of portal with the same frame material — such as obsidian — provided one kind of portal with the same frame material — such as obsidian — provided
the size of the PortalShape is distinct from any other type of portal that is the size of the PortalShape is distinct from any other type of portal that is
using the same node as its frame, and portal sizes remain small. using the same node as its frame, and portal sizes remain small.
Realms Realms
------ ------
This API uses the concept of a "realm" for each type of portal. If a portal is This API uses the concept of a "realm" for each type of portal. If a portal is
outside its realm then it links to a portal inside the realm, if a portal is outside its realm then it links to a portal inside the realm, if a portal is
inside its realm then it links to the outside. inside its realm then it links to the outside.
You get to decide what consitutes your realm by implementing the function You get to decide what consitutes your realm by implementing the function
`is_within_realm(position)`. `is_within_realm(position)`.
The Nether realm, for example, is defined as existing at a certain depth. The Nether realm, for example, is defined as existing at a certain depth.
Helper functions Helper functions
---------------- ----------------
* `nether.volume_is_natural(minp, maxp)`: returns a boolean * `nether.volume_is_natural(minp, maxp)`: returns a boolean
* use this when determining where to spawn a portal, to avoid overwriting * use this when determining where to spawn a portal, to avoid overwriting
player builds. It checks the area for any nodes that aren't ground or player builds. It checks the area for any nodes that aren't ground or
trees. trees.
* `nether.find_surface_target_y(target_x, target_z, portal_name)`: returns a * `nether.find_surface_target_y(target_x, target_z, portal_name)`: returns a
suitable anchorPos suitable anchorPos
* Can be used when implementing custom find_surface_anchorPos() functions * Can be used when implementing custom find_surface_anchorPos() functions
* portal_name is optional, providing it allows existing portals on the * portal_name is optional, providing it allows existing portals on the
surface to be reused. surface to be reused.
* `nether.find_nearest_working_portal(portal_name, anchorPos, distance_limit, y_factor)`: returns * `nether.find_nearest_working_portal(portal_name, anchorPos, distance_limit, y_factor)`: returns
an anchorPos, or nil if no portal was found within the the distance_limit. an anchorPos, or nil if no portal was found within the the distance_limit.
* A y_factor of 0 means y does not affect the distance_limit, a y_factor * A y_factor of 0 means y does not affect the distance_limit, a y_factor
of 1 means y is included (the default if y_factor is nil), and a y_factor of 1 means y is included (the default if y_factor is nil), and a y_factor
of 2 would squash the search-sphere by a factor of 2 on the y-axis, etc. of 2 would squash the search-sphere by a factor of 2 on the y-axis, etc.
* Only portals in the same realm as the anchorPos will be returned, even if * Only portals in the same realm as the anchorPos will be returned, even if
y_factor is 0. y_factor is 0.
* Pass a nil (or negative) distance_limit to indicate no distance limit * Pass a nil (or negative) distance_limit to indicate no distance limit
API functions API functions
------------- -------------
Call these functions only at load time: Call these functions only at load time:
* `nether.register_portal(name, portal_definition)` * `nether.register_portal(name, portal_definition)`
* Returns true on success. Can return false if the portal definition * Returns true on success. Can return false if the portal definition
clashes with a portal already registered by another mod, e.g. if the size clashes with a portal already registered by another mod, e.g. if the size
and frame node is not unique. and frame node is not unique.
A false return value should be handled, you could: A false return value should be handled, you could:
* Fall back to using a secondary material for portals to be built with. * Fall back to using a secondary material for portals to be built with.
* Use error() to exit lua with a message explaining how two mods are * Use error() to exit lua with a message explaining how two mods are
clashing and how it can be resolved. clashing and how it can be resolved.
* Continue without a portal (the reason will be logged for the user). * Continue without a portal (the reason will be logged for the user).
* `nether.unregister_portal(name)` * `nether.unregister_portal(name)`
* Unregisters the portal from the engine, and deletes the entry with key * Unregisters the portal from the engine, and deletes the entry with key
`name` from `nether.registered_portals` and associated internal tables. `name` from `nether.registered_portals` and associated internal tables.
* Returns true on success * Returns true on success
* register_portal_ignition_item(name, ignition_failure_sound) * register_portal_ignition_item(name, ignition_failure_sound)
* ignition_failure_sound is optional, it plays any time an attempt to use * ignition_failure_sound is optional, it plays any time an attempt to use
the item occurs if a portal is not ignited. the item occurs if a portal is not ignited.
Portal definition Portal definition
----------------- -----------------
Used by `nether.register_portal`. Used by `nether.register_portal`.
{ {
shape = PortalShape_Traditional, shape = PortalShape_Traditional,
-- Optional. Defaults to PortalShape_Traditional -- Optional. Defaults to PortalShape_Traditional
wormhole_node_name = "nether:portal", wormhole_node_name = "nether:portal",
-- Optional. Allows a custom wormhole node to be specified. -- Optional. Allows a custom wormhole node to be specified.
-- Useful if you want the portals to have a different post_effect_color -- Useful if you want the portals to have a different post_effect_color
-- or texture. -- or texture.
wormhole_node_color = 0, wormhole_node_color = 0,
-- Optional. Defaults to 0/magenta. -- Optional. Defaults to 0/magenta.
-- A value from 0 to 7 corresponding to the color of pixels in -- A value from 0 to 7 corresponding to the color of pixels in
-- nether_portals_palette.png: -- nether_portals_palette.png:
-- 0 traditional/magenta -- 0 traditional/magenta
-- 1 black -- 1 black
-- 2 blue -- 2 blue
-- 3 green -- 3 green
-- 4 cyan -- 4 cyan
-- 5 red -- 5 red
-- 6 yellow -- 6 yellow
-- 7 white -- 7 white
particle_color = "#808", particle_color = "#808",
-- Optional. Will default to a colour matching the wormhole_node_color -- Optional. Will default to a colour matching the wormhole_node_color
-- if not specified. -- if not specified.
particle_texture = "image.png", particle_texture = "image.png",
-- Optional. Hardware colouring (i.e. particle_color) is applied to -- Optional. Hardware colouring (i.e. particle_color) is applied to
-- this texture, use particle_texture_colored instead if you want to -- this texture, use particle_texture_colored instead if you want to
-- use the colors of the image. -- use the colors of the image.
-- Animation and particle scale may also be specified, e.g: -- Animation and particle scale may also be specified, e.g:
-- particle_texture = { -- particle_texture = {
-- name = "nether_particle_anim1.png", -- name = "nether_particle_anim1.png",
-- animation = { -- animation = {
-- type = "vertical_frames", -- type = "vertical_frames",
-- aspect_w = 7, -- aspect_w = 7,
-- aspect_h = 7, -- aspect_h = 7,
-- length = 1, -- length = 1,
-- }, -- },
-- scale = 1.5 -- scale = 1.5
-- }, -- },
-- See lua_api.txt for Tile Animation definition -- See lua_api.txt for Tile Animation definition
frame_node_name = "default:obsidian", frame_node_name = "default:obsidian",
-- Required. For best results, have your portal constructed of a -- Required. For best results, have your portal constructed of a
-- material nobody else is using. -- material nobody else is using.
sounds = { sounds = {
ambient = <SimpleSoundSpec>, ambient = <SimpleSoundSpec>,
-- if the ambient SimpleSoundSpec is a table it can also contain a -- if the ambient SimpleSoundSpec is a table it can also contain a
-- "length" int, which is the number of seconds to wait before -- "length" int, which is the number of seconds to wait before
-- repeating the ambient sound. Default is 3. -- repeating the ambient sound. Default is 3.
ignite = <SimpleSoundSpec>, ignite = <SimpleSoundSpec>,
extinguish = <SimpleSoundSpec>, extinguish = <SimpleSoundSpec>,
teleport = <SimpleSoundSpec>, teleport = <SimpleSoundSpec>,
} }
-- sounds is optional -- sounds is optional
within_realm = function(pos), within_realm = function(pos),
-- Required. Return true if a portal at pos is in the realm, rather -- Required. Return true if a portal at pos is in the realm, rather
than the surface world. than the surface world.
find_realm_anchorPos = function(surface_anchorPos), find_realm_anchorPos = function(surface_anchorPos),
-- Required. Return a position in the realm that a portal created at -- Required. Return a position in the realm that a portal created at
-- surface_anchorPos will link to. -- surface_anchorPos will link to.
-- Return an anchorPos or anchorPos, orientation -- Return an anchorPos or anchorPos, orientation
-- If orientation is not specified then the orientation of the surface -- 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 -- If the location of an existing portal is returned then include the
-- orientation, otherwise the existing portal could be overwritten by -- orientation, otherwise the existing portal could be overwritten by
-- a new one with the orientation of the surface portal. -- a new one with the orientation of the surface portal.
find_surface_anchorPos = function(realm_anchorPos), find_surface_anchorPos = function(realm_anchorPos),
-- Optional. If you don't implement this then a position near the -- Optional. If you don't implement this then a position near the
-- surface will be picked. -- surface will be picked.
-- Return an anchorPos or (anchorPos, orientation) -- Return an anchorPos or (anchorPos, orientation)
-- If orientation is not specified then the orientation of the realm -- If orientation is not specified then the orientation of the realm
-- portal will be used. -- portal will be used.
-- If the location of an existing portal is returned then include the -- If the location of an existing portal is returned then include the
-- orientation, otherwise the existing portal could be overwritten by -- orientation, otherwise the existing portal could be overwritten by
-- a new one with the orientation of the realm portal. -- a new one with the orientation of the realm portal.
on_run_wormhole = function(portalDef, anochorPos, orientation), on_run_wormhole = function(portalDef, anochorPos, orientation),
-- invoked once per second per portal -- invoked once per second per portal
on_extinguish = function(portalDef, anochorPos, orientation), on_extinguish = function(portalDef, anochorPos, orientation),
-- invoked when a portal is extinguished, including when the portal -- invoked when a portal is extinguished, including when the portal
-- it connected to was extinguished. -- it connected to was extinguished.
on_player_teleported = function(portalDef, player, oldPos, newPos), on_player_teleported = function(portalDef, player, oldPos, newPos),
-- invoked immediately after a player is teleported -- invoked immediately after a player is teleported
on_ignite = function(portalDef, anochorPos, orientation) on_ignite = function(portalDef, anochorPos, orientation)
-- invoked when a player or mesecon ignites a portal -- invoked when a player or mesecon ignites a portal
on_created = function(portalDef, anochorPos, orientation) on_created = function(portalDef, anochorPos, orientation)
-- invoked when a portal creates a remote twin, usually when a -- invoked when a portal creates a remote twin, usually when a
-- player travels through a portal for the first time. -- player travels through a portal for the first time.
} }

View File

@ -1,4 +1,4 @@
--[[ --[[
Nether mod portal examples for Minetest Nether mod portal examples for Minetest