[MOD 0.16.x] NiceFill

Topics and discussion about specific mods
staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

[MOD 0.16.x] NiceFill

Post by staviq »

NiceFill

Landfill has the same texture as the surrounding tiles, instead of the default grass.

https://mods.factorio.com/mod/nicefill



Since people were asking, this thread is now the official way to report bugs.

When reporting a bug, ALWAYS post your log file, and if possible, your latest game save file too.

nbrpg
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jul 08, 2016 5:37 am
Contact:

Re: [MOD 0.16.x] NiceFill

Post by nbrpg »

Thanks for the mod! My landfilled world looks much nicer.

I don't have any bugs to report, but I have a question if another feature could be implemented.

FARL allows you to automatically place landfill when water is in your path while laying track. Unfortunately, FARL places the normal landfill that doesn't match the terrain so it is best to stop the train and manually place landfill before continuing, if you want it to look good. Is it possible for this mod to make FARL use the NiceFill method of placing landfill instead? It would provide a little more time savings and enhance the landscape when lazy players like me use FARL to lay their train tracks.

Thanks for reading, and thanks again for the great mod!

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

nbrpg wrote:Thanks for the mod! My landfilled world looks much nicer.

I don't have any bugs to report, but I have a question if another feature could be implemented.

FARL allows you to automatically place landfill when water is in your path while laying track. Unfortunately, FARL places the normal landfill that doesn't match the terrain so it is best to stop the train and manually place landfill before continuing, if you want it to look good. Is it possible for this mod to make FARL use the NiceFill method of placing landfill instead? It would provide a little more time savings and enhance the landscape when lazy players like me use FARL to lay their train tracks.

Thanks for reading, and thanks again for the great mod!

Hi.

FARL doesn't seem to properly notify the game it has used the landfill, so it's not really a landfill it uses, it just forces tile to have ground tile.

I have messaged FARL author with a request to add on_player_built_tile event tho FARL, this would make NiceFill automatically compatible with FARL.

I supose if FARL author does add my proposed modification, the only thing you would need to do is to update FARL, so just check the mod portal periodically for updates.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by steinio »

Hi,

i get this error on placing landfill:

Code: Select all

204.353 Error MainLoop.cpp:1029: Exception at tick 12495134: Error while running event nicefill::on_player_built_tile (ID 45)
"infinite-clowns-ore1" is not a valid autoplace control name.
stack traceback:
	__nicefill__/control.lua:135: in function 'do_nicefill'
	__nicefill__/control.lua:179: in function <__nicefill__/control.lua:178>
infinite-clowns-ore1 is from https://mods.factorio.com/mod/Clowns-Extended-Minerals

Cu, steinio.
Image

Transport Belt Repair Man

View unread Posts

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

steinio wrote:Hi,

i get this error on placing landfill:

Code: Select all

204.353 Error MainLoop.cpp:1029: Exception at tick 12495134: Error while running event nicefill::on_player_built_tile (ID 45)
"infinite-clowns-ore1" is not a valid autoplace control name.
stack traceback:
	__nicefill__/control.lua:135: in function 'do_nicefill'
	__nicefill__/control.lua:179: in function <__nicefill__/control.lua:178>
infinite-clowns-ore1 is from https://mods.factorio.com/mod/Clowns-Extended-Minerals

Cu, steinio.
Hi.

Couple of questions:

1. Multiplayer or singe player ?
2. Did you add "Clowns Extended Minerals" to an existing game or was it a fresh start ?

EDIT:

I think i know what's going on, i had this problem once before but were unable to reproduce since.

The problem seems to be as follows. When factorio creates new game, it reads all possible ores and tiles and decorations that mods add to the game, and builds this "autoplace_controls" object-thingy. Now, NiceFill duplicates the game map with changed settings ( like disabled water ) so it can check what would be on given tile if there was no water on the map. This is achieved by creating a copy of autoplace_controls from the main surface, disabling a few things and using it to generate surface copy.

The thing is, if you disable or enable a mod, mid-game, that adds or changes any tile ore or decorative, autoplace_controls of the main surface becomes sort of invalid, it still contains old data. If NiceFill tries to create a surface copy from those invalid autoplace_controlls, the exact problem You described happens.

I have honestly never been able to sort this thing out, there is no way of validating autoplace_controls other that using it and this soft crashes the game if they are incorrect.

I think I'll post this as a Factorio bug, see what the devs have to say about it.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.16.x] NiceFill

Post by Nexela »

It might be possible (until the outcome of your bug report) in the meantime for you to use the on_config_changed event rewrite the map_gen_settings by removing invalid ones yourself. (iterate the table and remove anything with no data.raw["auto-place-controls"] etc etc)

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

Nexela wrote:It might be possible (until the outcome of your bug report) in the meantime for you to use the on_config_changed event rewrite the map_gen_settings by removing invalid ones yourself. (iterate the table and remove anything with no data.raw["auto-place-controls"] etc etc)
Thanks for the suggestion, I'll try that.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by steinio »

Well sounds like a game bug if the data is not revalidated on mod change.

I added the mod into an existing game.

Can't you add sanity checks on placing landfill that it not crashes?
Image

Transport Belt Repair Man

View unread Posts

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

steinio wrote:Can't you add sanity checks on placing landfill that it not crashes?
I have added a pcall wrapper for creating surface copy, and it seems to be stable workaround.

Now, when the bug happens, you'll get a message and landfill will revert back to the default texture without soft crashing the game.

0.1.4 should be available on mod portal.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by steinio »

staviq wrote:
steinio wrote:Can't you add sanity checks on placing landfill that it not crashes?
I have added a pcall wrapper for creating surface copy, and it seems to be stable workaround.

Now, when the bug happens, you'll get a message and landfill will revert back to the default texture without soft crashing the game.

0.1.4 should be available on mod portal.
Thank you.
Image

Transport Belt Repair Man

View unread Posts

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by steinio »

Hey hey hey,

i worked on an own mod today and crashed also with map_gen_settings.
I got so annoyed until i made a quick fix:

Code: Select all

function validate_map_gen_settings(map_gen_settings)
    if map_gen_settings ~= nil then
        for s, t in pairs(map_gen_settings.autoplace_controls) do
            local found = false

            for u, v in pairs(game.autoplace_control_prototypes) do
                if s == u then found = true end
            end

            if found == false then
                map_gen_settings.autoplace_controls[s] = nil
            end
        end
    end

    return map_gen_settings
end
This function removes all autoplace_controls with no autoplace_control_prototype.

Change line 146 in your control.lua to:

Code: Select all

if pcall( game.create_surface,"NiceFill", validate_map_gen_settings(map_gen_settings) ) then
and add the function to the end of this file or use this:
control.lua
(7.2 KiB) Downloaded 172 times
Happy NiceFilling again.
Image

Transport Belt Repair Man

View unread Posts

Graydee
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Mar 16, 2018 12:31 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by Graydee »

Hello, i have some weird interactions with New Islands mod, if i have both enabled(just test right now, just 2 mods), if i place landfill on rivers from NI, it don't change anything, just retextrured grass, and that's it, without NiceFill, it pop out grass, as usual.

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

Graydee wrote:Hello, i have some weird interactions with New Islands mod, if i have both enabled(just test right now, just 2 mods), if i place landfill on rivers from NI, it don't change anything, just retextrured grass, and that's it, without NiceFill, it pop out grass, as usual.
I'll check this when i get back home.

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

Graydee wrote:Hello, i have some weird interactions with New Islands mod, if i have both enabled(just test right now, just 2 mods), if i place landfill on rivers from NI, it don't change anything, just retextrured grass, and that's it, without NiceFill, it pop out grass, as usual.
New Islands mod now supports NiceFill, please update New Islands to the latest version.

Graydee
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Mar 16, 2018 12:31 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by Graydee »

Yeah, i just wrote both of you XD , and he do update faster. lol

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

Graydee wrote:Yeah, i just wrote both of you XD , and he do update faster. lol
He updated because the bug was impossible to fix on my side :)
NI overrides water placement, so when NF tried to generate a hidden map chunk with no water to copy textures from, NI stealthily added water there anyway.
So the solution was for the NI mod to add exception that ignores NiceFill hidden surface, therefore the fix is in the NI mod.

User avatar
Game4Lols
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun Jan 28, 2018 9:30 am
Contact:

Re: [MOD 0.16.x] NiceFill

Post by Game4Lols »

Does the mod decrease performance if it makes a second surface? I haven't noticed a drop in us or anything, just curious.

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

Game4Lols wrote:Does the mod decrease performance if it makes a second surface? I haven't noticed a drop in us or anything, just curious.
It will slightly increase the save size, and have a tiny lag only while actually placing landfill, besides that, the mod is completely inactive and does not have any background tasks.

For what i understand, having a second surface won't impact performance because there will never be any biters or buildings there, and no player will ever visit it, so there are no chunks to be processed by Factorio.

There is a slight possibility that some other mods might increase their ups impact when additional surfaces are present but i have no influence over this, and have never had such issues.

User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 582
Joined: Tue May 19, 2015 1:56 am
Contact:

Re: [MOD 0.16.x] NiceFill

Post by Reika »

I am having an issue where this mod causes landfill to place water, which makes landfill completely useless - and kills the player if standing too close.

ChokePoint might be involved; does this mod refire the on_chunk_generated?

EDIT: It appears you use a second surface, which ChokePoint is going to carve up as it does the main one. Thus, Nicefill appears to be placing water from its second surface.
Image

staviq
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Jun 29, 2016 1:22 pm
Contact:

Re: [MOD 0.16.x] NiceFill

Post by staviq »

Reika wrote:I am having an issue where this mod causes landfill to place water, which makes landfill completely useless - and kills the player if standing too close.

ChokePoint might be involved; does this mod refire the on_chunk_generated?

EDIT: It appears you use a second surface, which ChokePoint is going to carve up as it does the main one. Thus, Nicefill appears to be placing water from its second surface.
I'm gonna look at this when I go back from work, but generally the hidden surface is sacred, and if a mod tried to modify it it will break things. Not to worry, I'll try to persuade the other mods dev to exclude nicefill surface :)

Post Reply

Return to “Mods”