Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Emojigit committed Jan 5, 2024
1 parent f1b9d92 commit 0427a93
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 1 deletion.
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licenses of Train Gravels

## For code (zlib License)

Copyright © 2011-2024 Hugo Locurcio and contributors

**This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.**

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

## For media

Unless otherwise specified, More Blocks textures are licensed under [CC BY-SA 3.0 Unported](https://creativecommons.org/licenses/by-sa/3.0/).
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# train_gravels
# Train Gravels

This mod includes gravel blocks for advtrains. It is an extract of [LinuxForks's fork of moreblocks](https://git.bananach.space/moreblocks.git).

In addition, this mod fixes the hitbot of straight track slopes.
130 changes: 130 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
-- train_gravels/init.lua
-- Gravel-related blocks for advtrains
--[[
Copyright © 2011-2024 Hugo Locurcio and contributors.
Licensed under the zlib license. See LICENSE.md for more information.
]]

local S = minetest.get_translator("train_gravels")

local sound_gravel = default.node_sound_gravel_defaults()

-- Gravel Stonebrick

minetest.register_node("train_gravels:gravel_stonebrick", {
description = S("Gravel on Stonebrick"),
tiles = {
"default_gravel.png",
"default_stone_brick.png",
"default_gravel.png^[lowpart:50:default_stone_brick.png",
"default_gravel.png^[lowpart:50:default_stone_brick.png",
"default_gravel.png^[lowpart:50:default_stone_brick.png",
"default_gravel.png^[lowpart:50:default_stone_brick.png"
},
groups = { cracky = 3 },
sounds = sound_gravel,
})

minetest.register_alias("moreblocks:gravel_stonebrick", "train_gravels:gravel_stonebrick")

-- Gravel Slopes

local slopes = {
["2a"] = "half",
["2b"] = "half_raised",

["3a"] = "third",
["3b"] = "third_raised",
["3c"] = "third_top"
}

local box = {
["2a"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.375, 0.5 },
{ -0.5, -0.375, -0.25, 0.5, -0.25, 0.5 },
{ -0.5, -0.25, 0, 0.5, -0.125, 0.5 },
{ -0.5, -0.125, 0.25, 0.5, 0, 0.5 },
}
},
["2b"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.125, 0.5 },
{ -0.5, 0.125, -0.25, 0.5, 0.25, 0.5 },
{ -0.5, 0.25, 0, 0.5, 0.375, 0.5 },
{ -0.5, 0.375, 0.25, 0.5, 0.5, 0.5 },
}
},

["3a"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.417, 0.5 },
{ -0.5, -0.417, -0.25, 0.5, -0.333, 0.5 },
{ -0.5, -0.333, 0, 0.5, -0.250, 0.5 },
{ -0.5, -0.250, 0.25, 0.5, -0.167, 0.5 },
}
},
["3b"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.083, 0.5 },
{ -0.5, -0.083, -0.25, 0.5, 0, 0.5 },
{ -0.5, 0, 0, 0.5, 0.083, 0.5 },
{ -0.5, 0.083, 0.25, 0.5, 0.167, 0.5 },
}
},
["3c"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.250, 0.5 },
{ -0.5, 0.250, -0.25, 0.5, 0.333, 0.5 },
{ -0.5, 0.333, 0, 0.5, 0.417, 0.5 },
{ -0.5, 0.417, 0.25, 0.5, 0.5, 0.5 },
}
}
}

for id, mod in pairs(slopes) do
minetest.register_node("train_gravels:gravel_slope_" .. id, {
description = S("Gravel Slop @1", id),
tiles = { "default_gravel.png" },
groups = { crumbly = 2, falling_node = 1, not_blocking_trains = 1 },
sounds = sound_gravel,
drawtype = "mesh",
mesh = "train_gravels_slope_" .. mod .. ".obj",
selection_box = box[id],
collision_box = box[id],
sunlight_propagates = false,
light_source = 0,
paramtype = "light",
paramtype2 = "facedir",
on_rotate = screwdriver and screwdriver.rotate_simple,
is_ground_content = false,
})

minetest.register_alias("moreblocks:gravel_slope_" .. id, "train_gravels:gravel_slope_" .. id)
end

-- Advtrains Track Slope (Straight) hitbox fix

if minetest.get_modpath("advtrains_train_track") then
local vst_map = {
vst1 = "2a",
vst2 = "2b",

vst31 = "3a",
vst32 = "3b",
vst33 = "3c"
}

for orig, id in pairs(vst_map) do
minetest.override_item("advtrains:dtrack_" .. orig, {
walkable = true,
selection_box = box[id],
collision_box = box[id],
})
end
end
5 changes: 5 additions & 0 deletions mod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = train_gravels
title = Train Gravels
description = Gravel-related blocks for advtrains
depends = default
optional_depends = screwdriver, advtrains_train_track

0 comments on commit 0427a93

Please sign in to comment.