Search found 22 matches

by fredthedeadhead
Wed Feb 09, 2022 9:39 pm
Forum: Modding discussion
Topic: LUA IDE with typehint support
Replies: 6
Views: 498

Re: LUA IDE with typehint support

I'm using TypescriptToLua and GlassBricks/typed-factorio for exactly the same reason. It's working really well. I'd never used TypeScript (or Javascript) before I started, but I found it easy to pick up. IntelliJ supports autocomplete well.
by fredthedeadhead
Mon Jan 24, 2022 12:00 am
Forum: Modding help
Topic: Questions about x/y coordinates of MapPosition, ChunkPosition, TilePosition
Replies: 2
Views: 359

Re: Questions about x/y coordinates of MapPosition, ChunkPosition, TilePosition

Thanks boskid! The 'round towards negative infinity' tip was really useful. I have something that's working now. Here's a preview https://i.imgur.com/UhkPlOA.mp4 That's me clicking around the web-map I generated from my Factorio test map. I drew letters in concrete to make sure the map tiles were ge...
by fredthedeadhead
Mon Jan 17, 2022 9:28 pm
Forum: Modding help
Topic: Questions about x/y coordinates of MapPosition, ChunkPosition, TilePosition
Replies: 2
Views: 359

Questions about x/y coordinates of MapPosition, ChunkPosition, TilePosition

I'm exporting tile-data based on events into a file, and I'm trying to combine them into chunks so that I can make PNGs of them. I'm getting confused because I'm not clear on the coordinate system that Factorio is using, and whether it's the same for each of these different positions. I have a lot o...
by fredthedeadhead
Wed Dec 22, 2021 10:14 pm
Forum: Releases
Topic: Version 1.1.49
Replies: 10
Views: 7282

Re: Version 1.1.49

LuaObjects are now saved using binary format instead of previous format with intermediate Lua table. This speeds up general handling of LuaObjects and makes saving and loading with a lot of them noticable faster. Would it be possible to access this encoded data it in a mod, and then document it so ...
by fredthedeadhead
Wed Dec 22, 2021 10:11 pm
Forum: Modding interface requests
Topic: Small documentation improvement requests
Replies: 221
Views: 24395

Re: Small documentation improvement requests

-> Thanks for the hints, both of these are fixed for the next release. Hi, I see that LuaSurface is updated, thanks! But Position x/y is not, they still show ints. Concepts.html#Position -> The Position concept has been removed for the next version, everything now uses the specialized positions lik...
by fredthedeadhead
Sun Nov 28, 2021 9:52 am
Forum: Modding help
Topic: Documentation says Position x/y are ints, but they return floats
Replies: 2
Views: 260

Re: Documentation says Position x/y are ints, but they return floats

Done, thanks! I'm looking quite closely at the types of fields so it's good to know where to go.

Having the correct types documented makes using https://github.com/GlassBricks/typed-factorio/ even more useful.
by fredthedeadhead
Sun Nov 28, 2021 9:50 am
Forum: Modding interface requests
Topic: Small documentation improvement requests
Replies: 221
Views: 24395

Re: Small documentation improvement requests

I think I've found some mis-typed fields: [list=1] [*] https://lua-api.factorio.com/latest/Concepts.html#Position Position x and y are documented as being ints, but when I get the player's position, it returns floating point numbers with decimal places. /c local p = game.player p.print(p.position.x...
by fredthedeadhead
Sun Nov 28, 2021 9:09 am
Forum: Modding help
Topic: Documentation says Position x/y are ints, but they return floats
Replies: 2
Views: 260

Documentation says Position x/y are ints, but they return floats

https://lua-api.factorio.com/latest/Concepts.html#Position Position x and y are documented as being ints, but when I get the player's position, it returns floating point numbers with decimal places. /c local p = game.player p.print(p.position.x.." "..p.position.y) -0.05078125, 46.48828125 ...
by fredthedeadhead
Wed Nov 03, 2021 6:58 pm
Forum: Modding help
Topic: How do associated characters work?
Replies: 8
Views: 734

Re: How do associated characters work?

Bob's classes and character mod , for example, allows you to construct characters and leave avatars of yourself in the world. Say, your current character is of the miner's class. It's your character (player.character) which you are currently controlling: You move it up with <W>, you let it mine som...
by fredthedeadhead
Wed Nov 03, 2021 6:55 pm
Forum: Won't implement
Topic: Rename on_player_changed_position to on_character_changed_position?
Replies: 9
Views: 995

Re: Rename on_player_changed_position to on_character_changed_position?

Gotcha, thanks for the details! I understand better now, and I appreciate you taking the time to explain.
by fredthedeadhead
Sun Oct 24, 2021 10:06 am
Forum: Modding help
Topic: How do associated characters work?
Replies: 8
Views: 734

Re: How do associated characters work?

Thanks for the explanations - I understand the documentation better now. Would this re-write make sense? ( original ) A list of logged-in characters that are associated with this player. Associated characters are not controlled by the player (TODO what does 'controlled ' mean?). Characters can be as...
by fredthedeadhead
Sun Oct 24, 2021 9:38 am
Forum: Modding help
Topic: Serialise instances of classes to JSON
Replies: 8
Views: 720

Re: Serialise instances of classes to JSON

In case this is useful for others, I've found two other serialisation files in Clusterio

clusterio/packages/slave/modules/clusterio/serialize.lua


clusterio/plugins/inventory_sync/module/serialize.lua
by fredthedeadhead
Sun Oct 24, 2021 9:34 am
Forum: Won't implement
Topic: Rename on_player_changed_position to on_character_changed_position?
Replies: 9
Views: 995

Re: Rename on_player_changed_position to on_character_changed_position?

Is LuaPlayer.position a convenience method for LuaPlayer.character.position?
by fredthedeadhead
Fri Oct 22, 2021 8:33 am
Forum: Won't implement
Topic: Rename on_player_changed_position to on_character_changed_position?
Replies: 9
Views: 995

Re: Rename on_player_changed_position to on_character_changed_position?

Players and characters are different. Player is the controlling entity (i.e. you), character is the entity in the world that the player is bound to. Sorry yes, they're different, but when it comes to position they're the same right? LuaPlayer.position and LuaPlayer.character.position return the sam...
by fredthedeadhead
Thu Oct 21, 2021 11:33 pm
Forum: Modding help
Topic: How do associated characters work?
Replies: 8
Views: 734

Re: How do associated characters work?

The reason the player.character is not included in the result is that it is controlled by the player. As the doc says, the function is for any characters that are associated with a player but "are NOT controlled by any player". Sorry I don't understand. The full section says Note: Charact...
by fredthedeadhead
Thu Oct 21, 2021 10:48 pm
Forum: Modding help
Topic: Serialise instances of classes to JSON
Replies: 8
Views: 720

Re: Serialise instances of classes to JSON

Not sure what you are doing. But have you tried simply creating a list of fields you want to serialize for e.g. an inserter. Then loop over that list and for each field store serpent.block(entity[field])? I haven't tried that, I'm new to Lua so would you mind giving an example? I've managed to get ...
by fredthedeadhead
Thu Oct 21, 2021 10:41 pm
Forum: Won't implement
Topic: Rename on_player_changed_position to on_character_changed_position?
Replies: 9
Views: 995

Re: Rename on_player_changed_position to on_character_changed_position?

D'oh you're right, my mistake. I got confused by the documentation talking about players/characters as if they're different.
by fredthedeadhead
Wed Oct 20, 2021 7:25 pm
Forum: Won't implement
Topic: Rename on_player_changed_position to on_character_changed_position?
Replies: 9
Views: 995

Rename on_player_changed_position to on_character_changed_position?

The event on_player_changed_position provides a player_index , but it's not the player that's updated - it's the player's character. To be more accurate, the event should be called on_character_changed_position , which should provide the same parameters (for convenience), plus the unit_number of cha...
by fredthedeadhead
Wed Oct 20, 2021 7:18 pm
Forum: Modding help
Topic: How do associated characters work?
Replies: 8
Views: 734

How do associated characters work?

What's the purpose of LuaPlayer.get_associated_characters()? I've run a quick test and it doesn't return anything - why isn't LuaPlayer.character included in the result (when the player is connected)?
by fredthedeadhead
Wed Oct 20, 2021 6:57 pm
Forum: Modding help
Topic: Serialise instances of classes to JSON
Replies: 8
Views: 720

Re: Serialise instances of classes to JSON

I've found this topic which is similar. https://forums.factorio.com/viewtopic.php?t=74131&p=448975. Rseding91 replied, and said none of the options would happen. I agree that modifying the source classes to add serialisation would be very detrimental, but I'd ask if Factorio could provide a util...

Go to advanced search