Page 1 of 3

[0.17] Painless landfill

Posted: Tue Apr 16, 2019 9:02 am
by zOldBulldog
There used to be a number of landfill mods. Out came 0.17 with an implementation of landfill in blueprints and most mods went away.

But, the 0.17 implementation of landfill is clunky, mainly because you have to add landfill to the blueprint for it to work... Clunky. There is a mod that let's you add landfill to your older blueprints, but... you are still messing with the blueprints.

This is what I think the ideal behavior would be:

- Blueprints stay clean, no landfill.

- If you shift-click a blueprint over water, it places the landfill, letting you place again for the blueprint (similar to 0.17 blueprint that has landfill in it).

- Landfill is automatically placed under objects or tiles that were saved in the blueprint. That way you can choose whether to cover a whole area (good for a factory) or just where the objects are (good for rail).

- If you press <ctrl><z> right after placing landfill, it removes it and returns it to your inventory.

- Any landfill placed becomes normal terrain dirt. So, if you ever remove the mod... there is no effect on the map save, and everything already placed will function fine in Vanilla.

Is there such a mod already? If no... this could easily become the standard mod for landfill, because it behaves very naturally and does what one would instinctively expect.

Re: [0.17] Painless landfill

Posted: Tue Apr 16, 2019 10:23 pm
by Qon
zOldBulldog wrote:
Tue Apr 16, 2019 9:02 am
- If you shift-click a blueprint over water, it places the landfill, letting you place again for the blueprint (similar to 0.17 blueprint that has landfill in it).
That would be nice.
zOldBulldog wrote:
Tue Apr 16, 2019 9:02 am
- If you press <ctrl><z> right after placing landfill, it removes it and returns it to your inventory.

- Any landfill placed becomes normal terrain dirt. So, if you ever remove the mod... there is no effect on the map save, and everything already placed will function fine in Vanilla.
Platforms is a mod that adds a type of landfill that you can remove again, like concrete (but you can put concrete on top of it if you want).
I'm not sure what happens if you uninstall the mod but if we ask the author nicely then maybe he will add a migration script that automatically converts platforms to landfill when uninstalled if he already hasn't done that.

Re: [0.17] Painless landfill

Posted: Sat Apr 20, 2019 1:11 am
by dewiniaid
zOldBulldog wrote:
Tue Apr 16, 2019 9:02 am
But, the 0.17 implementation of landfill is clunky, mainly because you have to add landfill to the blueprint for it to work... Clunky. There is a mod that let's you add landfill to your older blueprints, but... you are still messing with the blueprints.
BlueprintExtensions has had a rocky 0.4.x release series, but has the ability to add landfill to blueprints.

It has a few modes of operation, but by default it creates a temporary copy of the blueprint in question which is deleted when you hit "Q". (You can make the copy permanent simply by placing it in your inventory rather than clearing the cursor). So, while it fusses with blueprints, it will not modify your originals.

Mods currently have no way to detect a player placing a blueprint. (I believe it shows as several events for each ghost in the blueprint, but don't quote me that.) Thus, triggering off that behavior would be rather complicated.

Qon wrote:
Tue Apr 16, 2019 10:23 pm
I'm not sure what happens if you uninstall the mod but if we ask the author nicely then maybe he will add a migration script that automatically converts platforms to landfill when uninstalled if he already hasn't done that.
A mod can't have migration scripts that run when the mod is uninstalled, because the mod is no longer there to provide said migration scripts.

Re: [0.17] Painless landfill

Posted: Sat Apr 20, 2019 7:01 am
by Qon
dewiniaid wrote:
Sat Apr 20, 2019 1:11 am
Qon wrote:
Tue Apr 16, 2019 10:23 pm
I'm not sure what happens if you uninstall the mod but if we ask the author nicely then maybe he will add a migration script that automatically converts platforms to landfill when uninstalled if he already hasn't done that.
A mod can't have migration scripts that run when the mod is uninstalled, because the mod is no longer there to provide said migration scripts.
Seems that you are right. Thanks.

Re: [0.17] Painless landfill

Posted: Wed May 15, 2019 4:29 pm
by Schallfalke
Qon wrote:
Sat Apr 20, 2019 7:01 am
dewiniaid wrote:
Sat Apr 20, 2019 1:11 am
Qon wrote:
Tue Apr 16, 2019 10:23 pm
I'm not sure what happens if you uninstall the mod but if we ask the author nicely then maybe he will add a migration script that automatically converts platforms to landfill when uninstalled if he already hasn't done that.
A mod can't have migration scripts that run when the mod is uninstalled, because the mod is no longer there to provide said migration scripts.
Seems that you are right. Thanks.
An option would be write a new mod to purely do the revert or recovery migrations.
Such a special mod should execute once and get removed/destroyed afterwards, Mission Impossible style! 8-)

Re: [0.17] Painless landfill

Posted: Wed May 15, 2019 7:13 pm
by eradicator
Schallfalke wrote:
Wed May 15, 2019 4:29 pm
An option would be write a new mod to purely do the revert or recovery migrations.
Such a special mod should execute once and get removed/destroyed afterwards, Mission Impossible style! 8-)
A better option would be for the original author to include a command in his mod "/modname uninstall". Or if you want a masochistic "generic" solution you can write a mod that can replace arbitrary things on a map with other arbitrary things (i.e. a map-wide no-cost upgrade planner).

In any case you can only "uninstall" a mod while it it still installed, because otherwise the base game will automatically migrate everything that mod added into the void. :p

Re: [0.17] Painless landfill

Posted: Wed May 15, 2019 8:09 pm
by Qon
Or it could be a simple command. Why commands disable achievements I don't know but there's a mod (Someone's Lua Console) that adds a console that doesn't disable your achievements.

Re: [0.17] Painless landfill

Posted: Wed May 15, 2019 9:16 pm
by Schallfalke
Be reminded that we, as modders, know entering console commands, does not mean that many players know and/or want to do that.
In their point of view, download and enable a mod is a thousand times easier than inputting some console commands.

And in the programming point of view, doing a simple JSON migration file to revert back entities is much simpler than some control script to replacing entities on-fly. Plus may need additional script to prevent griefers abusing the command on multiplayer servers.
At least I won't provide such powerful commands in any of my own mods. It brings much more problem than a simple JSON migration file.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 7:03 am
by eradicator
Qon wrote:
Wed May 15, 2019 8:09 pm
Or it could be a simple command. Why commands disable achievements I don't know but there's a mod (Someone's Lua Console) that adds a console that doesn't disable your achievements.
As far as i know the *only* command that disables achievements is "/c". Case in point: My mod /sudo does not disable achievements (except for the vanilla ones, because obviously my mod is a mod :p).
Schallfalke wrote:
Wed May 15, 2019 9:16 pm
Be reminded that we, as modders, know entering console commands, does not mean that many players know and/or want to do that.
In their point of view, download and enable a mod is a thousand times easier than inputting some console commands.
In my experience most people prefer to enter a quick command to get it over with over trying 5 different mods that each only solve part of the problem.
Schallfalke wrote:
Wed May 15, 2019 9:16 pm
And in the programming point of view, doing a simple JSON migration file to revert back entities is much simpler than some control script to replacing entities on-fly.
Except the engine doesn't support that.
Schallfalke wrote:
Wed May 15, 2019 9:16 pm
Plus may need additional script to prevent griefers abusing the command on multiplayer servers.
At least I won't provide such powerful commands in any of my own mods. It brings much more problem than a simple JSON migration file.
Not really. It's trivial to check "if Player.admin then". "/modname uninstall" Wasn't my idea either, there are actually mods out there already doing that.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 8:43 am
by Qon
eradicator wrote:
Thu May 16, 2019 7:03 am
Qon wrote:
Wed May 15, 2019 8:09 pm
Or it could be a simple command. Why commands disable achievements I don't know but there's a mod (Someone's Lua Console) that adds a console that doesn't disable your achievements.
As far as i know the *only* command that disables achievements is "/c". Case in point: My mod /sudo does not disable achievements (except for the vanilla ones, because obviously my mod is a mod :p).
Yeah I meant a /c code command console when I said console :)
Try /editor next time you want to disable your achievements ;)
eradicator wrote:
Thu May 16, 2019 7:03 am
Schallfalke wrote:
Wed May 15, 2019 9:16 pm
And in the programming point of view, doing a simple JSON migration file to revert back entities is much simpler than some control script to replacing entities on-fly.
Except the engine doesn't support that.
Tell Wube about it:
https://lua-api.factorio.com/latest/Migrations.html wrote:JSON Prototype migrations allow changing one prototype to another prototype. Typically this is done when re-naming something.
I agree with you on the other thing you wrote q:

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 10:04 am
by eradicator
Qon wrote:
Thu May 16, 2019 8:43 am
Try /editor next time you want to disable your achievements ;)
You want me to implement /sudo editor :P?
Qon wrote:
Thu May 16, 2019 8:43 am
eradicator wrote:
Thu May 16, 2019 7:03 am
Schallfalke wrote:
Wed May 15, 2019 9:16 pm
And in the programming point of view, doing a simple JSON migration file to revert back entities is much simpler than some control script to replacing entities on-fly.
Except the engine doesn't support that.
Tell Wube about it:
https://lua-api.factorio.com/latest/Migrations.html wrote:JSON Prototype migrations allow changing one prototype to another prototype. Typically this is done when re-naming something.
I agree with you on the other thing you wrote q:
Maybe i read @Schallfalke wrong there. I do know migrations exist. But only as long as the mod containing them is loaded. So using a migration to "uninstall" would be:
  • Install Mod_you_don't_like
  • Install Uninstaller_for_mod_you_don't like
  • Uninstall Mod_you_don't_like
  • Uninstall Uninstaller_for_mod_you_don't like
And i'm not at all sure what the engine thinks about you when you try to "migrate" away a prototype that still exists. As migrations are meant to rename things *after* removing the prototype.

Edit: Tried uninstalling Alien Biomes as a test, and all tiles are migrated to "grass-1". So...er, what was the original problem again? :oops:

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 10:58 am
by Schallfalke
eradicator wrote:
Thu May 16, 2019 10:04 am
Maybe i read @Schallfalke wrong there. I do know migrations exist. But only as long as the mod containing them is loaded. So using a migration to "uninstall" would be:
  • Install Mod_you_don't_like
  • Install Uninstaller_for_mod_you_don't like
  • Uninstall Mod_you_don't_like
  • Uninstall Uninstaller_for_mod_you_don't like
And i'm not at all sure what the engine thinks about you when you try to "migrate" away a prototype that still exists. As migrations are meant to rename things *after* removing the prototype.
Assume the player is still using the "XYZ" mod in one's game, I would instruct the following steps:
  1. Download and enable "XYZ Uninstaller".
  2. Disable "XYZ".
  3. Load savegame, migrations will apply upon loading.
  4. Save game with a different name.
  5. Repeat from 3, if you have other savegames also using the mod.
  6. Disable "XYZ Uninstaller".
  7. Now the mod list should be without "XYZ" or "XYZ Uninstaller". Load savegame and see if everything is alright.
  8. Safe to remove "XYZ" or "XYZ Uninstaller".
When loading savegame at step 3, those prototypes are no longer there (because of step 2). So no such problem as what you mentioned.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 11:39 am
by eradicator
@Schallfalke:
Hm..yea, that would work. I forgot that you can disable the old mod before loading with the new one. Though nonetheless such a tool would preferably have to be maintained by the original mod author.

Which brings me back to my last question: What problem exactly was this supposed to solve again?

-------
dewiniaid wrote:
Sat Apr 20, 2019 1:11 am
Mods currently have no way to detect a player placing a blueprint. (I believe it shows as several events for each ghost in the blueprint, but don't quote me that.) Thus, triggering off that behavior would be rather complicated.
My working theory is that blueprint placement can be detected by a) the player holding a blueprint item, and b) it being unlikely that the player places more than one ghost per tick manually.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 11:56 am
by Schallfalke
eradicator wrote:
Thu May 16, 2019 11:39 am
Which brings me back to my last question: What problem exactly was this supposed to solve again?
Guess it comes from the following:
Qon wrote:
Tue Apr 16, 2019 10:23 pm
zOldBulldog wrote:
Tue Apr 16, 2019 9:02 am
- If you press <ctrl><z> right after placing landfill, it removes it and returns it to your inventory.

- Any landfill placed becomes normal terrain dirt. So, if you ever remove the mod... there is no effect on the map save, and everything already placed will function fine in Vanilla.
Platforms is a mod that adds a type of landfill that you can remove again, like concrete (but you can put concrete on top of it if you want).
I'm not sure what happens if you uninstall the mod but if we ask the author nicely then maybe he will add a migration script that automatically converts platforms to landfill when uninstalled if he already hasn't done that.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 12:00 pm
by eradicator
eradicator wrote:
Thu May 16, 2019 10:04 am
Edit: Tried uninstalling Alien Biomes as a test, and all tiles are migrated to "grass-1". So...er, what was the original problem again? :oops:
The assumption being that any modded tile will revert to "grass-1" when uninstalled.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 12:10 pm
by zOldBulldog
eradicator wrote:
Thu May 16, 2019 12:00 pm
eradicator wrote:
Thu May 16, 2019 10:04 am
Edit: Tried uninstalling Alien Biomes as a test, and all tiles are migrated to "grass-1". So...er, what was the original problem again? :oops:
The assumption being that any modded tile will revert to "grass-1" when uninstalled.
Or (in modding-ignorant noob language)... make it grass-1 from the moment it gets placed instead of using special newly invented blocks. :) If there is no difference between the mod-placed block and a vanilla-placed block, then there is nothing to change when you uninstall.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 12:32 pm
by Schallfalke
eradicator wrote:
Thu May 16, 2019 12:00 pm
eradicator wrote:
Thu May 16, 2019 10:04 am
Edit: Tried uninstalling Alien Biomes as a test, and all tiles are migrated to "grass-1". So...er, what was the original problem again? :oops:
The assumption being that any modded tile will revert to "grass-1" when uninstalled.
Guess "grass-1" is the default and filler tile, because there cannot be "no tiles" at all for any spot.
There is a "not-on-map" tile, but maybe it is only good for scenarios with limited map size. The devs decided not to apply it as default.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 1:04 pm
by Qon
zOldBulldog wrote:
Thu May 16, 2019 12:10 pm
Or (in modding-ignorant noob language)... make it grass-1 from the moment it gets placed instead of using special newly invented blocks. :) If there is no difference between the mod-placed block and a vanilla-placed block, then there is nothing to change when you uninstall.
The tile placed by Platforms must be a unique platform tile or store some sort of data for each landfilled/platformed tile somewhere else for it to be removable while still making sure you can't pick up any tile. And storing which tiles were platformed in the tile data type is the natural place to store that data and make platforms have a unique look with support from the game engine.

So if Platforms placed grass-1 then the platforms would be regular landfill OR it would just be an OP 'waterfill anywhere' type of mod, both of which are already existing types (the bad vanilla behaviour and a bit OP mod) that Platforms was specifically designed to be different from. When landfill tiles are no longer grass-1 (which are also commonly spawned by map generator) but instead a unique landfill tile then the mod could just make that type of tile removable without introducing a new type of tile.

So the problem is that the map generator spawns the same tile, grass-1, as landfilling does so you "can't" know which tiles were landfilled and which tiles are natural. What you are suggesting in the quote is exactly what landfill already does, and that is why it is 'painful'.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 2:20 pm
by eradicator
Schallfalke wrote:
Thu May 16, 2019 12:32 pm
Guess "grass-1" is the default and filler tile, because there cannot be "no tiles" at all for any spot.
There is a "not-on-map" tile, but maybe it is only good for scenarios with limited map size. The devs decided not to apply it as default.
If every removed tile became not-on-map, then removing alien biomes would leave the map 90% unusable and unplayable as not-on-map can not be landfilled, walked upon or whatever.
Qon wrote:
Thu May 16, 2019 1:04 pm
So the problem is that the map generator spawns the same tile, grass-1, as landfilling does so you "can't" know which tiles were landfilled and which tiles are natural. What you are suggesting in the quote is exactly what landfill already does, and that is why it is 'painful'.
Nope. Landfill uses the same graphic as "grass-1", but internally it uses a seperate "landfill" tile (see data\base\prototypes\tile\tiles.lua). Try standing on landfill and /sudo count_tiles() :p.

Re: [0.17] Painless landfill

Posted: Thu May 16, 2019 4:47 pm
by Qon
eradicator wrote:
Thu May 16, 2019 2:20 pm
Qon wrote:
Thu May 16, 2019 1:04 pm
So the problem is that the map generator spawns the same tile, grass-1, as landfilling does so you "can't" know which tiles were landfilled and which tiles are natural. What you are suggesting in the quote is exactly what landfill already does, and that is why it is 'painful'.
Nope. Landfill uses the same graphic as "grass-1", but internally it uses a seperate "landfill" tile (see data\base\prototypes\tile\tiles.lua). Try standing on landfill and /sudo count_tiles() :p.
I remembered them saying that landfill was the same tile as grass from some FFF a while ago and that they were thinking of changing it to a separate tile. But I could be mistaken and what they said was what you just said and I warped it from looking similar to being the same thing. Or maybe it changed from how it was when it was introduced. I didn't play 0.16 so I have missed a lot of changelogs. Or maybe it was never so in vanilla but it was so when Landfill was a mod.

Checking factorio wiki:
https://wiki.factorio.com/Landfill#History wrote: 0.17.10:
Landfill is now a separate tile, differentiated from grass-1.
Hey I was right, it was like I said! I mean, of course I'm right, I'm always right. Erhhmm...

Thanks for telling me that it's different now though.

Well, platforms was first released in 0.16 so that's the reason it introduces a unique 'landfill' tile, there was none back then it could use. And platforms have a different recipe so you can still use landfill with the mod installed. But I guess a new Platforms update or version could be made that makes landfill work like platforms but still use the landfill tile (maybe reskinned to look like platforms) so you can install it whenever and pull up landfilled areas that you filled before you installed the mod. And you would just lose the ability (temporarily while the mod is disabled) to remove landfill if it was uninstalled and get it back when you re-installed. And you wouldn't lose any landfill/platforms in chests and can use the regular stone recipe.