Upload stuff
parent
692e214b67
commit
e6f1da250b
|
@ -0,0 +1,63 @@
|
|||
LICENSE FOR CODE:
|
||||
=================
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
|
||||
LICENSE FOR MEDIA:
|
||||
==================
|
||||
|
||||
|
||||
Licenses of media (textures, models and sounds)
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
hopper?
|
|
@ -0,0 +1,71 @@
|
|||
local infinite_chest_formspec =
|
||||
"size[8,6]" ..
|
||||
default.gui_bg ..
|
||||
default.gui_bg_img ..
|
||||
default.gui_slots ..
|
||||
'label[2.5,-0.2;Input]' ..
|
||||
"list[context;put_in;2.5,0.3;1,1;]" ..
|
||||
"list[current_player;main;0,1.85;8,1;]" ..
|
||||
"list[current_player;main;0,3.08;8,3;8]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[context;put_in]" ..
|
||||
"listring[current_player;main]" ..
|
||||
'label[4.5,-0.2;Output]' ..
|
||||
"list[context;take_from;4.5,0.3;1,1;]" ..
|
||||
"listring[context;take_from]" ..
|
||||
"listring[current_player;main]" ..
|
||||
default.get_hotbar_bg(0,1.85)
|
||||
|
||||
local function get_infinite_chest_formspec(inv)
|
||||
local formspec = infinite_chest_formspec
|
||||
return formspec
|
||||
end
|
||||
|
||||
minetest.register_node("infinite_chest:chest", {
|
||||
description = "Infinite Chest",
|
||||
tiles = {"default_chest_top.png"},
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", get_infinite_chest_formspec(nil))
|
||||
meta:set_string( 'infotext', ('Infinite Chest'))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('put_in', 1 * 1)
|
||||
inv:set_size('take_from', 1 * 1)
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff to infinite chest at " .. minetest.pos_to_string(pos))
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", get_infinite_chest_formspec(meta:get_inventory()))
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes stuff from infinite chest at " .. minetest.pos_to_string(pos))
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", get_infinite_chest_formspec(meta:get_inventory()))
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {'infinite_chest:chest'},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack('put_in', 1)
|
||||
local item = stack:get_name('put_in')
|
||||
if inv:is_empty('take_from') and not inv:is_empty('put_in') then
|
||||
inv:add_item('take_from', stack)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then
|
||||
hopper:add_container({
|
||||
{"top", "infinite_chest:chest", "take_from"},
|
||||
})
|
||||
end
|
Loading…
Reference in New Issue