I am making a mod to make chain actions to assist in non-linear deconstruction and upgrade (e.g. your belt isn't perfectly vertical or horizontal). I have two issues with this.
1) order_deconstruction and order_upgrade do not create undo orders, so my deconstruction and upgrade actions cannot be undone unlike the vanilla ones.
2) neighbours works fine for pipe, but not belt and splitter, so that lead me to belt_neighbours, but that doesn't seem to do anything I can see...is there an easier way than just checking the direction of all neighboring belt entities to see if they connect?
Chained belts and pipes
Re: Chained belts and pipes
1. Correct, that is not supported.
2. How to use belt_neighbours:
2. How to use belt_neighbours:
Code: Select all
/c
local result = game.player.selected.belt_neighbours
for _, belt in pairs(result.inputs) do
rendering.draw_circle{surface=belt.surface, target=belt, color={r=1,g=1,b=0,a=1}, radius=0.4, width=5, time_to_live=300}
end
for _, belt in pairs(result.outputs) do
rendering.draw_circle{surface=belt.surface, target=belt, color={r=1,g=0,b=0,a=1}, radius=0.4, width=5, time_to_live=300}
end
Re: Chained belts and pipes
1. Guess its time for a request then.
2. Apparently I was referencing the inputs and outputs incorrectly...awesome, so much cleaner than the crazy facing code I wrote.
Thanks for the help!
2. Apparently I was referencing the inputs and outputs incorrectly...awesome, so much cleaner than the crazy facing code I wrote.
Thanks for the help!
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Chained belts and pipes
I believe there already is one.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: Chained belts and pipes
I was trying to get my mod to work on ghosted entities and I think I found a bug. When I added code to check the ghost_type to confirm a belt on an entity-ghost, it marks everything for deconstruction if you start on a belt, even the ghosts get marked for deconstruction, which then causes a crash if a robot tries to deconstruct the ghost.
I put back my code to find neighbour belts by position and facing and that worked fine on ghosts (the whole chain gets deconstructed when entity.order_deconstruction is called), but the second the chain hits a real belt, it switches back to ghosts marked for deconstruction for the rest of the chain.
Am I doing something wrong?
I put back my code to find neighbour belts by position and facing and that worked fine on ghosts (the whole chain gets deconstructed when entity.order_deconstruction is called), but the second the chain hits a real belt, it switches back to ghosts marked for deconstruction for the rest of the chain.
Am I doing something wrong?
- Attachments
-
- chain-action_0.4.0.zip
- (8.51 KiB) Downloaded 96 times
Re: Chained belts and pipes
Good catch. I filed a bug report for you.
To work around it, you will have to check for ghosts and destroy them instead of deconstructing them.
To work around it, you will have to check for ghosts and destroy them instead of deconstructing them.