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
554 stars 332 forks source link

Fix wirelink issues #2942

Closed Denneisk closed 10 months ago

Denneisk commented 10 months ago

Fixes #2940

Denneisk commented 10 months ago

@Grocel You can check for wirelinks with this just by doing

function ENT:TriggerInput(name, value, ext)
local wired = self:IsConnectedInputWire(name) or istable(ext) and ext.wirelink
Grocel commented 10 months ago

@Grocel You can check for wirelinks with this just by doing

function ENT:TriggerInput(name, value, ext)
local wired = self:IsConnectedInputWire(name) or istable(ext) and ext.wirelink

Thanks, this is very helpful! Is it guaranteed to be passed with every trigger call that might come via wirelink? I think it could be helpful to pass the name of the wirelink it was coming from as well. Like if it was triggered via "wirelinkA" or "wirelinkB" etc. in case of multiple wirelink ports.

Denneisk commented 10 months ago

Is it guaranteed to be passed with every trigger call that might come via wirelink?

As far as I know, wirelinks are only usable with E2, so this will always exist for a wirelink input.

I think it could be helpful to pass the name of the wirelink it was coming from as well.

Wirelinks are just entities and they don't directly retain any information about Wiremod wires, so that's a lot more involved. I would recommend not creating multiple wirelink outputs since they're all the same.

Grocel commented 10 months ago

As far as I know, wirelinks are only usable with E2, so this will always exist for a wirelink input. Wirelinks are just entities and they don't directly retain any information about Wiremod wires, so that's a lot more involved. I would recommend not creating multiple wirelink outputs since they're all the same.

That's fine for my part. I will apply your hint into my addon soon. I am not that familiar with the current Workshop release scheduling nowadays, but I think it will be quite a while until the next "stable" releases. So I will have to account for the older live version as well.

Denneisk commented 10 months ago

@Vurv78 @thegrb93 Do either of you have anything more to say?

thegrb93 commented 10 months ago

Is https://github.com/wiremod/wire/pull/2941 able to be closed then?

Denneisk commented 10 months ago

Yes.