Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite Items #5

Open
z3t0 opened this issue Apr 12, 2015 · 10 comments
Open

Infinite Items #5

z3t0 opened this issue Apr 12, 2015 · 10 comments

Comments

@z3t0
Copy link

z3t0 commented Apr 12, 2015

Items in the creative inventory should not be infinite, instead they should be stacks because when you change modes back to survival, you still have an infinite block

@z3t0
Copy link
Author

z3t0 commented Apr 12, 2015

Trying to figure out which part of
https://github.com/deathcap/voxel-use/blob/master/use.coffee#L61-L86
Changes the number of the item/block held. I cant seem to figure out what subtracts the item number?

@deathcap
Copy link
Member

    taken = held.splitPile(1)

@z3t0
Copy link
Author

z3t0 commented Apr 13, 2015

I am trying to add the eventemitter to voxel-gamemode but cannot figure out how to do so. I want it to be able to emit, I gave it

inherits(Gamemode, EventEmitter)

but that won't work... I managed to get this working on voxel-console but not this

@z3t0
Copy link
Author

z3t0 commented Apr 13, 2015

Here's what I am trying to do.
https://gist.github.com/z3t0/f2fe3f291d1ec49bbab1

@z3t0
Copy link
Author

z3t0 commented Apr 13, 2015

The @on parts never seem to run, but there are no errors

@z3t0
Copy link
Author

z3t0 commented Apr 14, 2015

ok.. super noob mistake... dont ask what lol.

@z3t0
Copy link
Author

z3t0 commented Apr 15, 2015

This is almost done and will be commited soon

@deathcap
Copy link
Member

For the class inheritance, since this is CoffeeScript you should be able to just do class Gamemode extends EventEmitter instead of using the inherits module, I believe.

As for this issue, I half-agree with the premise. I think infinite item piles could still be useful in some situations, even survival. For example, for comparison in Minecraft, there may be adventure maps or mini-games with items from infinite dispensers or chests full of items you can use infinitely many times, to some end (I think these are implemented in MC with an item count of 0 or -1, not sure exactly, but in voxel.js itempile as its JavaScript I allow the actual Infinity value).

On the other hand, I could see how it could be useful to, by default, pickup a finite-sized pile from the creative inventory. Haven't tested #6 yet but ideally both would be possible. Not sure of the best way to handle this user interaction, but the way I see it, from the inventory window it should be possible to pickup: infinite piles, maximum pile size (usually 64), one item.

Another consideration is that in creative mode, your item blocks still deplete when placed in the world. In MC, you can have a stack of 1 dirt, place it, and you still have it; not so in voxel.js / voxel-use, where it is consumed, same in creative or survival mode. The way I got around this was having infinite-sized piles, but this does introduce the behavior you've noticed where they behave infinite in both modes. Unsure of the best solution here, but I think it requires further design to take into account these considerations.

@z3t0
Copy link
Author

z3t0 commented Apr 15, 2015

Hmm. Right I am thinking of having a canKeep variable which can be set to true, so inventory items are not infinite but also do not deplete.

@z3t0
Copy link
Author

z3t0 commented Apr 15, 2015

For the class inheritance, since this is CoffeeScript you should be able to just do class Gamemode extends EventEmitter instead of using the inherits module, I believe.

Thanks I managed to get events working.

chests full of items you can use infinitely many times

Why not just make the item number not deplete? That is much easier to maintain because we can have a simple setting to keep items which can be controlled.

itempile as its JavaScript I allow the actual Infinity value

I don' think having an Infinity value is a good idea because it becomes hard to manage.

Not sure of the best way to handle this user interaction, but the way I see it, from the inventory window it should be possible to pickup: infinite piles, maximum pile size (usually 64), one item.

What would be the use of having an infinity item? I just see this as hard to maintain. Do we currently have a way to pickup only one item? If not I can work on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants