fenomas / noa

Experimental voxel game engine.
MIT License
612 stars 87 forks source link

Adding option to ignore non solids in block targeting #35

Closed terrac closed 6 years ago

terrac commented 6 years ago

I'm using this option to allow the placement of entities on top of water

fenomas commented 6 years ago

Hey, thanks for this but I don't think the commit is right - it looks like it adds the settings option but doesn't implement anything, or am I missing something?

With that said, I agree with the use case but it would be more robust to let the user specify a targeting function, that takes a block ID and returns a boolean, and have the block targeting return the first ID matching that function. That way you can dynamically change the behavior, between targeting all non-zero IDs, or targeting solid blocks, or custom logic.

I could get this added within a few days probably, but if you'd like to you're certainly welcome! The change would have to be made somewhere underneath pick, maybe in _traceWorldRay or thereabouts.

fenomas commented 6 years ago

This is now addressed by b6fefc94c218f62e3b239c838b2e8ab4ba33b0f7