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

EGP Objects invisible if Index is higher than MaxObjects #1476

Open gamerpaddy opened 6 years ago

gamerpaddy commented 6 years ago

EGP objects wont be drawn if the Index of them is higher than the Max Objects count, without actually having so many Objects.

Example e2 code: it creates an object on a specific index, and removes the object that was create before.

since egpHasObject returns 1, the object is created, just not visible.

@name 

@inputs S:wirelink   

@persist I

runOnTick(1)

while(egpCanSendUmsg() & perf(1)){

    I++   

    S:egpText(I,""+I,vec2(256))

    if(!S:egpHasObject(I)){print(I)}

    S:egpRemove(I-1)

}
shadowscion commented 6 years ago

IIRC, the egp index is actually clamped to the max objects convar, instead of actually counting the number of objects. This is not necessarily a bug, but it is a silly way to do it.

https://github.com/wiremod/wire/blob/c47401502fd5800f6344a64276533a7a58800416/lua/entities/gmod_wire_egp/lib/egplib/objectcontrol.lua#L200

It would be nice if it worked like holograms, where regardless of count, you can use any number as the index. One common use for this is using hashes/steamIDs as the index.

Just-Boog commented 6 years ago

I'm bored today, I'll go tinker with it. I was pretty butthurt about this too.

AbigailBuccaneer commented 6 years ago

@Divran do you feel like this is a bug or by design?

Divran commented 6 years ago

well, it is by design. but that design is probably terrible

chinoto commented 6 years ago

I'll give it a go, hopefully I don't fail miserably :laughing: Not quite sure if this line needs removal, change, or to be left alone... thinking the last one. https://github.com/wiremod/wire/blob/ce5f234c5855889de798cc992ba54a367e0319c6/lua/entities/gmod_wire_egp/lib/egplib/objectcontrol.lua#L111 Edit: Dunno why I thought reordering would modify indexes, that would make EGP very difficult... I don't have Garry's Mod installed yet, but here's my untested go at it: https://github.com/wiremod/wire/compare/master...chinoto:fix-1476-egpObject-limit

chinoto commented 5 years ago

I happened to fetch upstream today and noticed this branch, so I rebased it on upstream/master while I was in there. Still untested... https://github.com/wiremod/wire/compare/master...chinoto:fix-1476-egpObject-limit