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

model and textures for connected chest open #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TumeniNodes
Copy link

This simply adds a new "models" folder: which has the .obj and .blend files.
the second set [UVMapped] are just copies, but the ones I used to ensure the normals are prepared.
I also added a media license.txt for the model

The second addition, is a temp folder inside the "textures" folder, where I added any modified textures which may be needed, as well as a media license.txt for the textures.

now all just need to be coded in

Add new folder "models"
Add model for "connected_chest_open"
only the "inside" texture will probably be needed
others are "just in case"
add credit and license for modified textures
Add brief explanation of texture modifications
media license, with brief explanation of modifications
@HybridDog
Copy link
Owner

thy

@TumeniNodes
Copy link
Author

not sure if you're waiting on me to code these in? I literally suck at coding and not sure if I would know how to begin to integrate these.

just thought I would mention that, haha

@HybridDog
Copy link
Owner

I'm waiting for minetest/minetest_game#2045 because l don't like waiting for the animation.

@TumeniNodes
Copy link
Author

TumeniNodes commented Feb 10, 2018

I have to say, I have never noticed a time lag from rightclick to formspec. It is like a fraction of a second for me. But that is in creative.
Are you talking about when on servers? Does being on a server add a substantial amount of time lag when opening chest?

I also have to say, that I agree with you regarding rightclick open, then rightclick to get formspec. That is how I planned to do it when I added an animated chest to one of my mods (since removed) but, I knew mentioning such steps would not go anywhere as far as getting into game.

Then again, my model of the open chest opens all the way, and I wanted to bump it out into the next node enough to avoid z-fighting when opened. But that also means adding a mesh for the closed chest, and no one will go for that.

The biggest reason is, it takes even longer to rightclick to open and then rightclick for formspec.

@HybridDog
Copy link
Owner

There's a function for registering connected chests: https://github.com/HybridDog/connected_chests/blob/master/init.lua#L133
It currently can be used for chests with and without opening animation to add a connected version without animation.
A connected chest consists of two nodes:

  • The left one contains the inventory, formspec etc. Its selection box spans to the right one that clicking on the right side actually performs the rightclick on the left node.
    If the left node is added or removed, the right node is added or removed (if possible).
  • The right node is used for visual and collision. You can walk on it but you can't point it (you usually would point the left one if you try it). You can not place a node into it. It has a special tube connection to the left chest if pipeworks is enabled.
    If the right node is removed, it's added back if the left node is still there. If the right node is added, it is removed if there's no left node.

I think the open chests can be implemented more easily using two nodes, too. So it also doesn't need an own model, i.e. l guess your model is for the cat.

@TumeniNodes
Copy link
Author

for the cat

? not sure I know what that means.
But, if open connected chest can be done in that manner, without requiring the model that's excellent.

@HybridDog
Copy link
Owner

https://en.wiktionary.org/wiki/f%C3%BCr_die_Katz_sein
As long as the chest is a node wide, it should work:
screenshot_20180213_165344
screenshot_20180213_165355

@HybridDog
Copy link
Owner

I've implemented open connected chests now. The code indeed looks more messy (imo), but it works.
I've got a problem figuring out how to change the back texture of the right and left node without breaking other sides. Do you know how to fix it?
Please test it.

@TumeniNodes
Copy link
Author

nice.
I will test it and have a look over the next couple days.

@TumeniNodes
Copy link
Author

TumeniNodes commented Feb 24, 2018

When I attempt to right-click the connected chest MTG crashes. I did not look into it atm as I will be in and out all day today.

AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): /home/xxxx/.minetest/mods/connected_chests/init.lua:494: attempt to index field 'chest' (a nil value) stack traceback: /home/xxx/.minetest/mods/connected_chests/init.lua:494: in function 'on_right_click' /usr/share/minetest/builtin/game/item.lua:347: in function 'item_place' /usr/share/minetest/games/minetest_game/mods/default/nodes.lua:1266: in function </usr/share/minetest/games/minetest_game/mods/default/nodes.lua:1263>

@TumeniNodes
Copy link
Author

TumeniNodes commented Feb 26, 2018

it's that damn grass, I knew it haha.

I am on 0.4.16 stable (ahhh, I failed to notice you are on 0.5.0 dev)
but this should work on both, should it not??

I will have some time tomorrow to look at what's going on
I can't check out anything texture related till I can get this resolved

@HybridDog
Copy link
Owner

HybridDog commented Feb 26, 2018

I guess that's the relevant change: minetest/minetest_game@b75a179#diff-4c0fc0806e6a443774cea3aea5f3febe
connected_chests uses the default lid obstruction test function, which wasn't available before the commit.

It should be fixed in the newest connected_chests version, could you test it?

@TumeniNodes
Copy link
Author

2018-02-26 12:44:48: ERROR[Main]: ModError: Failed to load and run script from /home/xxxx/.minetest/mods/connected_chests/init.lua:
2018-02-26 12:44:48: ERROR[Main]: /home/xxxx/.minetest/mods/connected_chests/init.lua:486: attempt to index field 'chest' (a nil value)
2018-02-26 12:44:48: ERROR[Main]: stack traceback:
2018-02-26 12:44:48: ERROR[Main]: /home/xxxx/.minetest/mods/connected_chests/init.lua:486: in main chunk

if I were any good at coding, I would probably know how to fix this. sorry.
sometimes I am able to figure these things out, sometimes I cannot. This is one of the nots.

@HybridDog
Copy link
Owner

Sorry, I accidentally didn't test if default.chest exists.
4a521fd
Testing whether a field in a table exists doesn't work if the table doesn't exist.

@TumeniNodes
Copy link
Author

well that makes sense hehe
Thank you, works awesome now.
I will work on this back texture issue and hopefully I can resolve it for you.

@TumeniNodes
Copy link
Author

I tried several (give or take 100) methods, got a few pretty interesting results but, I cannot figure this back texture out.

Looking at all the code, (and not being a good coder/programmer) it seems to me that possibly, the back texture will need to be specified?
However the top is accomplished "should" work for the back, using the side texture?

I did find that line 378 can be commented out with no changes implemented.
But, when I comment out line 377, the back-left texture disappears (which is the "deco" chest?)
So I guess, the back texture for the deco chest may need to use a similar approach using the
"^([combine:16x16:5,0=" .. top .. "^connected_chests_frame.png^[makealpha:255,126,126)" method?
Either way, there "has" to be a way to resolve this. I mean, all the other connected faces are fine. This really stumps me

I really wish I had coding skills.

@HybridDog
Copy link
Owner

HybridDog commented Feb 28, 2018

I assume the textures are configured in the model, using the same texture for some faces, which makes it impossible to change the back face without breaking another one. I don't have experience with models.

I did find that line 378 can be commented out with no changes implemented.

I think this makes only a slight, but required, difference, some texture is mirrored.

@TumeniNodes
Copy link
Author

yes, that is why I made the extended model and textures.
But since you are doing it this way, this may require adding an individual back texture, rather than using the sides as the single model does.
I am sure there must be a means to accomplish this, but adding it as a generic texture, so it changes when the user, is using a different TP.
Maybe adding some sort of alias or something. I am sure we can figure it out somehow.
If you are willing to ask others to see if they may be able to figure it out?

@HybridDog
Copy link
Owner

HybridDog commented Feb 28, 2018

I am sure there must be a means to accomplish this, but adding it as a generic texture, so it changes when the user, is using a different TP.

The default opened chest changes when using a different TP.

I assume the opened chest model in default likely doesn't become edited, so copying it and adding a back texture could fix the problem.

@TumeniNodes
Copy link
Author

Yes, I know it does. I was referring to if a new back texture needs to be added.

But, what I simply cannot understand is,
the top texture works fine when connected, and that is used as the bottom texture as well.
So, the back texture should work just as fine, as well, because it uses the side texture.

Why is the same method not working the same?
Maybe it need to be coded to work in reverse from the top?

@HybridDog
Copy link
Owner

top and bottom textures both connect to the neighbour chest, whereas the texture on the back connects to the neighbour chest and the texture on the right side doesn't

@TumeniNodes
Copy link
Author

I'm wondering if something in here might help?
https://github.com/MultiCraftProject/MultiCraft/blob/master/games/default/files/default/nodes.lua#L1468

If not, then perhaps adjusting to use the second "open chest" model is worth a try?

@HybridDog
Copy link
Owner

HybridDog commented Mar 6, 2018

l don't think they have an open chest.

https://github.com/minetest/minetest_game/blob/master/mods/default/models/chest_open.obj
maybe a sed command can be used to convert the model.

@TumeniNodes
Copy link
Author

I'm using this regardless, cuz I love it.
The back texture actually does not bother me tbh. as the back is normally facing a wall anyway.

If I had the time and skill, I would just use the 2d model and be done with it but, as is works for me.

I'm bummed the thought of adding connected chests got closed in issues but, it's still a great mod, and you know others will be glad to have it as well anyway
So thank you very much for it, and all the work you have put into it.

@HybridDog
Copy link
Owner

HybridDog commented Feb 10, 2020

That looks like someone else also needs a connected chest model now: https://forum.minetest.net/viewtopic.php?p=366708#p366708

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

Successfully merging this pull request may close these issues.

2 participants