Search found 1790 matches

by Pi-C
Sat Feb 21, 2026 6:15 pm
Forum: Ideas and Suggestions
Topic: Machine gun train attachments
Replies: 3
Views: 321

Re: Machine gun train attachments

You may also want to check out Armored Train (Turret Wagons).
by Pi-C
Sat Feb 21, 2026 4:51 pm
Forum: Resolved Requests
Topic: CharacterCorpsePrototype: use of picture/pictures
Replies: 2
Views: 231

Re: CharacterCorpsePrototype: use of picture/pictures

Thank you! Also, I've just found something about CharacterCorpsePrototype::armor_picture_mapping :

Table of key value pairs, the keys are armor names and the values are numbers. The number is the Animation that is associated with the armor, e.g. using 1 will associate the armor with the first ...
by Pi-C
Sun Feb 15, 2026 11:02 am
Forum: Modding interface requests
Topic: Allow for preferred tiles in LuaSurface::request_path
Replies: 0
Views: 183

Allow for preferred tiles in LuaSurface::request_path

What
Please allow for calling LuaSurface::request_path with a new argument preferred_tiles . This could be in the form

-- Array of arrays of tile prototype names.
preferred_tiles = {
-- All tiles listed in an array have the same
{ "concrete", "hazard-concrete-left", "hazard-concrete-right ...
by Pi-C
Sun Feb 15, 2026 9:53 am
Forum: Modding help
Topic: Understanding Lua
Replies: 11
Views: 795

Re: Understanding Lua


Moreover, ProductPrototype comprises both ItemProductPrototype and FluidProductPrototype , so you can also return fluids!

You may also want to use results for shenanigans like a probability that mining will yield anything, a random yield amount within a given range, spoiled products, etc. Using ...
by Pi-C
Sun Feb 15, 2026 6:37 am
Forum: Modding help
Topic: Understanding Lua
Replies: 11
Views: 795

Re: Understanding Lua


Eventually this led me to the API Docs (which I find terribly intimidating, but I think mostly on account of I just don't really understand how to use it / read it... Yet!) and my first real attempt to understand them. So I went and tried to wrap my brain around that, found the MinableProperties ...
by Pi-C
Fri Feb 13, 2026 6:35 am
Forum: Resolved Requests
Topic: CharacterCorpsePrototype: use of picture/pictures
Replies: 2
Views: 231

CharacterCorpsePrototype: use of picture/pictures

The documentation for CharacterCorpsePrototype tells us that pictures is mandatory if picture is not defined, and that picture is mandatory if pictures is not defined. However, it doesn't tell which will be used if both picture and pictures are defined in the prototype.

According to my tests ...
by Pi-C
Mon Oct 27, 2025 1:25 am
Forum: Modding help
Topic: How to modify entity.tags?
Replies: 7
Views: 962

Re: How to modify entity.tags?


Where should I store data between deconstruction and cancelling deconstruction (Ctrl+Z)

I have no practical experience with this, but these events look useful:

on_cancelled_deconstruction
on_marked_for_deconstruction
on_player_deconstructed_area
on_pre_ghost_deconstructed



How should I ...
by Pi-C
Sun Oct 26, 2025 8:33 am
Forum: Modding help
Topic: How to modify entity.tags?
Replies: 7
Views: 962

Re: How to modify entity.tags?

FeelusM wrote: Sat Oct 25, 2025 11:21 pm Or I should save it in `storage.some_data[entity.unit_number]` and write boilerplate code for transferring it between `storage` and `ghost_entity.tags` for numerous events?
This is the way to go. :-)
by Pi-C
Sat Oct 25, 2025 10:26 pm
Forum: Modding help
Topic: How to modify entity.tags?
Replies: 7
Views: 962

Re: How to modify tags?

See the description of LuaEntity::tags:
The tags associated with this entity ghost. nil if this is not an entity ghost or when the ghost has no tags.
So I guess you can't add tags to your entity because you're dealing with real entities instead of entity ghosts …
by Pi-C
Wed Oct 22, 2025 7:26 pm
Forum: Modding help
Topic: Error message info.json file
Replies: 5
Views: 1124

Re: Error message info.json file

Common mistakes are that
  • the last line before the closing brace '}' ends with a comma
  • the other lines after the opening brace '{' DO NOT end with a comma
I am not sure whether empty lines are allowed between the braces. In the above, 'line' refers to lines that actually contain text.
by Pi-C
Sun Oct 19, 2025 4:54 am
Forum: Modding help
Topic: Error message info.json file
Replies: 5
Views: 1124

Re: Error message info.json file

You've got these two lines wrong:


"factorio_version": "2.0.69",
"dependencies": ["base >= 1.0.0"],

The mod should load if you change them to

"factorio_version": "2.0",
"dependencies": [
"base >= 2.0.69",
"space-age >= 2.0.69"
],
by Pi-C
Sun Oct 05, 2025 8:59 pm
Forum: Modding help
Topic: I managed it to crash the game without a error report
Replies: 16
Views: 2035

Re: I managed it to crash the game without a error report


get_chunks() returns a LuaChunkIterator object. This can be saved in storage and the chunk handles can be retrieved one at a time with the next() function. Keep getting chunks a few at a time (e.g. in a "for n=1,5 do" loop) until it returns nil. if you need to do another scan, start over with a ...
by Pi-C
Sun Oct 05, 2025 4:23 pm
Forum: Modding help
Topic: I managed it to crash the game without a error report
Replies: 16
Views: 2035

Re: I managed it to crash the game without a error report


If you only need to know if a chunk has water, and not where it is, instead of "find_tiles_filtered", use "count_tiles_filtered".


@Paned named the function spawn_morphed_fish(), so I guess it is relevant where the water tiles are located. This poses another problem: how do you determine where ...
by Pi-C
Sun Oct 05, 2025 4:07 pm
Forum: Modding help
Topic: I managed it to crash the game without a error report
Replies: 16
Views: 2035

Re: I managed it to crash the game without a error report


The best improvement would be if your code runs on the on_chunk_generated event.

This will work in games where the mod has been active right from the start. But if the mod was added to a running game, you'd miss all chunks that have already been generated. You can avoid that if you build your ...
by Pi-C
Sun Oct 05, 2025 8:40 am
Forum: Resolved Requests
Topic: Missing info for LuaSurface::get_chunks()
Replies: 1
Views: 388

Missing info for LuaSurface::get_chunks()

The description of LuaTerritory::get_chunks() contains the following sentence:

Chunks may or may not be generated; use LuaSurface::is_chunk_generated to check a chunk's state before accessing it.

This sentence is missing from the description of LuaSurface::get_chunks() . Without it, people may ...
by Pi-C
Sun Oct 05, 2025 7:58 am
Forum: Modding help
Topic: I managed it to crash the game without a error report
Replies: 16
Views: 2035

Re: I managed it to crash the game without a error report


I believe surface.get_chunks() only returns generated chunks.

That's what I thought, too! However, when I was looking for the description of LuaSurface::get_chunks(), I noticed that there also is LuaTerritory::get_chunks() , which has a slightly different description:

"Chunks may or may not be ...
by Pi-C
Sat Oct 04, 2025 4:52 pm
Forum: Resolved Problems and Bugs
Topic: [2.0.69] on_chart_tag_modified not raised for changed text/icon
Replies: 2
Views: 1819

Re: [2.0.69] on_chart_tag_modified not raised for changed text/icon

Sorry, I forgot to mention that the event is raised when tag icon or text are changed by a player. But it won't be raised when icon or text are changed by script.
by Pi-C
Sat Oct 04, 2025 4:45 pm
Forum: Resolved Problems and Bugs
Topic: [2.0.69] on_chart_tag_modified not raised for changed text/icon
Replies: 2
Views: 1819

[2.0.69] on_chart_tag_modified not raised for changed text/icon

What?
According to the description, on_chart_tag_modified will be "[c]alled when a chart tag is modified by a player or by script." However, the event is only raised if tag position or tag surface have been changed – changes to icon or text are ignored.

How to reproduce
I've started a new game ...
by Pi-C
Sat Oct 04, 2025 2:17 pm
Forum: Modding help
Topic: I managed it to crash the game without a error report
Replies: 16
Views: 2035

Re: I managed it to crash the game without a error report


i do like the second version better :)

Thank you for helping me out here.

But still. As soon as this code is fired my game freezes :(

is there something wrong with the .find_tiles_filtered function?

I don't see anything wrong with it. It does run in a newly started game (inverted the ...

Go to advanced search