Updated internal skylands mod, added mods
Now uses SkyLands 3.1. Added BlockMen's bone mod and Kilarin's bridgetool.
BIN
mods/bone-0_3-BlockMen.zip
Normal file
30
mods/bone/README.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
Minetest mod "Bone"
|
||||||
|
=======================
|
||||||
|
version: 0.3
|
||||||
|
|
||||||
|
License of source code and textures:
|
||||||
|
------------------------------------
|
||||||
|
Written 2013 by BlockMen
|
||||||
|
|
||||||
|
This program is free software. It comes without any warranty, to
|
||||||
|
the extent permitted by applicable law. You can redistribute it
|
||||||
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
|
To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
|
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
|
||||||
|
|
||||||
|
tree_generation based on PilzAdam's farming mod
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--USING the mod--
|
||||||
|
|
||||||
|
This mod "forces" dirt to drop Bones randomly with rarity = 50 (2%)
|
||||||
|
|
||||||
|
The bones can be crafted to bonemeal, which lets grow grass and flowers (remind that flowers are only
|
||||||
|
in survival and build games are useable).
|
||||||
|
|
||||||
|
Furthermore it lets trees grow instantly and supports PilzAdam's farming mod. The wheat, cotton and pumpkin need
|
||||||
|
a random number of bonemeal to get full grown.
|
1
mods/bone/depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
250
mods/bone/init.lua
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
minetest.register_node(":default:dirt", {
|
||||||
|
description = "Dirt",
|
||||||
|
tiles = {"default_dirt.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=3},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{
|
||||||
|
items = {'bone:bone', 'default:dirt'},
|
||||||
|
rarity = 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
items = {'default:dirt'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node(":default:dirt_with_grass", {
|
||||||
|
description = "Dirt with Grass",
|
||||||
|
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=3},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{
|
||||||
|
items = {'bone:bone', 'default:dirt'},
|
||||||
|
rarity = 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
items = {'default:dirt'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_grass_footstep", gain=0.4},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("bone:bone", {
|
||||||
|
description = "Bone",
|
||||||
|
inventory_image = "bone_bone.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'bone:bonemeal 5',
|
||||||
|
recipe = {{'bone:bone'}}
|
||||||
|
})
|
||||||
|
|
||||||
|
local n
|
||||||
|
local n2
|
||||||
|
local pos
|
||||||
|
|
||||||
|
function apple_leave()
|
||||||
|
if math.random(0, 10) == 3 then
|
||||||
|
return {name = "default:apple"}
|
||||||
|
else
|
||||||
|
return {name = "default:leaves"}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function air_leave()
|
||||||
|
if math.random(0, 50) == 3 then
|
||||||
|
return {name = "air"}
|
||||||
|
else
|
||||||
|
return {name = "default:leaves"}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function generate_tree(pos, trunk, leaves)
|
||||||
|
pos.y = pos.y-1
|
||||||
|
local nodename = minetest.env:get_node(pos).name
|
||||||
|
|
||||||
|
pos.y = pos.y+1
|
||||||
|
if not minetest.env:get_node_light(pos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
node = {name = ""}
|
||||||
|
for dy=1,4 do
|
||||||
|
pos.y = pos.y+dy
|
||||||
|
if minetest.env:get_node(pos).name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pos.y = pos.y-dy
|
||||||
|
end
|
||||||
|
node = {name = "default:tree"}
|
||||||
|
for dy=0,4 do
|
||||||
|
pos.y = pos.y+dy
|
||||||
|
minetest.env:set_node(pos, node)
|
||||||
|
pos.y = pos.y-dy
|
||||||
|
end
|
||||||
|
|
||||||
|
node = {name = "default:leaves"}
|
||||||
|
pos.y = pos.y+3
|
||||||
|
local rarity = 0
|
||||||
|
if math.random(0, 10) == 3 then
|
||||||
|
rarity = 1
|
||||||
|
end
|
||||||
|
for dx=-2,2 do
|
||||||
|
for dz=-2,2 do
|
||||||
|
for dy=0,3 do
|
||||||
|
pos.x = pos.x+dx
|
||||||
|
pos.y = pos.y+dy
|
||||||
|
pos.z = pos.z+dz
|
||||||
|
|
||||||
|
if dx == 0 and dz == 0 and dy==3 then
|
||||||
|
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||||
|
minetest.env:set_node(pos, node)
|
||||||
|
if rarity == 1 then
|
||||||
|
minetest.env:set_node(pos, apple_leave())
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, air_leave())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif dx == 0 and dz == 0 and dy==4 then
|
||||||
|
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||||
|
minetest.env:set_node(pos, node)
|
||||||
|
if rarity == 1 then
|
||||||
|
minetest.env:set_node(pos, apple_leave())
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, air_leave())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||||
|
if minetest.env:get_node(pos).name == "air" then
|
||||||
|
minetest.env:set_node(pos, node)
|
||||||
|
if rarity == 1 then
|
||||||
|
minetest.env:set_node(pos, apple_leave())
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, air_leave())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||||
|
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||||
|
minetest.env:set_node(pos, node)
|
||||||
|
if rarity == 1 then
|
||||||
|
minetest.env:set_node(pos, apple_leave())
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, air_leave())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
pos.x = pos.x-dx
|
||||||
|
pos.y = pos.y-dy
|
||||||
|
pos.z = pos.z-dz
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local plant_tab = {}
|
||||||
|
local rnd_max = 5
|
||||||
|
minetest.after(0.5, function()
|
||||||
|
plant_tab[0] = "air"
|
||||||
|
plant_tab[1] = "default:grass_1"
|
||||||
|
plant_tab[2] = "default:grass_2"
|
||||||
|
plant_tab[3] = "default:grass_3"
|
||||||
|
plant_tab[4] = "default:grass_4"
|
||||||
|
plant_tab[5] = "default:grass_5"
|
||||||
|
|
||||||
|
if minetest.get_modpath("flowers") ~= nil then
|
||||||
|
rnd_max = 11
|
||||||
|
plant_tab[6] = "flowers:dandelion_white"
|
||||||
|
plant_tab[7] = "flowers:dandelion_yellow"
|
||||||
|
plant_tab[8] = "flowers:geranium"
|
||||||
|
plant_tab[9] = "flowers:rose"
|
||||||
|
plant_tab[10] = "flowers:tulip"
|
||||||
|
plant_tab[11] = "flowers:viola"
|
||||||
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function duengen(pointed_thing)
|
||||||
|
pos = pointed_thing.under
|
||||||
|
n = minetest.env:get_node(pos)
|
||||||
|
if n.name == "" then return end
|
||||||
|
local stage = ""
|
||||||
|
if n.name == "default:sapling" then
|
||||||
|
minetest.env:set_node(pos, {name="air"})
|
||||||
|
generate_tree(pos, "default:tree", "default:leaves")
|
||||||
|
elseif string.find(n.name, "farming:wheat_") ~= nil then
|
||||||
|
stage = string.sub(n.name, 15)
|
||||||
|
if stage == "3" then
|
||||||
|
minetest.env:set_node(pos, {name="farming:wheat"})
|
||||||
|
elseif math.random(1,5) < 3 then
|
||||||
|
minetest.env:set_node(pos, {name="farming:wheat"})
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, {name="farming:wheat_"..math.random(2,3)})
|
||||||
|
end
|
||||||
|
elseif string.find(n.name, "farming:cotton_") ~= nil then
|
||||||
|
stage = tonumber(string.sub(n.name, 16))
|
||||||
|
if stage == 1 then
|
||||||
|
minetest.env:set_node(pos, {name="farming:cotton_"..math.random(stage,2)})
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, {name="farming:cotton"})
|
||||||
|
end
|
||||||
|
elseif string.find(n.name, "farming:pumpkin_") ~= nil then
|
||||||
|
stage = tonumber(string.sub(n.name, 17))
|
||||||
|
if stage == 1 then
|
||||||
|
minetest.env:set_node(pos, {name="farming:pumpkin_"..math.random(stage,2)})
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, {name="farming:pumpkin"})
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif n.name == "default:dirt_with_grass" then
|
||||||
|
for i = -2, 3, 1 do
|
||||||
|
for j = -3, 2, 1 do
|
||||||
|
pos = pointed_thing.above
|
||||||
|
pos = {x=pos.x+i, y=pos.y, z=pos.z+j}
|
||||||
|
n = minetest.env:get_node(pos)
|
||||||
|
n2 = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
|
|
||||||
|
if n.name ~= "" and n.name == "air" and n2.name == "default:dirt_with_grass" then
|
||||||
|
if math.random(0,5) > 3 then
|
||||||
|
minetest.env:set_node(pos, {name=plant_tab[math.random(0, rnd_max)]})
|
||||||
|
else
|
||||||
|
minetest.env:set_node(pos, {name=plant_tab[math.random(0, 5)]})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("bone:bonemeal", {
|
||||||
|
description = "Bone Meal",
|
||||||
|
inventory_image = "bone_bonemeal.png",
|
||||||
|
liquids_pointable = false,
|
||||||
|
stack_max = 99,
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing.type == "node" then
|
||||||
|
duengen(pointed_thing)
|
||||||
|
itemstack:take_item()
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
BIN
mods/bone/textures/Thumbs.db
Normal file
BIN
mods/bone/textures/bone_bone.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
mods/bone/textures/bone_bonemeal.png
Normal file
After Width: | Height: | Size: 375 B |
88
mods/bridgetool/README.md
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
This mod adds a new "bridge tool" that makes placing stone (or glass, earth, or any material) while building a bridge in no-fly mode easy.
|
||||||
|
|
||||||
|
**Bridge Tool Version 2.1**
|
||||||
|
|
||||||
|
The bridge tool has 3 modes that can be switched by left clicking with the tool.<p>
|
||||||
|
And you can switch the WIDTH of the path built by holding down the SNEAK key and left clicking.<p>
|
||||||
|
![alt text](http://i61.tinypic.com/2uqf6f8.png "image")<p>
|
||||||
|
The inventory image changes with the mode indicates exactly how the bridge tool builds in that mode. For width of 2 and 3 you will note either 2 or 3 little blue squares appear below the main image to let you know what the width is.
|
||||||
|
|
||||||
|
On a right click, the bridge tool will attempt to use whatever material is in the inventory slot directly to the right of the bridge tool to build in the direction indicated by the mode
|
||||||
|
|
||||||
|
In **mode 1** it will build **FORWARD** in a straight line:<p>
|
||||||
|
![alt text](http://i58.tinypic.com/f42t0.png "image")<p>
|
||||||
|
This saves you a lot of time pressing the sneak button and leaning over the edge so you can click on the outward face of the node. Please note that the bridge tool can build out in any of the 4 directions depending on what way you are facing when you right click.
|
||||||
|
|
||||||
|
In **mode 2** the bridge tool builds **DOWN** diagonally:<p>
|
||||||
|
![alt text](http://i57.tinypic.com/296kizk.png "image")<p>
|
||||||
|
This is perhaps the most important function of the bridge tool because what seems like it should be simple, building down from a bridge you are standing on, is virtually impossible without this tool.
|
||||||
|
|
||||||
|
In **mode 3** the bridge tool builds **UP** diagonally:<p>
|
||||||
|
![alt text](http://i58.tinypic.com/28l4duq.png "image")<p>
|
||||||
|
This is not hard to do without the tool, but using the tool saves you several steps.
|
||||||
|
|
||||||
|
And when you select a **width** of 2 or 3 by holding down the sneak button and left clicking the tool will build a path of that width:<p>
|
||||||
|
![alt text](http://i57.tinypic.com/s2wv3p.png "image")<p>
|
||||||
|
![alt text](http://i58.tinypic.com/mwpn5w.png "image")
|
||||||
|
|
||||||
|
If the bridge tool can not build where you asked it to, or if it runs out of material in the stack to the right of the tool, it will notify you of the problem via chat message.
|
||||||
|
|
||||||
|
The bridge tool is crafted using 3 steel ingots in a v shape, and one mese crystal:<p>
|
||||||
|
```
|
||||||
|
steel ingot, ,steel ingot
|
||||||
|
, steel ingot ,
|
||||||
|
,mese crystal fragment,
|
||||||
|
```
|
||||||
|
![alt text](http://i57.tinypic.com/1zgay6f.png "image")<p>
|
||||||
|
The inventory image will switch from the tool itself to the mode image the first time you left click with the tool.
|
||||||
|
|
||||||
|
The bridge tool automatically orients **stairs** in the proper direction. When building a 3 node wide stair, the tool will ensure that all stairs point the correct direction. And when building forward, the tool will orient the stair downward.
|
||||||
|
|
||||||
|
And the bridge tool is now configured to wear out. If you wish to implement this feature edit the init.lua and change the value of WEAR_PER_USE from 0 to whatever you wish. (Max wear is 65535 and wear will be applied for each node of width of the path you are building)
|
||||||
|
|
||||||
|
**Video:**<p>
|
||||||
|
Excalibur Zero created a video demonstrating this mod:<p>
|
||||||
|
[https://www.youtube.com/watch?v=j2E9ojtyitc](https://www.youtube.com/watch?v=j2E9ojtyitc)
|
||||||
|
|
||||||
|
**Author:** Kilarin (Donald Hines)
|
||||||
|
|
||||||
|
**Credits:**<p>
|
||||||
|
My son helped me with some ideas for this mod. I got a lot of code examples from the screwdriver mod in minetest_game by RealBadAngel, Maciej Kasatkin. I also copied and modified the screwdriver's mode number images for use in the bridge tool inventory images.<p>
|
||||||
|
Topywo suggested adding wear, correcting down stair orientation, and using not_in_creative_inventory. Sokomine suggested adding width so that you could build 2 or 3 wide.
|
||||||
|
|
||||||
|
**Dependencies:**<p>
|
||||||
|
default
|
||||||
|
|
||||||
|
**Incompatibilities:**<p>
|
||||||
|
Problems have been reported when using this mod with inventory tweak
|
||||||
|
|
||||||
|
**License:**<p>
|
||||||
|
code CC0, textures CC BY-SA 3.0
|
||||||
|
|
||||||
|
**github source:**<p>
|
||||||
|
[https://github.com/Kilarin/minetest-mod-bridgetool](https://github.com/Kilarin/minetest-mod-bridgetool)
|
||||||
|
|
||||||
|
**Download:**<p>
|
||||||
|
[https://github.com/Kilarin/minetest-mod-bridgetool/archive/master.zip](https://github.com/Kilarin/minetest-mod-bridgetool/archive/master.zip)
|
||||||
|
|
||||||
|
**To install:**<p>
|
||||||
|
Simply unzip the file into your mods folder, then rename the resulting folder from minetest-mod-bridgetool-master to bridgetool<p>
|
||||||
|
OR, simply install it directly from minetest using the online mod repository.
|
||||||
|
|
||||||
|
**Mod Database:**<p>
|
||||||
|
If you use this mod, please consider reviewing it on the MineTest Mod Database.<p>
|
||||||
|
[https://forum.minetest.net/mmdb/mod/bridgetool/](https://forum.minetest.net/mmdb/mod/bridgetool/)
|
||||||
|
|
||||||
|
**Changelog**<p>
|
||||||
|
--Version 2.1<p>
|
||||||
|
Corrected fact that 3 wide stairs would sometimes orient the 3rd stair the wrong way<p>
|
||||||
|
Modified stair orientation when using mode 1(forward) so that the stair will face down (since the only reason you would use the "forward" option with this tool and a staircase is to begin a down stair.)
|
||||||
|
|
||||||
|
---Version 2.0<p>
|
||||||
|
Added width of 2 or 3<p>
|
||||||
|
corrected down stair orientation<p>
|
||||||
|
added not_in_creative_inventory=1 to all of the "mode" versions of the tool<p>
|
||||||
|
added wear option
|
||||||
|
|
||||||
|
---Version 1.0<p>
|
||||||
|
Initial release
|
87
mods/bridgetool/README.txt
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
[b]Bridge Tool Version 2.1[/b]
|
||||||
|
This mod adds a new "bridge tool" that makes placing stone (or glass, earth, or any material) while building a bridge in no-fly mode easy.
|
||||||
|
|
||||||
|
The bridge tool has 3 modes that can be switched by left clicking with the tool.
|
||||||
|
And you can switch the WIDTH of the path built by holding down the SNEAK key and left clicking.
|
||||||
|
[img]http://i61.tinypic.com/2uqf6f8.png[/img]
|
||||||
|
The inventory image changes with the mode indicates exactly how the bridge tool builds in that mode. For width of 2 and 3 you will note either 2 or 3 little blue squares appear below the main image to let you know what the width is.
|
||||||
|
|
||||||
|
On a right click, the bridge tool will attempt to use whatever material is in the inventory slot directly to the right of the bridge tool to build in the direction indicated by the mode
|
||||||
|
|
||||||
|
In [b]mode 1[/b] it will build [b]FORWARD[/b] in a straight line:
|
||||||
|
[img]http://i58.tinypic.com/f42t0.png[/img]
|
||||||
|
This saves you a lot of time pressing the sneak button and leaning over the edge so you can click on the outward face of the node. Please note that the bridge tool can build out in any of the 4 directions depending on what way you are facing when you right click.
|
||||||
|
|
||||||
|
In [b]mode 2[/b] the bridge tool builds [b]DOWN[/b] diagonally:
|
||||||
|
[img]http://i57.tinypic.com/296kizk.png[/img]
|
||||||
|
This is perhaps the most important function of the bridge tool because what seems like it should be simple, building down from a bridge you are standing on, is virtually impossible without this tool.
|
||||||
|
|
||||||
|
In [b]mode 3[/b] the bridge tool builds [b]UP[/b] diagonally:
|
||||||
|
[img]http://i58.tinypic.com/28l4duq.png[/img]
|
||||||
|
This is not hard to do without the tool, but using the tool saves you several steps.
|
||||||
|
|
||||||
|
And when you select a [b]width[/b] of 2 or 3 by holding down the sneak button and left clicking the tool will build a path of that width:
|
||||||
|
[img]http://i57.tinypic.com/s2wv3p.png[/img]
|
||||||
|
[img]http://i58.tinypic.com/mwpn5w.png[/img]
|
||||||
|
|
||||||
|
If the bridge tool can not build where you asked it to, or if it runs out of material in the stack to the right of the tool, it will notify you of the problem via chat message.
|
||||||
|
|
||||||
|
The bridge tool is crafted using 3 steel ingots in a v shape, and one mese crystal:
|
||||||
|
[code]
|
||||||
|
steel ingot, ,steel ingot
|
||||||
|
, steel ingot ,
|
||||||
|
,mese crystal fragment,
|
||||||
|
[/code]
|
||||||
|
[img]http://i57.tinypic.com/1zgay6f.png[/img]
|
||||||
|
The inventory image will switch from the tool itself to the mode image the first time you left click with the tool.
|
||||||
|
|
||||||
|
The bridge tool automatically orients [b]stairs[/b] in the proper direction. When building a 3 node wide stair, the tool will ensure that all stairs point the correct direction. And when building forward, the tool will orient the stair downward.
|
||||||
|
|
||||||
|
And the bridge tool is now configured to wear out. If you wish to implement this feature edit the init.lua and change the value of WEAR_PER_USE from 0 to whatever you wish. (Max wear is 65535 and wear will be applied for each node of width of the path you are building)
|
||||||
|
|
||||||
|
[b]Video:[/b]
|
||||||
|
Excalibur Zero created a video demonstrating this mod:
|
||||||
|
[url]https://www.youtube.com/watch?v=j2E9ojtyitc[/url]
|
||||||
|
|
||||||
|
[b]Author:[/b] Kilarin (Donald Hines)
|
||||||
|
|
||||||
|
[b]Credits:[/b]
|
||||||
|
My son helped me with some ideas for this mod. I got a lot of code examples from the screwdriver mod in minetest_game by RealBadAngel, Maciej Kasatkin. I also copied and modified the screwdriver's mode number images for use in the bridge tool inventory images.
|
||||||
|
Topywo suggested adding wear, correcting down stair orientation, and using not_in_creative_inventory. Sokomine suggested adding width so that you could build 2 or 3 wide.
|
||||||
|
|
||||||
|
[b]Dependencies:[/b]
|
||||||
|
default
|
||||||
|
|
||||||
|
[b]Incompatibilities:[/b]
|
||||||
|
Problems have been reported when using this mod with inventory tweak
|
||||||
|
|
||||||
|
[b]License:[/b]
|
||||||
|
code CC0, textures CC BY-SA 3.0
|
||||||
|
|
||||||
|
[b]github source:[/b]
|
||||||
|
[url]https://github.com/Kilarin/minetest-mod-bridgetool[/url]
|
||||||
|
|
||||||
|
[b]Download:[/b]
|
||||||
|
[url]https://github.com/Kilarin/minetest-mod-bridgetool/archive/master.zip[/url]
|
||||||
|
|
||||||
|
[b]To install:[/b]
|
||||||
|
Simply unzip the file into your mods folder, then rename the resulting folder from minetest-mod-bridgetool-master to bridgetool
|
||||||
|
OR, simply install it directly from minetest using the online mod repository.
|
||||||
|
|
||||||
|
[b]Mod Database:[/b]
|
||||||
|
If you use this mod, please consider reviewing it on the MineTest Mod Database.
|
||||||
|
[url]https://forum.minetest.net/mmdb/mod/bridgetool/[/url]
|
||||||
|
|
||||||
|
[b]Changelog[/b]
|
||||||
|
--Version 2.1
|
||||||
|
Corrected fact that 3 wide stairs would sometimes orient the 3rd stair the wrong way
|
||||||
|
Modified stair orientation when using mode 1(forward) so that the stair will face down (since the only reason you would use the "forward" option with this tool and a staircase is to begin a down stair.)
|
||||||
|
|
||||||
|
---Version 2.0
|
||||||
|
Added width of 2 or 3
|
||||||
|
corrected down stair orientation
|
||||||
|
added not_in_creative_inventory=1 to all of the "mode" versions of the tool
|
||||||
|
added wear option
|
||||||
|
|
||||||
|
---Version 1.0
|
||||||
|
Initial release
|
1
mods/bridgetool/depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
293
mods/bridgetool/init.lua
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
-----------------------------
|
||||||
|
-- Bridge Tool version 2.1 --
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
--This code was written by Kilarin (Donald Hines)
|
||||||
|
--License:CC0, you can do whatever you wish with it.
|
||||||
|
--The numbers for the modes in the textures for this mode were copied and modified from
|
||||||
|
--the screwdriver mod by RealBadAngel, Maciej Kasatkin (which were originally licensed
|
||||||
|
--as CC BY-SA
|
||||||
|
--Topywo suggested adding wear, correcting down stair orientation, and using not_in_creative_inventory=1
|
||||||
|
--Sokomine suggested adding width so that you could build 2 or 3 wide.
|
||||||
|
|
||||||
|
local bridgetool = {
|
||||||
|
--set this value to something higher than zero if you want bridge tool to wear out
|
||||||
|
WEAR_PER_USE=0
|
||||||
|
}
|
||||||
|
|
||||||
|
local mode_text = {
|
||||||
|
{"Forward"},
|
||||||
|
{"Down"},
|
||||||
|
{"Up"}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function yaw_in_degrees(player)
|
||||||
|
local yaw = player:get_look_yaw()*180/math.pi-90
|
||||||
|
while yaw < 0 do yaw=yaw+360 end
|
||||||
|
while yaw >360 do yaw=yaw-360 end
|
||||||
|
return yaw
|
||||||
|
end
|
||||||
|
|
||||||
|
function rotate_yaw(yaw,rotate)
|
||||||
|
local newyaw=yaw+rotate
|
||||||
|
if newyaw>360 then newyaw=newyaw-360 end
|
||||||
|
if newyaw<0 then newyaw=newyaw+360 end
|
||||||
|
return newyaw
|
||||||
|
end --rotate_yaw
|
||||||
|
|
||||||
|
|
||||||
|
--returns a node that has been offset in the indicated direction
|
||||||
|
--0+z,90-x,180-z,270+x: and <0 down -y, >360 up +y
|
||||||
|
--I really could have, and probably should have, done this in radians.
|
||||||
|
--But I've always liked degrees better.
|
||||||
|
function offset_pos(posin,yaw)
|
||||||
|
--print("** offset_pos yaw=",yaw," posin=",pos_to_string(posin))
|
||||||
|
local posout = {x=posin.x,y=posin.y,z=posin.z}
|
||||||
|
if yaw<0 then --DOWN
|
||||||
|
posout.y=posout.y-1
|
||||||
|
elseif yaw>360 then --UP
|
||||||
|
posout.y=posout.y+1
|
||||||
|
elseif yaw>315 or yaw<45 then --FORWARD
|
||||||
|
posout.z=posout.z+1
|
||||||
|
elseif yaw<135 then --RIGHT
|
||||||
|
posout.x=posout.x-1
|
||||||
|
elseif yaw<225 then --BACK
|
||||||
|
posout.z=posout.z-1
|
||||||
|
else --LEFT
|
||||||
|
posout.x=posout.x+1
|
||||||
|
end --yaw
|
||||||
|
return posout
|
||||||
|
end --offset_pos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--because built in pos_to_string doesn't handle nil
|
||||||
|
function pos_to_string(pos)
|
||||||
|
if pos==nil then return "(nil)"
|
||||||
|
else return minetest.pos_to_string(pos)
|
||||||
|
end --poss==nill
|
||||||
|
end --pos_to_string
|
||||||
|
|
||||||
|
|
||||||
|
--attempts to place the item and update inventory
|
||||||
|
function item_place(stack,player,pointed,inv,idx,mode,firststairface)
|
||||||
|
if firststairface==nil then firststairface=-2 end
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
--minetest.chat_send_player(player_name,"--placing pointed.type="..pointed.type.." above "..pos_to_string(pointed.above).." under "..pos_to_string(pointed.under).." stack="..stack:to_string())
|
||||||
|
local success
|
||||||
|
stack, success = minetest.item_place(stack, player, pointed)
|
||||||
|
if success then --if item was placed, put modified stack back in inv
|
||||||
|
inv:set_stack("main", idx, stack)
|
||||||
|
--also check for rotation of stairs
|
||||||
|
local itemname=stack:get_name()
|
||||||
|
--minetest.chat_send_player(player_name,"name="..itemname.." gig="..minetest.get_item_group(itemname,"stairs"))
|
||||||
|
--should be able to do this with get_item_group but I cant make it work
|
||||||
|
if itemname~=nil and string.len(itemname)>7 and
|
||||||
|
string.sub(itemname,1,7)=="stairs:" then --and item is stairs
|
||||||
|
local node = minetest.get_node(pointed.above)
|
||||||
|
--if firststairface is set, then make all other stairs match same direction
|
||||||
|
if firststairface>-1 and node.param2~=firststairface then
|
||||||
|
node.param2=firststairface
|
||||||
|
minetest.swap_node(pointed.above, node)
|
||||||
|
elseif mode~=nil and mode==1 or mode==2 then -- if mode=1(fwd) or 2(down) need to rotate stair
|
||||||
|
node.param2=node.param2+2
|
||||||
|
if node.param2>3 then node.param2=node.param2-4 end
|
||||||
|
minetest.swap_node(pointed.above, node)
|
||||||
|
end
|
||||||
|
firststairface=node.param2
|
||||||
|
end --stair
|
||||||
|
end --success
|
||||||
|
return stack,success,firststairface
|
||||||
|
end --item_place
|
||||||
|
|
||||||
|
|
||||||
|
-- add wear and tear to the bridge tool
|
||||||
|
function bridgetool_wear(item)
|
||||||
|
if bridgetool.WEAR_PER_USE > 0 then
|
||||||
|
local item_wear = tonumber(item:get_wear())
|
||||||
|
item_wear = item_wear + bridgetool.WEAR_PER_USE
|
||||||
|
if item_wear > 65535 then
|
||||||
|
item:clear()
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
item:set_wear(item_wear)
|
||||||
|
return item
|
||||||
|
else
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
end --bridgetool_wear
|
||||||
|
|
||||||
|
|
||||||
|
--This function is for use when the bridge tool is right clicked
|
||||||
|
--it finds the inventory item stack immediatly to the right of the bridge tool
|
||||||
|
--and then places THAT stack (if possible)
|
||||||
|
function bridgetool_place(item, player, pointed)
|
||||||
|
local player_name = player:get_player_name() --for chat messages
|
||||||
|
--find index of item to right of wielded tool
|
||||||
|
--(could have gotten this directly from item I suppose, but this works fine)
|
||||||
|
local idx = player:get_wield_index() + 1
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local stack = inv:get_stack("main", idx) --stack=stack to right of tool
|
||||||
|
if stack:is_empty() then
|
||||||
|
minetest.chat_send_player(player_name,"bridge tool: no more material to place in stack to right of bridge tool")
|
||||||
|
end --stack:is_empty
|
||||||
|
if stack:is_empty()==false and pointed ~= nil then
|
||||||
|
local success
|
||||||
|
local yaw = yaw_in_degrees(player) --cause degrees just work better for my brain
|
||||||
|
--------------
|
||||||
|
local mode
|
||||||
|
local width
|
||||||
|
mode,width=get_bridgetool_meta(item)
|
||||||
|
if not mode then
|
||||||
|
item=bridgetool_switchmode(item,player,pointed)
|
||||||
|
mode,width=get_bridgetool_meta(item)
|
||||||
|
end
|
||||||
|
|
||||||
|
--minetest.chat_send_player(player_name, "pointed.type="..pointed.type.." above "..pos_to_string(pointed.above).." under "..pos_to_string(pointed.under).." yaw="..yaw.." mode="..mode)
|
||||||
|
if pointed.type=="node" and pointed.under ~= nil then
|
||||||
|
--all three modes start by placing a block forward in the yaw direction
|
||||||
|
--under does not change, but above is altered to point to node forward(yaw) from under
|
||||||
|
pointed.above=offset_pos(pointed.under,yaw)
|
||||||
|
local holdforward=pointed.above --store for later deletion in mode 2 and 3
|
||||||
|
local firststairface
|
||||||
|
stack,success,firststairface=item_place(stack,player,pointed,inv,idx,mode,-1) --place the forward block
|
||||||
|
if not success then
|
||||||
|
minetest.chat_send_player(player_name, "bridge tool: unable to place Forward at "..pos_to_string(pointed.above))
|
||||||
|
elseif mode==2 or mode==3 then --elseif means successs=true, check Mode up or down
|
||||||
|
--mode 2 and 3 then add another block either up or down from the forward block
|
||||||
|
--and remove the forward block
|
||||||
|
---move pointed under to the new block you just placed
|
||||||
|
pointed.under=pointed.above
|
||||||
|
if mode==2 then
|
||||||
|
--try to place beneath the new block
|
||||||
|
pointed.above=offset_pos(pointed.under,-1)
|
||||||
|
else --mode==3
|
||||||
|
--try to place above the new block
|
||||||
|
pointed.above=offset_pos(pointed.under,999)
|
||||||
|
end --mode 2 - 3
|
||||||
|
stack,success=item_place(stack,player,pointed,inv,idx,mode,firststairface)
|
||||||
|
if not success then
|
||||||
|
minetest.chat_send_player(player_name, "bridge tool: unable to place "..mode_text[mode][1].." at "..pos_to_string(pointed.above))
|
||||||
|
end --if not success block 2
|
||||||
|
--remove the extra stone whether success on block 2 or not
|
||||||
|
minetest.node_dig(holdforward,minetest.get_node(holdforward),player)
|
||||||
|
end -- if not success block 1 elseif succes block 1 and mode 2 or 3
|
||||||
|
|
||||||
|
--now try for the width
|
||||||
|
if success then --only proceed with width if last block placed was a success
|
||||||
|
item=bridgetool_wear(item)
|
||||||
|
for w=2,width do
|
||||||
|
pointed.under=pointed.above --block 2 is now the under block
|
||||||
|
local right90=rotate_yaw(yaw,-90)
|
||||||
|
pointed.above=offset_pos(pointed.under,right90)
|
||||||
|
--minetest.chat_send_player(player_name, " yaw="..yaw.." right90="..right90.." under="..pos_to_string(pointed.under).." above="..pos_to_string(pointed.above))
|
||||||
|
stack,success=item_place(stack,player,pointed,inv,idx,mode,firststairface)
|
||||||
|
if not success then
|
||||||
|
minetest.chat_send_player(player_name, "bridge tool: unable to place width "..w.." at "..pos_to_string(pointed.above))
|
||||||
|
break
|
||||||
|
else
|
||||||
|
item=bridgetool_wear(item)
|
||||||
|
end --if not success
|
||||||
|
end --for
|
||||||
|
end --if success
|
||||||
|
|
||||||
|
end --pointed.type="node" and pointed.under~=nil
|
||||||
|
end --pointed ~= nil
|
||||||
|
return item
|
||||||
|
end --function bridgetool_place
|
||||||
|
|
||||||
|
|
||||||
|
--returns mode and width
|
||||||
|
function get_bridgetool_meta(item)
|
||||||
|
local metadata = item:get_metadata()
|
||||||
|
if not metadata or string.len(metadata)<3 then
|
||||||
|
--not metadata means mode and width have never been set
|
||||||
|
--metadata<3 means tool was created with a bridgetool 1.0 and doesn't have width set
|
||||||
|
return nil, nil
|
||||||
|
else --valid metadata
|
||||||
|
local mode=tonumber(string.sub(metadata,1,1))
|
||||||
|
local width=tonumber(string.sub(metadata,3,3))
|
||||||
|
return mode, width
|
||||||
|
end -- if not metadata
|
||||||
|
end --get_bridgetool_meta
|
||||||
|
|
||||||
|
|
||||||
|
--on left click switch the mode of the bridge tool
|
||||||
|
--also deals with sneak-leftclick which sets width
|
||||||
|
function bridgetool_switchmode(item, player, pointed) --pointed is ignored
|
||||||
|
local player_name = player:get_player_name() --for chat messages
|
||||||
|
mode,width=get_bridgetool_meta(item)
|
||||||
|
if mode==nil or width==nil then
|
||||||
|
--if item has not been used and mode not set yet,
|
||||||
|
--or a pre-width item that needs to have width added
|
||||||
|
minetest.chat_send_player(player_name, "Left click to change mode between 1:Forward, 2:Down, 3:Up, Leftclick+Sneak to change width, Right click to place, uses inventory stack directly to right of bridge tool")
|
||||||
|
mode=1
|
||||||
|
width=1
|
||||||
|
else --valid mode and width
|
||||||
|
local keys = player:get_player_control()
|
||||||
|
if keys["sneak"] == true then
|
||||||
|
width=width+1
|
||||||
|
if width>3 then width=1 end
|
||||||
|
else
|
||||||
|
mode=mode+1
|
||||||
|
if mode>3 then mode=1 end
|
||||||
|
end --if sneak
|
||||||
|
end --not mode==nil
|
||||||
|
--minetest.chat_send_player(player_name, "bridge tool mode : "..mode.." - "..mode_text[mode][1].." width="..width)
|
||||||
|
item:set_name("bridgetool:bridge_tool"..mode..width)
|
||||||
|
item:set_metadata(mode..":"..width)
|
||||||
|
return item
|
||||||
|
end --bridgetool_switchmode
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'bridgetool:bridge_tool',
|
||||||
|
recipe = {
|
||||||
|
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||||
|
{'', 'default:steel_ingot', ''},
|
||||||
|
{'', 'default:mese_crystal_fragment', ''},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--this one appears in crafting lists and when you first craft the item
|
||||||
|
minetest.register_tool("bridgetool:bridge_tool", {
|
||||||
|
description = "Bridge Tool",
|
||||||
|
inventory_image = "bridgetool_wield.png",
|
||||||
|
wield_image = "bridgetool_wield.png^[transformR90",
|
||||||
|
on_place = bridgetool_place,
|
||||||
|
on_use = bridgetool_switchmode
|
||||||
|
})
|
||||||
|
|
||||||
|
--these are the different tools for all 3 differen modes and widths
|
||||||
|
--bridgetool:bridge_tool11 12 13 21 22 23 31 32 33
|
||||||
|
--the reason for having different tools defined is so they can have
|
||||||
|
--an inventory image telling which mode/width the tool is in
|
||||||
|
--note that we set these to NOT show up in the creative inventory (Thanks Topywo for that advice!)
|
||||||
|
for m = 1, 3 do
|
||||||
|
for w = 1, 3 do
|
||||||
|
minetest.register_tool("bridgetool:bridge_tool"..m..w, {
|
||||||
|
description = "Bridge Tool mode "..m.." width "..w,
|
||||||
|
inventory_image = "bridgetool_m"..m..".png^bridgetool_w"..w..".png",
|
||||||
|
wield_image = "bridgetool_wield.png^[transformR90",
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
on_place = bridgetool_place,
|
||||||
|
on_use = bridgetool_switchmode
|
||||||
|
})
|
||||||
|
end --for w
|
||||||
|
end --for m
|
||||||
|
|
||||||
|
|
||||||
|
--temporary for backwards compatibility, remove this after a version or two
|
||||||
|
--since previously made tools will be named bridgetool_1 2 or 3, leaving this
|
||||||
|
--here ensures they will load and switch to bridgetool_11 etc on the first left click
|
||||||
|
for m = 1, 3 do
|
||||||
|
minetest.register_tool("bridgetool:bridge_tool"..m, {
|
||||||
|
description = "Bridge Tool mode "..m,
|
||||||
|
inventory_image = "bridgetool_m"..m..".png",
|
||||||
|
wield_image = "bridgetool_wield.png^[transformR90",
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
on_place = bridgetool_place,
|
||||||
|
on_use = bridgetool_switchmode
|
||||||
|
})
|
||||||
|
end --for m
|
BIN
mods/bridgetool/textures/Thumbs.db
Normal file
BIN
mods/bridgetool/textures/bridgetool_m1.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
mods/bridgetool/textures/bridgetool_m2.png
Normal file
After Width: | Height: | Size: 672 B |
BIN
mods/bridgetool/textures/bridgetool_m3.png
Normal file
After Width: | Height: | Size: 726 B |
BIN
mods/bridgetool/textures/bridgetool_w1.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
mods/bridgetool/textures/bridgetool_w2.png
Normal file
After Width: | Height: | Size: 193 B |
BIN
mods/bridgetool/textures/bridgetool_w3.png
Normal file
After Width: | Height: | Size: 193 B |
BIN
mods/bridgetool/textures/bridgetool_wield.png
Normal file
After Width: | Height: | Size: 280 B |
@ -1,5 +0,0 @@
|
|||||||
default
|
|
||||||
|
|
||||||
fire
|
|
||||||
moreblocks?
|
|
||||||
moreores?
|
|