Compare commits
5 Commits
f8a554dda4
...
99e0e22b45
Author | SHA1 | Date |
---|---|---|
isaiah658 | 99e0e22b45 | |
isaiah658 | 3ea965f45d | |
isaiah658 | 5591e13062 | |
isaiah658 | 4a3f362a4e | |
Starbeamrainbowlabs | a10fe18ee7 |
|
@ -1,8 +1,10 @@
|
|||
# minetest-floating-anchor
|
||||
A floating anchor mod for minetest. Adds an item that, when used, places a floating anchor block at the player's position.
|
||||
> A floating anchor mod for minetest. Adds an item that, when used, places a floating anchor block at the player's position.
|
||||
|
||||
![A picture of the floating anchor block in mid-air.](https://i.imgur.com/4RYlEDO.png)
|
||||
|
||||
- [Forum Post](https://forum.minetest.net/viewtopic.php?f=9&t=20180)
|
||||
|
||||
## Installation
|
||||
Clone this repository into the `worldmods` subfolder of the folder that contains your world. If it doesn't exist, then you'll need to create it.
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
default
|
19
init.lua
19
init.lua
|
@ -15,13 +15,17 @@ local function do_anchor_place(itemstack, player, pointed_thing)
|
|||
|
||||
-- Figure out where to put the anchor
|
||||
local place_position = player:getpos()
|
||||
place_position.y = place_position.y - 0.8
|
||||
log_message("action", string.format("(%d, %d, %d)", place_position.x, place_position.y, place_position.z))
|
||||
|
||||
-- Place the floating anchor in the world
|
||||
minetest.set_node(place_position, { name = "floating_anchor:floating_anchor" })
|
||||
local node_to_check = minetest.get_node(place_position)
|
||||
if node_to_check.name == "air" then
|
||||
minetest.set_node(place_position, { name = "floating_anchor:floating_anchor" })
|
||||
-- Take an item from the player's stack & return the new stack with 1 fewer items in it
|
||||
itemstack:take_item(1)
|
||||
end
|
||||
|
||||
-- Take an item from the player's stack & return the new stack with 1 fewer items in it
|
||||
local new_itemstack = itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
@ -39,4 +43,13 @@ minetest.register_craftitem("floating_anchor:floating_anchor_item", {
|
|||
on_secondary_use = do_anchor_place
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "floating_anchor:floating_anchor",
|
||||
recipe = {
|
||||
{"group:wool", "group:wool", "group:wool"},
|
||||
{"group:wool", "default:steel_ingot", "group:wool"},
|
||||
{"group:wool", "group:wool", "group:wool"},
|
||||
}
|
||||
})
|
||||
|
||||
log_message("info", "Loaded!")
|
||||
|
|
Loading…
Reference in New Issue