wiremod / wire

Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.
http://www.wiremod.com
Apache License 2.0
550 stars 332 forks source link

E2 Submaterial Indices are messed up on my server. #1945

Closed btg611 closed 5 years ago

btg611 commented 5 years ago

As stated, vectors like SubMaterial and HoloBodygroups are one off from what they should be to show correctly on my dedicated server. For example, if I spawn a holo E2 for a prop whose Body group should be (1,2) I have to change it to (1,1) for it to show correctly. Same thing with SubMaterials in the holo code. On every other server it shows correctly without editing. how do I fix this?

TomyLobo commented 5 years ago

Can you provide a code example of what you are talking about?

btg611 commented 5 years ago

For Example : "holoEntity(A):setSubMaterial(3,"models/proppertextures/acrylic_black")" This is in fact the proper code. It works just fine on any server except for the one I set up. On my server it shows incorrectly. But if I were to edit the code from " setSubMaterial(3,... " to " setSubMaterial(4,... " it would show up correctly. Is this something to do with the way my server is configured?

thegrb93 commented 5 years ago

If it's different everywhere else, then its probably something you have installed. But SubMaterials are offsetted by 1 in code because E2 attempts to make the indices start at 1 (for some reason despite highspeed starting at 0)

https://github.com/wiremod/wire/blob/97c3f2d82e971c0b3878e4fb6e4a9ccbb19660d5/lua/entities/gmod_wire_expression2/core/entity.lua#L412

btg611 commented 5 years ago

See, that's where it gets weird... if I use holoEntity(A):setSubMaterial(0,"submaterial") , it will actually change a submaterial. In reality, it's as if they ARE NOT offset by one as they should be.

thegrb93 commented 5 years ago

Garrysmod is probably just clamping the negative value to 0, or possibly wrapping around to the end of the material list.

bigdogmat commented 5 years ago

That's because the index is clamped, so giving it 0 will try -1 but it'll get clamped between [0-255]

https://github.com/wiremod/wire/blob/4a9c97f483787aeb9dcba96078177f213a2dde35/lua/entities/gmod_wire_expression2/core/e2lib.lua#L34-L38

btg611 commented 5 years ago

So is the code in this lua file something I need to change, most likely? Put simply, how do I fix it?

thegrb93 commented 5 years ago

Nothing is broken. You just need to use 1 instead of 0.

btg611 commented 5 years ago

Maybe I'm not explaining this right. 0 IS acting as a valid submaterial index in my holo codes. If I use the index of zero, it works. 0 is a valid index on my server, it doesn't do that on other servers. So if I make a holo code on another server, the index offset is correct. 0 is not a valid submaterial index there. But on my server it is. If I spawn a holo creation from another server on mine, the indices are still set for other servers, it will not show correctly on my own server unless i change the submaterial indices. And vice versa, If i spawn something I make on my server on another public server, it does not show up as it should without manually changing the indices of every submaterial in that code. My server is the only one encountering this problem. MY codes only work correctly on MY server, OTHER people's codes work on every other server except mine. I'll take some screenshots, hold on.

thegrb93 commented 5 years ago

Then it's a matter of your wire versions out of date. If you can get more information then we can look at it.

btg611 commented 5 years ago

20190709182012_1 20190709182018_1 20190709184421_1 20190709184427_1

Here are 4 screenshots of the same holo, spawned on my server and someone else's public server. The same code, no edits. The one that's screwed up is mine. Is this truly just my version of wiremod being out of date? If so, that's an easy fix,

btg611 commented 5 years ago

Why was this issue closed? My problem isn't fixed and I would like help. Nobody else knows what the problem is, my version of wiremod is up to date both on my client end and on my server.

thegrb93 commented 5 years ago

Perhaps an addon installed on your server is causing issues with submaterials

thegrb93 commented 5 years ago

What's the output of lua_run PrintTable(debug.getinfo(FindMetaTable("Entity").SetSubMaterial)) in your server console?

thegrb93 commented 5 years ago

Also the output of lua_run PrintTable(debug.getinfo(E2Lib.setSubMaterial))

btg611 commented 5 years ago

What sort of addon would interfere with it? I have multiple e2 cores, all of which are enabled. Could it be one of them? None of them are material related though. are there any specific known addons that would interfere I can check for?

btg611 commented 5 years ago

PrintTable(debug.getinfo(FindMetaTable("Entity").SetSubMaterial))... linedefined = -1 currentline = -1 func = function: 0x1fa020f8 isvararg = true namewhat = lastlinedefined = -1 source = =[C] nups = 0 what = C nparams = 0 short_src = [C]

And

[ERROR] lua_run:1: attempt to index global 'E2Lib' (a nil value)

  1. unknown - lua_run:1
btg611 commented 5 years ago

well thats strange... i rebooted my server and now wire extras is the only addon in the wire tab...

thegrb93 commented 5 years ago

That explains the E2Lib error. Fix that first.

btg611 commented 5 years ago

Yes, I'm fixing it via my SVN now. I'll let you know if anything changes. I think my server still had the workshop version in the collection. If that's what the issue was I'm gonna feel really dumb...

btg611 commented 5 years ago

Ok, after fixing the issue with the whole E2lib eror(which was strange because that hadn't happened before), this is the return from my server console. lua_run PrintTable(debug.getinfo(FindMetaTable("Entity").SetSubMaterial))

PrintTable(debug.getinfo(FindMetaTable("Entity").SetSubMaterial))... linedefined = -1 currentline = -1 func = function: 0x0083b2b0 isvararg = true namewhat = lastlinedefined = -1 source = =[C] nups = 0 what = C nparams = 0 short_src = [C] } lua_run PrintTable(debug.getinfo(E2Lib.setSubMaterial)) PrintTable(debug.getinfo(E2Lib.setSubMaterial))... linedefined = 34 currentline = -1 func = function: 0x29f616b0 isvararg = false namewhat = lastlinedefined = 39 source = @lua/entities/gmod_wire_expression2/core/e2lib.lua nups = 0 what = Lua nparams = 3 short_src = lua/entities/gmod_wire_expression2/core/e2lib.lua

After loading up the server and joining, the issue persists. I still have no clue why. Hopefully this gives some further insight into what is going on.

thegrb93 commented 5 years ago

Can you give a simple piece of code that does what you want on other servers but doesn't do what you want for your own server?

thegrb93 commented 5 years ago

Also have you tested to see if your fixes have fixed the issue? Those lua_run look good

btg611 commented 5 years ago

I have tried it again and it's still not right. Here is the code as it is originally for the holo in the screenshots i have provided. The colors in the material files explain what it should look like:

holoEntity(A):setSubMaterial(8,"bobsters_trains/br_yellow") holoEntity(A):setSubMaterial(7,"models/proppertextures/acrylic_black") holoEntity(A):setSubMaterial(3,"models/proppertextures/acrylic_black") holoEntity(A):setSubMaterial(1,"bobsters_trains/br_beige")

to get it to show as intended, it needs to be changed(on my server only) to:

holoEntity(A):setSubMaterial(7,"bobsters_trains/br_yellow") holoEntity(A):setSubMaterial(6,"models/proppertextures/acrylic_black") holoEntity(A):setSubMaterial(2,"models/proppertextures/acrylic_black") holoEntity(A):setSubMaterial(0,"bobsters_trains/br_beige")

btg611 commented 5 years ago

For better reference, I'll add the screenies here again: MY server: https://user-images.githubusercontent.com/47315763/60928011-d03e5800-a279-11e9-9967-a0a21aafff9a.jpg https://user-images.githubusercontent.com/47315763/60928012-d03e5800-a279-11e9-95b8-10750e9bf5eb.jpg Other servers(How it SHOULD appear): https://user-images.githubusercontent.com/47315763/60928013-d0d6ee80-a279-11e9-8596-e5aaa1404660.jpg https://user-images.githubusercontent.com/47315763/60928014-d0d6ee80-a279-11e9-8604-220f303198d2.jpg

thegrb93 commented 5 years ago

Can you put the output of this one? lua_run PrintTable(debug.getinfo(wire_expression2_funcs["setSubMaterial(e:ns)"][3]))

btg611 commented 5 years ago

PrintTable(debug.getinfo(wire_expression2_funcs["setSubMaterial(e:ns)"][3]))... linedefined = 601 currentline = -1 func = function: 0x2072f0b0 isvararg = false namewhat = lastlinedefined = 605 source = @entities/gmod_wire_expression2/core/custom/admincore.lua nups = 0 what = Lua nparams = 2 short_src = entities/gmod_wire_expression2/core/custom/admincore.lua } Does that mean AdminCore is a conflicting addon?

bigdogmat commented 5 years ago

Yes considering it's overwriting an existing default function.

btg611 commented 5 years ago

Aha! I will try uninstalling that and see what it does.

btg611 commented 5 years ago

Oh my jesus it's fixed. Thank you guys so much for all of your help. I couldn't have done it without you.

What a strange addon to cause this... I even tried removing a few before this that were submaterial related but to no avail.

Again, thank you so much for all your help. you guys are the best. Cheers.

thegrb93 commented 5 years ago

np

Divran commented 5 years ago

could you post a link to that extension

edit: nevermind found it https://steamcommunity.com/sharedfiles/filedetails/?id=261302649

btg611 commented 5 years ago

Yep, that's the one