No Deconstruction Timeout
No Deconstruction Timeout
Would like a mod or a push in the right direction to make one. All it would do is remove the timeout period for deconstruction marks.
All I can find is this from the API docs under Class LuaForce
deconstruction_time_to_live :: uint [Read/Write]
The time, in ticks, before a deconstruction order is removed.
Unfortunately, my only experience in modding is changing things in the lua files. I have no idea what to do with or how to manipulate something under "LuaForce Class"
Any assistance appreciated!
Don't know if it is relevant, but it should (hopefully) also work in multiplayer.
All I can find is this from the API docs under Class LuaForce
deconstruction_time_to_live :: uint [Read/Write]
The time, in ticks, before a deconstruction order is removed.
Unfortunately, my only experience in modding is changing things in the lua files. I have no idea what to do with or how to manipulate something under "LuaForce Class"
Any assistance appreciated!
Don't know if it is relevant, but it should (hopefully) also work in multiplayer.
Re: No Deconstruction Timeout
Console:
this should last more than 2 years of playtime
Alternatively, you can call it from control.lua:
Did not test though...and not sure, if on_init is the best place.
Code: Select all
/c game.player.force.deconstruction_time_to_live = 4294967295
Alternatively, you can call it from control.lua:
Code: Select all
script.on_init(function()
for _, player in pairs(game.connected_players) do
player.force.deconstruction_time_to_live = 4294967295
end
end)
Re: No Deconstruction Timeout
Thank you but I tried that and I tried putting this in migrations, but neither worked.
The only way I tested was going to map editor and cranking up the speed and wait for about 44 days. The decon flags disappeared along with the ghosts underneath them.
I think it has to be applied to forces? Not sure.
Code: Select all
for _, player in pairs(game.connected_players) do
player.force.deconstruction_time_to_live = 4294967295
end
end
I think it has to be applied to forces? Not sure.
Re: No Deconstruction Timeout
Did you check it on new ones, or on ones you had already ordered deconstructed? It'd almost certainly only take effect on new orders - time to live is generally set when the order is created.
It's being applied to player.force - that's the force the player using the console is on, usually 'player'
It's being applied to player.force - that's the force the player using the console is on, usually 'player'
Re: No Deconstruction Timeout
Maybe the mod was already up-to-date and the migration didn't run anymore?adam_bise wrote: Tue Feb 15, 2022 1:23 am Thank you but I tried that and I tried putting this in migrations, but neither worked.
https://lua-api.factorio.com/latest/Dat ... ve-startup
Re: No Deconstruction Timeout
Thanks. In both cases I loaded the mod, created a new scenario in map editor, placed blueprint over trees, turn time to x64 and wait about 44 day cycles and the trees were unmarked and ghosts under them poofed.
I also tried saving the scenario and reloading. It looked like migrations was maybe tied to saving.
I will try it again in a bit.
Also, the mod doesn't have data.lua, is that OK? I didnt know what to put in there. Just info.json and migrations/migrations.lua
Also, just pointing out this is multiplayer. Not the map editor, but I would use it on a headless server.
I also tried saving the scenario and reloading. It looked like migrations was maybe tied to saving.
I will try it again in a bit.
Also, the mod doesn't have data.lua, is that OK? I didnt know what to put in there. Just info.json and migrations/migrations.lua
Also, just pointing out this is multiplayer. Not the map editor, but I would use it on a headless server.
Re: No Deconstruction Timeout
If you're in the map editor, you can go to the Forces tab, and click 'Edit Other Properties' and see what the value for 'deconstruction_time_to_live' is - that'll let you know if the migration took effect.
Note in multiplayer with a headless server that migration is probably going to do nothing - when the game loads there are no connected players, so it doesn't find anything to load. Iterating over forces directly is probably better - setting them all to max is fine since biters aren't deconstructing things, and that way you also get any forces made by mods.
Also from testing, it seems there's a bug in the game. deconstruction_time_to_live near the max value of a uint seems to go away almost immediately. Lowering it a little doesn't seem to stop it. So, gonna report that. Until then you might want to change your value to 4294957295 instead.
Note in multiplayer with a headless server that migration is probably going to do nothing - when the game loads there are no connected players, so it doesn't find anything to load. Iterating over forces directly is probably better - setting them all to max is fine since biters aren't deconstructing things, and that way you also get any forces made by mods.
Also from testing, it seems there's a bug in the game. deconstruction_time_to_live near the max value of a uint seems to go away almost immediately. Lowering it a little doesn't seem to stop it. So, gonna report that. Until then you might want to change your value to 4294957295 instead.
Re: No Deconstruction Timeout
Maybe something is adding a tiny bit to the number and then the uint overflows back to 0 again.Silari wrote: Tue Feb 15, 2022 6:20 pm Also from testing, it seems there's a bug in the game. deconstruction_time_to_live near the max value of a uint seems to go away almost immediately. Lowering it a little doesn't seem to stop it. So, gonna report that. Until then you might want to change your value to 4294957295 instead.
I think, thats fine.adam_bise wrote: Tue Feb 15, 2022 2:55 pm Also, the mod doesn't have data.lua, is that OK? I didnt know what to put in there. Just info.json and migrations/migrations.lua
However:
Maybe the change to game state doesn't stick without a control.lua? I'm not sure.Migrations are run in their mod's Lua state and have full access to the game state. If a mod doesn't have a control.lua file and thus no runtime Lua state, the game creates a temporary Lua environment to run the migrations in, which is discarded afterwards.
Re: No Deconstruction Timeout
Thank you very much for all the help.
This is what I tried, in migrations
Would that count as iterating through forces?
But when I check in map editor, forces > edit properties, deconstruction-time-to-live shows 1080000
This is what I tried, in migrations
Code: Select all
for _, force in pairs(game.forces) do
force.deconstruction_time_to_live = 4000000000
end
end
But when I check in map editor, forces > edit properties, deconstruction-time-to-live shows 1080000
Re: No Deconstruction Timeout
Code: Select all
for _, force in pairs(game.forces) do
force.deconstruction_time_to_live = 4000000000
end
Double check your log file to make sure the mod is being loaded and that the migration is being called. There should be a line in there that it's running a migration right after loading the scenario, map, and running checksums on scripts.
Code: Select all
34.450 Applying migration: Asteroid Mining: test.lua
If there's no line saying it's applying a migration, something is wrong, most likely the mod isn't being loaded at all or the file isn't in the right spot/not named correctly (should be in a subfolder called migrations and the file must end with .lua).
If you're still having issues with it, upload the mod zip here and I'll take a look at it.
Re: No Deconstruction Timeout
Log doesn't say loading mod, but does load the others, then goes on to say "1.793 Checksum of no-decon-timeout: 0"
I must be missing something stupid simple.
Here is the mod.
I must be missing something stupid simple.
Here is the mod.
Re: No Deconstruction Timeout
Oh right migrations AREN'T run on new games - you need to have it in the on_init event in control.lua for that.
Put that in control.lua and that should let it work fine. At least one of the two should run any time the mod is in a game so the timeout should be set properly.
Code: Select all
script.on_init(function()
for _, force in pairs(game.forces) do
force.deconstruction_time_to_live = 4000000000
end
end)
Re: No Deconstruction Timeout
Mind if I ask: why? The default is 2 hours but if you've marked something for deconstruction and over 2 hours later you still haven't gotten around to letting a robot work on it why is it important? Obviously it wasn't important since 2 hours has passed and it still wasn't handled.
If you want to get ahold of me I'm almost always on Discord.
Re: No Deconstruction Timeout
It's confusing when the tree/rock deconstruction times out, but the ghost placed on top of it does not. Then you have to re-apply a filtered deconstruction planner or the original blueprint. Worst case, you don't notice until all your bots are hovering waiting to place things, and none are available to deconstruct until you cancel your original blueprint.
Time delays like this can happen for example in Space Exploration planning a planetary outpost before you have the resources for enough rockets to get there and build it.
Time delays like this can happen for example in Space Exploration planning a planetary outpost before you have the resources for enough rockets to get there and build it.
My mods: Multiple Unit Train Control, Smart Artillery Wagons
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Re: No Deconstruction Timeout
That's not how it works. The ghost is removed when the deconstruction order times out.robot256 wrote: Wed Feb 23, 2022 9:46 pm It's confusing when the tree/rock deconstruction times out, but the ghost placed on top of it does not. Then you have to re-apply a filtered deconstruction planner or the original blueprint. Worst case, you don't notice until all your bots are hovering waiting to place things, and none are available to deconstruct until you cancel your original blueprint.
Time delays like this can happen for example in Space Exploration planning a planetary outpost before you have the resources for enough rockets to get there and build it.
If you want to get ahold of me I'm almost always on Discord.
Re: No Deconstruction Timeout
You can see the thread OP made asking if timing out was a bug - it says what happened to them that they wanted the timeout longer: viewtopic.php?f=18&t=101590Rseding91 wrote: Wed Feb 23, 2022 9:38 pm Mind if I ask: why? The default is 2 hours but if you've marked something for deconstruction and over 2 hours later you still haven't gotten around to letting a robot work on it why is it important? Obviously it wasn't important since 2 hours has passed and it still wasn't handled.
Re: No Deconstruction Timeout
Sorry, I misread that other post. So you're left with a partial blueprint with trees and holes in it. Still seems like a confusing and seemingly arbitrary difference in behavior from normal ghosts.
My mods: Multiple Unit Train Control, Smart Artillery Wagons
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Re: No Deconstruction Timeout
Deconstruction is fundamentally different from construction though. Construction relies on having a specific material available to the network (cliff deconstruction included). Deconstruction doesn't - all you need is a free bot in range and the job can be done, nothing else needed. It doesn't even need space for storage as it doesn't seem to check that until after it grabs the item(s).
That said I'm not sure what advantage there is to having them expire. Possibly there's some overhead involved with having a bunch of orders around even if they can't be done/aren't in range of anything.
That said I'm not sure what advantage there is to having them expire. Possibly there's some overhead involved with having a bunch of orders around even if they can't be done/aren't in range of anything.
Re: No Deconstruction Timeout
I mark something for deconstruction, because I want it to be deconstructed. I think, it adds to confusion, if the game decides, that the order was not important after 2 hours and removes it (probably without notice). If you work on a big project like solar, 2 hours might be short. Importance is not necessarily the same as urgency.
I get, if there are technical limitations or performance issues or simply a game design decision, other that I see no big benefit for the expiration.
I get, if there are technical limitations or performance issues or simply a game design decision, other that I see no big benefit for the expiration.