Search found 13 matches

by inferis
Thu Jan 09, 2020 7:24 pm
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Re: Factorio, Lua and OO

I would definitely be interested in checking this out if I get back into Factorio modding. if they can't get something working Isn't the point that it should be a (mostly) working library? :P You can still make use of it as you learn about things, if that's the position you're in. Also, the goal is...
by inferis
Wed Jan 08, 2020 9:13 pm
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Re: Factorio, Lua and OO

Lua doesn't have a real concept of self. The only thing close to it is using ":" syntax to call a "method" instead of ".". Well, it kinda does. The ':' call syntax compiles to a different lua vm opcode, SELF which does the lookup operation and prepares the resulting fu...
by inferis
Fri Dec 13, 2019 9:28 pm
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Re: Factorio, Lua and OO

Doesn't lua already allow __self? One can already "inherit" metatables by doing a get set metatable()... Constructors aren't necessarily needed in lua, if you handle nils. Lua doesn't have a real concept of self. The only thing close to it is using ":" syntax to call a "met...
by inferis
Thu Dec 12, 2019 1:28 pm
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Re: Factorio, Lua and OO

It will take any value, visit all keys and values (if applicable), checks for class information on the deserialized object and uses it to recreate the class around that object. Non class objects are left alone. Sounds almost like you could put it in _ENV, but that'd be a little weird i think. Not s...
by inferis
Tue Dec 10, 2019 9:30 am
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Re: Factorio, Lua and OO

Why do you ask? Because metatables (the whole point of your library) are not kept between save/loads. If you have a simple way to fix that i'd love to see it. I have. This is one of the tests I wrote: test("serialization", function() local serialized -- common class initialization local f...
by inferis
Sun Dec 08, 2019 6:33 pm
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Re: Factorio, Lua and OO

PyroFire wrote: ↑Sat Dec 07, 2019 4:51 pm does it work with on_load?
It does.
Why do you ask?
by inferis
Sat Dec 07, 2019 2:15 pm
Forum: Modding discussion
Topic: Factorio, Lua and OO
Replies: 15
Views: 4774

Factorio, Lua and OO

For a mod I'm working on (mainly a shuttle mod tailored to my own gameplay style), I built a small framework that allows you to build a Lua based class hierarchy, allowing a more object oriented approach in building things. Sue me, I'm old. I noticed some other mods have something similar, but I hav...
by inferis
Sun Nov 03, 2019 1:43 am
Forum: Modding help
Topic: Closing entity gui when player moves away
Replies: 4
Views: 1343

Re: Closing entity gui when player moves away

The refresh rate at which the first is called is not very high, but it should do the trick. The "refresh rate" of on_changed_position are the tile boundaries. If that's "not very high"...why are you moving inside a single tile so much ;). Well of course, that makes sense. :D
by inferis
Fri Nov 01, 2019 2:40 pm
Forum: Modding help
Topic: Test MP?
Replies: 6
Views: 1981

Re: Test MP?

That seems to be what I was looking for. Thanks!

I seem to be confused about what causes desync, then. I assumed that it was high latency causing clients to get out of sync, but apparently that's not the case then?
by inferis
Fri Nov 01, 2019 3:52 am
Forum: Modding help
Topic: Test MP?
Replies: 6
Views: 1981

Re: Test MP?

Yeah, that's what I figured, but it would hardly test higher latency issues.

Oh well, I guess that's a good start anyway. Thanks!
by inferis
Fri Nov 01, 2019 2:25 am
Forum: Modding help
Topic: Closing entity gui when player moves away
Replies: 4
Views: 1343

Re: Closing entity gui when player moves away

There's [url=https://lua-api.factorio.com/latest/events.html#on_player_changed_position]on_player_changed_position[/url] and [url=https://lua-api.factorio.com/latest/events.html#on_player_changed_surface]on_player_changed_surface[/url] . The refresh rate at which the first is called is not very high...
by inferis
Fri Nov 01, 2019 2:19 am
Forum: Modding help
Topic: Help to with elements gui overlapping !
Replies: 1
Views: 889

Re: Help to with elements gui overlapping !

Have you tried adding a flow to the tab, and then the buttons to the flow?
by inferis
Fri Nov 01, 2019 2:15 am
Forum: Modding help
Topic: Test MP?
Replies: 6
Views: 1981

Test MP?

I've searched around a bit but didn't find a answer immediately, but…

how would I test my mod with MP, apart from running an actual MP game with other people? I'd like to make sure there's no desync issues, something of which I'm not confident at the moment.

Go to advanced search