HybridDog / connected_chests

Adds big chests to minetest.
https://forum.minetest.net/viewtopic.php?f=9&t=10264&p=156571
Other
6 stars 7 forks source link

model and textures for connected chest open #6

Open TumeniNodes opened 6 years ago

TumeniNodes commented 6 years ago

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

HybridDog commented 6 years ago

thy

TumeniNodes commented 6 years ago

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 commented 6 years ago

I'm waiting for https://github.com/minetest/minetest_game/issues/2045 because l don't like waiting for the animation.

TumeniNodes commented 6 years ago

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 commented 6 years ago

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:

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

TumeniNodes commented 6 years ago

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>

HybridDog commented 6 years ago

https://github.com/HybridDog/connected_chests/blob/master/init.lua#L494 https://github.com/minetest/minetest_game/blob/master/mods/default/nodes.lua#L2014

Which minetest_game version do you use?

There's no item_place function in that line: https://github.com/minetest/minetest_game/blob/master/mods/default/nodes.lua#L1266

TumeniNodes commented 6 years ago

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 commented 6 years ago

I guess that's the relevant change: https://github.com/minetest/minetest_game/commit/b75a17984a56bb05310bfe575e4ce17509fad43b#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 commented 6 years ago

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 commented 6 years ago

Sorry, I accidentally didn't test if default.chest exists. https://github.com/HybridDog/connected_chests/commit/4a521fd9136379f005a52e33e42d6a2d950ff5f4 Testing whether a field in a table exists doesn't work if the table doesn't exist.

TumeniNodes commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 4 years ago

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