disallow rotating and connect tube at front of both sides
This commit is contained in:
parent
187cac3c45
commit
581a9ecfa3
13
README.md
13
README.md
|
@ -1,12 +1,12 @@
|
||||||
[Mod] connected chests [connected_chests]
|
[Mod] connected chests [connected_chests]
|
||||||
|
|
||||||
This mod allows making bigger default chests.
|
This mod allows making bigger default chests.
|
||||||
Just hold shift and place a chest onto another one's side.
|
Just hold shift and place a chest onto another one's side.
|
||||||
This is not the first mod which adds big chests.
|
This is not the first mod which adds big chests.
|
||||||
|
|
||||||
**Depends:** see [depends.txt](https://raw.githubusercontent.com/HybridDog/connected_chests/master/depends.txt)
|
**Depends:** see [depends.txt](https://raw.githubusercontent.com/HybridDog/connected_chests/master/depends.txt)
|
||||||
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/connected_chests/master/LICENSE.txt)
|
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/connected_chests/master/LICENSE.txt)
|
||||||
**Download:** [zip](https://github.com/HybridDog/connected_chests/archive/master.zip), [tar.gz](https://github.com/HybridDog/connected_chests/tarball/master)
|
**Download:** [zip](https://github.com/HybridDog/connected_chests/archive/master.zip), [tar.gz](https://github.com/HybridDog/connected_chests/tarball/master)
|
||||||
|
|
||||||
![I'm a screenshot!](http://wiki.minetest.net/images/d/d1/Connected_chest.png)
|
![I'm a screenshot!](http://wiki.minetest.net/images/d/d1/Connected_chest.png)
|
||||||
|
|
||||||
|
@ -15,6 +15,5 @@ If you got ideas or found bugs, please tell them to me.
|
||||||
[How to install a mod?](http://wiki.minetest.net/Installing_Mods)
|
[How to install a mod?](http://wiki.minetest.net/Installing_Mods)
|
||||||
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
* disallow rotating the chest with a screwdriver
|
|
||||||
* add abms when registering the chest instead of using chestdata
|
* add abms when registering the chest instead of using chestdata
|
||||||
|
|
17
init.lua
17
init.lua
|
@ -155,21 +155,22 @@ function connected_chests.register_chest(fromname, data)
|
||||||
|
|
||||||
-- override the original node to support connecting
|
-- override the original node to support connecting
|
||||||
local place_chest = minetest.registered_nodes[fromname].on_place
|
local place_chest = minetest.registered_nodes[fromname].on_place
|
||||||
|
local creative_mode = minetest.settings:get_bool"creative_mode"
|
||||||
minetest.override_item(fromname, {
|
minetest.override_item(fromname, {
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if not placer then
|
if not placer
|
||||||
return
|
or not placer:get_player_control().sneak then
|
||||||
|
return place_chest(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
local pu, pa, par2 = get_pointed_info(pointed_thing, fromname)
|
local pu, pa, par2 = get_pointed_info(pointed_thing, fromname)
|
||||||
if not pu
|
if not pu then
|
||||||
or not placer:get_player_control().sneak then
|
|
||||||
return place_chest(itemstack, placer, pointed_thing)
|
return place_chest(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
if minetest.is_protected(pa, placer:get_player_name()) then
|
if minetest.is_protected(pa, placer:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
connect_chests(pu, pa, par2, fromname)
|
connect_chests(pu, pa, par2, fromname)
|
||||||
if not minetest.settings:get_bool"creative_mode" then
|
if not creative_mode then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
@ -201,6 +202,12 @@ function connected_chests.register_chest(fromname, data)
|
||||||
if data.on_rightclick then
|
if data.on_rightclick then
|
||||||
chest.on_rightclick = function()print"yem"end--data.on_rightclick
|
chest.on_rightclick = function()print"yem"end--data.on_rightclick
|
||||||
end
|
end
|
||||||
|
function chest.on_rotate()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if chest.tube then
|
||||||
|
chest.tube.connect_sides = {left = 1, back = 1, front = 1, bottom = 1, top = 1}
|
||||||
|
end
|
||||||
|
|
||||||
if not data.front then
|
if not data.front then
|
||||||
data.front = "connected_chests_front.png"
|
data.front = "connected_chests_front.png"
|
||||||
|
|
Loading…
Reference in New Issue