Compare commits
10 Commits
eca004cdb5
...
5b2016d51e
Author | SHA1 | Date | |
---|---|---|---|
|
5b2016d51e | ||
|
b2a68d51f9 | ||
|
1664f27d38 | ||
|
95038fea74 | ||
|
35fbcf05ac | ||
|
4b88b84155 | ||
|
236959a045 | ||
|
99d6673d7c | ||
|
2f88237880 | ||
|
da510e1ab6 |
2
.mailmap
Normal file
2
.mailmap
Normal file
@ -0,0 +1,2 @@
|
||||
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
|
||||
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>
|
9
LICENSE.txt
Normal file
9
LICENSE.txt
Normal file
@ -0,0 +1,9 @@
|
||||
Copyright © 2023 Wuzzy, joz
|
||||
|
||||
The MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,6 +1,6 @@
|
||||
# Railway corridors for Treasurer [`tsm_railcorridors`]
|
||||
|
||||
* Current version 0.14.1
|
||||
* Current version 0.14.5
|
||||
|
||||
Minetest mod for adding underground corridors with rails and wood constructions with a few treasure chests now and then.
|
||||
Optional support for the Treasurer mod is available for adding treasures from various mods.
|
||||
@ -9,7 +9,7 @@ Cobwebs are added if the `mobs_monster` mod is found.
|
||||
Use the advanced settings to finetune the railway corridors.
|
||||
|
||||
* Forum thread: https://forum.minetest.net/viewtopic.php?t=10339
|
||||
* License: MIT License.
|
||||
* License: MIT License (see `LICENSE.txt`).
|
||||
|
||||
## Info for game makers
|
||||
Want to include this mod in a game, but you have problems with the dependencies?
|
||||
|
21
init.lua
21
init.lua
@ -9,7 +9,6 @@ local treasurer_supported = minetest.get_modpath("treasurer") ~= nil
|
||||
local setting
|
||||
|
||||
-- Probability function
|
||||
-- TODO: Check if this is correct
|
||||
local P = function (float)
|
||||
return math.floor(32767 * float)
|
||||
end
|
||||
@ -150,7 +149,7 @@ local function SetNodeIfCanBuild(pos, node, check_above, can_replace_rail)
|
||||
if check_above then
|
||||
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
||||
local abovedef = minetest.registered_nodes[abovename]
|
||||
if abovename == "unknown" or abovename == "ignore" or
|
||||
if (not abovedef) or abovename == "unknown" or abovename == "ignore" or
|
||||
(abovedef.groups and abovedef.groups.attached_node) or
|
||||
-- This is done because cobwebs are often fake liquids
|
||||
(abovedef.liquidtype ~= "none" and abovename ~= tsm_railcorridors.nodes.cobweb) then
|
||||
@ -159,7 +158,7 @@ local function SetNodeIfCanBuild(pos, node, check_above, can_replace_rail)
|
||||
end
|
||||
local name = minetest.get_node(pos).name
|
||||
local def = minetest.registered_nodes[name]
|
||||
if name ~= "unknown" and name ~= "ignore" and
|
||||
if name ~= "unknown" and name ~= "ignore" and def and
|
||||
((def.is_ground_content and def.liquidtype == "none") or
|
||||
name == tsm_railcorridors.nodes.cobweb or
|
||||
name == tsm_railcorridors.nodes.torch_wall or
|
||||
@ -189,7 +188,7 @@ end
|
||||
local function IsGround(pos)
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local nodedef = minetest.registered_nodes[nodename]
|
||||
return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.is_ground_content and nodedef.walkable and nodedef.liquidtype == "none"
|
||||
return nodename ~= "unknown" and nodename ~= "ignore" and nodedef and nodedef.is_ground_content and nodedef.walkable and nodedef.liquidtype == "none"
|
||||
end
|
||||
|
||||
-- Returns true if rails are allowed to be placed on top of this node
|
||||
@ -197,7 +196,7 @@ local function IsRailSurface(pos)
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local nodename_above = minetest.get_node({x=pos.x,y=pos.y+2,z=pos.z}).name
|
||||
local nodedef = minetest.registered_nodes[nodename]
|
||||
return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodename_above ~= tsm_railcorridors.nodes.rail
|
||||
return nodename ~= "unknown" and nodename ~= "ignore" and nodedef and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodename_above ~= tsm_railcorridors.nodes.rail
|
||||
end
|
||||
|
||||
-- Checks if the node is empty space which requires to be filled by a platform
|
||||
@ -208,7 +207,7 @@ local function NeedsPlatform(pos)
|
||||
local falling = minetest.get_item_group(node.name, "falling_node") == 1
|
||||
return
|
||||
-- Node can be replaced if ground content or rail
|
||||
(node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content) and
|
||||
(nodedef and node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content) and
|
||||
-- Node needs platform if node below is not walkable.
|
||||
-- Unless 2 nodes below there is dirt: This is a special case for the starter cube.
|
||||
((nodedef.walkable == false and node2.name ~= tsm_railcorridors.nodes.dirt) or
|
||||
@ -234,7 +233,7 @@ end
|
||||
local function Cube(p, radius, node, replace_air_only, wood, post)
|
||||
local y_top = p.y+radius
|
||||
local nodedef = minetest.registered_nodes[node.name]
|
||||
local solid = nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none"
|
||||
local solid = nodedef and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none"
|
||||
-- Check if all the nodes could be set
|
||||
local built_all = true
|
||||
|
||||
@ -274,7 +273,7 @@ local function Cube(p, radius, node, replace_air_only, wood, post)
|
||||
elseif wood and (xi == p.x or zi == p.z) and thisnode.name == wood then
|
||||
local topnode = minetest.get_node({x=xi,y=yi+1,z=zi})
|
||||
local topdef = minetest.registered_nodes[topnode.name]
|
||||
if topdef.walkable and topnode.name ~= wood then
|
||||
if topdef and topdef.walkable and topnode.name ~= wood then
|
||||
minetest.set_node({x=xi,y=yi,z=zi}, node)
|
||||
-- Check for torches around the wood and schedule them
|
||||
-- for removal
|
||||
@ -471,7 +470,7 @@ local function TryPlaceCobweb(pos, needs_check, side_vector)
|
||||
local cpos = vector.add(pos, check_vectors[c])
|
||||
local cname = minetest.get_node(cpos).name
|
||||
local cdef = minetest.registered_nodes[cname]
|
||||
if cname ~= "ignore" and cdef.walkable then
|
||||
if cname ~= "ignore" and cdef and cdef.walkable then
|
||||
check_passed = true
|
||||
break
|
||||
end
|
||||
@ -565,12 +564,12 @@ local function WoodSupport(p, wood, post, torches, dir, torchdir)
|
||||
local nodedef1 = minetest.registered_nodes[minetest.get_node(pos1).name]
|
||||
local nodedef2 = minetest.registered_nodes[minetest.get_node(pos2).name]
|
||||
|
||||
if nodedef1.walkable then
|
||||
if nodedef1 and nodedef1.walkable then
|
||||
pos1.y = pos1.y + 1
|
||||
end
|
||||
SetNodeIfCanBuild(pos1, node, true)
|
||||
|
||||
if nodedef2.walkable then
|
||||
if nodedef2 and nodedef2.walkable then
|
||||
pos2.y = pos2.y + 1
|
||||
end
|
||||
SetNodeIfCanBuild(pos2, node, true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user