Can you make an entity with only 2 orientations?
Can you make an entity with only 2 orientations?
Most entities either can't be rotated or have all 4 directions. Is there a way to make a custom entity with only 2 orientations, left and right? I know the steam engine has 2 orientations but those are vertical and horizontal meaning the collision box rotates with it too.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Can you make an entity with only 2 orientations?
The only entity that I'm aware of that is possible to restrict to just 2 orientations (north and east apparently) is the storage tank entity, which has a specific property to enable that. As you say, most things either can't rotate at all or have 4 directions; there are a handful which can have 8 (rail tracks, rail signals, turrets).
Depending on what kind of entity it is that you want and what it does, you may be able to make a 4-way entity where the north-south and east-west orientations are functionally and visually identical, so it presents to the player as only having two.
Depending on what kind of entity it is that you want and what it does, you may be able to make a 4-way entity where the north-south and east-west orientations are functionally and visually identical, so it presents to the player as only having two.
Re: Can you make an entity with only 2 orientations?
Splitter also has 2 orientations.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Can you make an entity with only 2 orientations?
No, they have 4, which you can check with the entity tooltip debug info or just by rotating a splitter ghost in your hand. It's just that the rotation action from the hotkey after placement is locked to 180 degrees, which I think is the behaviour for anything that has a rectangular collision/selection box. That is different to a storage tank locked to two directions, which can never be put into a south or west orientation under any circumstance.
https://wiki.factorio.com/Prototype/Splitter
Re: Can you make an entity with only 2 orientations?
That actually sounds pretty good, I can always swap out for the real entity I want with a script. Thanks a lotDeadlock989 wrote: Tue Jan 05, 2021 1:16 pm The only entity that I'm aware of that is possible to restrict to just 2 orientations (north and east apparently) is the storage tank entity, which has a specific property to enable that.

Re: Can you make an entity with only 2 orientations?
Okay so it turns out the two directions are vertical and horizontal so it'll get rotated if it's a rectangle. Maybe I'll just try to keep it a square shape
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Can you make an entity with only 2 orientations?
I'm pretty sure it's assumed that for those entities that allow a rectangular shape, they have to have a horizontal and vertical version unless they are never built by a player. If for some reason you had an entity that was wider than it was tall but couldn't rotate, it would break blueprint rotation. I have a purely decorative 3x12 non-colliding entity where this is the case, but it doesn't matter because players can't unlock it without console commands - the collision box rotates correctly when the blueprint is rotated, but visually it's garbage. If it did collide and didn't rotate, the blueprint probably wouldn't be buildable in half of the rotations.
What is it that you're trying to make?
What is it that you're trying to make?
Re: Can you make an entity with only 2 orientations?
I'm trying to make a bridge in two parts: the ramp going up to bridge level, and the bridge section itself. I only want the bridge to be placeable going horizonally and naturally you would need a ramp going back down on the other side. I could make two separate non-rotatable ramp entities one sloping up and one sloping down, but for the slicker user experience it'd be nice to have just one ramp entity that can be rotated/flipped between the two directions while maintaining the same rectangular hitbox
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Can you make an entity with only 2 orientations?
OK ... I guess I don't understand why you don't also want a vertical bridge. Regardless, if we were still in 1.0, I would have suggested a SimpleEntityWithOwner that has two graphics variations and the random variation on placement turned off - SEWO variations are nicely preserved in ghosts/blueprints without any extra hassle, and you could intercept the rotate key to flip between the two variations if your entity was under the cursor. Unfortunately they were changed in 1.1 from having just one orientation to four, so they now rotate as well.Kiplacon wrote: Thu Jan 07, 2021 2:30 pm I'm trying to make a bridge in two parts: the ramp going up to bridge level, and the bridge section itself. I only want the bridge to be placeable going horizonally and naturally you would need a ramp going back down on the other side. I could make two separate non-rotatable ramp entities one sloping up and one sloping down, but for the slicker user experience it'd be nice to have just one ramp entity that can be rotated/flipped between the two directions while maintaining the same rectangular hitbox
If I were doing this I'd just have a half-bridge entity with all four directions.
Re: Can you make an entity with only 2 orientations?
A solution for 1.1 for the proposed solution by Deadlock would be the "not-rotatable" entity prototype flag, to have only one direction on the entity.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Can you make an entity with only 2 orientations?
Nice. I always forget about those flags.Bilka wrote: Thu Jan 07, 2021 2:58 pm A solution for 1.1 for the proposed solution by Deadlock would be the "not-rotatable" entity prototype flag, to have only one direction on the entity.
Just tested that out - it still results in odd or even erratic/broken blueprints when the blueprint is rotated (if the non-rotated rectangular entity ends up overlapping with any other ghost, at least one ghost will be wiped out when the bots revive any of the overlapping ghosts). I'd still go for a four-directional entity if that was at all possible.