Page 1 of 1

[Mod] Trash Can

PostPosted: Sun Aug 12, 2012 04:31
by tinoesroho
Image
This mod is outdated!
This mod has not been updated to work with Minetest 0.4.1 or newer. It is functional in older dev versions, but relies on deprecated commands.



This is a simple mod that allows for a quick, easy method of dumping unwanted items. It utilizes the default textures.
Image

Screenshots:
Image
Image

Craft:
Wood Wood Wood
Wood Cobble Wood
Wood Wood Wood

Dependencies:
default

License:
CC0

Download:
First release here
Trash 0.1 - first "stable" release
Trash 0.2 - Second "stable" release, makes it flammable.
Trash 0.3 - Third "stable" release, makes it removable with a stick. Optional compatibility with Minetest 0.4 Dev <20120428.

PostPosted: Sun Aug 12, 2012 08:59
by jin_xi
good idea, very useful for mod testing!

PostPosted: Sun Aug 12, 2012 09:16
by VanessaE
Two wood blocks side by side like that conflicts with Mesecons (wooden pressure plate). I might suggest something exotic such as two cobble and a bucket of lava.

PostPosted: Mon Aug 13, 2012 15:49
by tinoesroho
I wasn't aware that it conflicted with Mesecons. Perhaps this would be more appropriate:

wood wood wood
wood cobble wood
wood wood wood

PostPosted: Mon Aug 13, 2012 17:07
by tinoesroho
Updated. See first post.

PostPosted: Tue Aug 14, 2012 18:08
by qwrwed
+1 This is very useful, but I can't remove it; any tools I try to use to remove it are thrown away.
Is there any way around this?

PostPosted: Tue Aug 14, 2012 19:45
by InfinityProject
qwrwed wrote:+1 This is very useful, but I cant remove it; any tools i try to use to remove it are thrown away.
Is there any way around this?


You could set the node to air using worldedit.

PostPosted: Tue Aug 14, 2012 21:25
by tinoesroho
InfinityProject wrote:
qwrwed wrote:+1 This is very useful, but I cant remove it; any tools i try to use to remove it are thrown away.
Is there any way around this?


You could set the node to air using worldedit.

^ This, and commanding Harvey are the only two ways to remove it at the moment. If you'd like to know why any tools you hit it with are removed, look at this chunk of code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_punchnode(function(pos, node, puncher)    if node.name == "trash:block" then
hit_with = puncher:get_wielded_item()
hit_with_name = hit_with:get_name()
hit_with_count = hit_with:get_count()

puncher:get_inventory():remove_item("main", hit_with)
minetest.chat_send_player(puncher:get_player_name(), 'Clunk!')
end end)


What's happening here is that it checks when you it a block to see a)If it's a trash can, if so then b)what was it hit with and c)how big was the stack, and then removes the whole stack of it. Handy for tossing stuff, but it also precludes the possibility of removing the block by punching it - unless you try it empty handed.

If anybody has input on how I should set it up to check for a removal tool and subsequently remove itself, do speak up.

PostPosted: Tue Aug 14, 2012 21:33
by InfinityProject
You could also put the trash can into the "flammable" group and burn it.

But anyways I think this would look very nice if it had a nodebox model.

PostPosted: Tue Aug 14, 2012 22:26
by tinoesroho
Good idea, 'finity. I'm not sure how to pull off a nodebox model myself, so it might be a week to the next update.

PostPosted: Mon Aug 20, 2012 14:18
by VanessaE
Would you mind adding screenshots? Thanks.

PostPosted: Wed Aug 22, 2012 05:58
by RealBadAngel
check "wear" of the wielded item. if >0 then its a tool

PostPosted: Wed Aug 22, 2012 06:09
by tinoesroho
Mmm. I never thought of that method. I'll see what I can do.

PostPosted: Wed Aug 22, 2012 10:26
by rubenwardy
I think it would be better if you open it up like as chest, and drag the items into it

PostPosted: Thu Aug 23, 2012 01:05
by cornernote
rubenwardy wrote:I think it would be better if you open it up like as chest, and drag the items into it


that would be cool. you put your items in there, and then there is an EMPTY TRASH button that removes all the items from the chest's inventory

PostPosted: Thu Aug 23, 2012 11:31
by tonyka
great idea!
would be great to have a look more like a garbage disposal, or you could use my toilet.
also to remove incompatibilities could add a screen and then add the blocks to remove them click a button ... That will remove the problem that destroy hit everything with what ...

PostPosted: Thu Aug 23, 2012 14:17
by tinoesroho
I'm thinking of stealing some code from the Furnaces. -.-

PostPosted: Tue Sep 04, 2012 13:07
by Matsetes
Is it possible to make it similar to the furnace? You move into the item you want to destroy...
Or also make it breakable with the hand (no object selected)

PostPosted: Tue Sep 04, 2012 14:35
by PilzAdam
Matsetes wrote:Is it possible to make it similar to the furnace? You move into the item you want to destroy...
Or also make it breakable with the hand (no object selected)

My fork of the default game adds this to creative inventory: https://github.com/PilzAdam/minetest_game

PostPosted: Fri Sep 07, 2012 15:40
by Matsetes
I didn't understand? What is in your game in the creative mode?

PostPosted: Fri Sep 07, 2012 16:31
by tinoesroho
He has a trash field in the creative mode.

PostPosted: Fri Oct 12, 2012 16:50
by nomohakon
tinoesroho: how is trash can you said you will make?

PostPosted: Fri Oct 12, 2012 18:16
by tinoesroho
Still working on it. I hate not knowing a lick of code; makes it very tough to work on mods. I will, I swear, post the update when it's done.

PostPosted: Fri Oct 12, 2012 18:58
by tinoesroho
Well, updated. The latest update adds removability (use stick) aaaaaand adds compatibility with old versions. Go trash!

PostPosted: Sat Oct 13, 2012 14:55
by nomohakon
Working like a charm. Thanks!

EDIT: Maybe i try to make it chest-like.

PostPosted: Tue Oct 30, 2012 22:54
by terminalerror
Good mod. I tweaked the code a bit, see if you like it. (This makes it removable by hand instead, like PilzAdam's bed.)

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
 
minetest.register_alias("trash:block", "trash:can")

minetest.register_node("trash:block", {
description = "Trash block",
tile_images = {"default_nc_front.png",},
is_ground_content = true,
stack_max = 1,
groups = {snappy=1,bendy=2,cracky=1,melty=2,flammable=3, oddly_breakable_by_hand=2},
--     material = minetest.digprop_constanttime(9.0),
sounds = default_stone_sounds
})

minetest.register_craft({
    output = 'trash:block',
    recipe = {
        {'default:wood', 'default:wood', 'default:wood'},
        {'default:wood', 'default:cobble', 'default:wood'},
        {'default:wood', 'default:wood', 'default:wood'},
    }
})

minetest.register_on_punchnode(function(pos, node, puncher)    if node.name == "trash:block" then
hit_with = puncher:get_wielded_item()
hit_with_name = hit_with:get_name()
hit_with_count = hit_with:get_count()

if hit_with_name ~= "" then
puncher:get_inventory():remove_item("main", hit_with)
minetest.chat_send_player(puncher:get_player_name(), 'Clunk!')
end end end)

PostPosted: Wed Oct 31, 2012 00:47
by tinoesroho
Smart tweak, terminalerror.

PostPosted: Sun Oct 20, 2013 01:55
by Johnyknowhow
You should be able t make it with nyancats

PostPosted: Sun Oct 20, 2013 01:55
by Johnyknowhow
You should be able t make it with nyancats

PostPosted: Sun Oct 20, 2013 01:58
by Evergreen
Johnyknowhow wrote:You should be able t make it with nyancats
This mod is old and outdated. You can check out my mod if you want.