Space Engineers

Space Engineers

Ship Layout
64 Comments
DadBear (IGH) 9 Jun, 2024 @ 2:08pm 
Just tried this mod and it works as advertised
Cyfen 13 Apr, 2024 @ 8:11pm 
I put ShipLayoutHull and got it to display in rotation
Thundercraft 20 Feb, 2024 @ 1:54am 
Any chance of this script getting an update?
Five years is a long time...
luisitofernandezfaba 3 Feb, 2024 @ 10:00am 
no funciona
Amaia 24 Dec, 2022 @ 8:34am 
Can we get an update on this. Currently I keep getting an error saying the script has to much junk in it or complex, cant remember which, either way sometimes the program block gets terminated. Maybe my ship is too large, I dont know, either way maybe we can get some fixes? Great script still!
TemporalWr4ith 13 Oct, 2022 @ 4:24pm 
Do you think you can upload this Script on mod.io there's non exist for XBOX :\
Arthur 10 Jun, 2022 @ 7:56am 
Your Rotation table is broken, some axis are Mirrored, others work fine, and terminal blocks that don't have any function, like toilet, Bed, and desks show as damaged blocks, even if is on 100% health
Hottage 17 Mar, 2022 @ 12:12pm 
A small suggestion, please change:
GridTerminalSystem.GetBlocksOfType<IMyTextSurfaceProvider>(lcds, block => block.CustomData.Contains("ShipLayout") && !block.CustomData.Contains("ShipLayoutHealth") && block.CubeGrid == grid);
GridTerminalSystem.GetBlocksOfType<IMyTextSurface>(healthbars, block => block.CustomData.Contains("ShipLayoutHealth"));

To:

GridTerminalSystem.GetBlocksOfType<IMyTextSurfaceProvider>(lcds, block => block.CustomData.Contains("ShipLayout") && !block.CustomData.Contains("ShipLayoutHealth") && block.CubeGrid == grid);
GridTerminalSystem.GetBlocksOfType<IMyTextSurface>(healthbars, block => block.CustomData.Contains("ShipLayoutHealth") && block.CubeGrid == grid);

This will prevent scripts on docked ships from overwriting the health data for the main ship (causes weird display flickering when grids try to update each other's LCDs).

Thanks!
Gray 30 Aug, 2021 @ 5:40pm 
@Zanders3 or whoever can solve this please:

I have my ship view set to ShipLayout 1 which is a view from above, only, this view appears to be reversed, so it's like looking from below because the longer weapon on the left nose side of my ship shows as on the right nose side of the image?

I went through all the image options up to ShipLayout 23 and found that ShipLayout 13 is the view that appears to be the same view but from below, as the blocks are much darker...and is correctly showing the gun in the correct spot

So basically i need the top down view flipped over, any ideas? PS i looked through the script and....as if i could work it out !! XD
Radler15 30 May, 2021 @ 1:10pm 
Hej there is it possible to run 2 PB's on each Main grid and sub grid and then display both images on the main grid Lcd's? So like is there any way to number the blocks and lcd's? I know Multi-Grid is not supported , so that one PB can't output both sub and main grid, but idk if that accounts to that exact scenario.
Arvard 16 Nov, 2020 @ 1:18am 
And how can i use this script with cockpit LCDs?
Arvard 16 Nov, 2020 @ 1:08am 
What about using tags in cabin/screen names? For example, if custom data is already used by another script?
ATF_Coldblooded Carebear || 1 Oct, 2020 @ 3:25pm 
All block are full since my nanobuilder mod remain dormant or else it would send is flying nanobot to repair it

But as I sayed before the system is at 95% while the hull is at 100%
So the question was if it was possible that the missing system integrity is a remnant of the premodified ship components even after reloading the new ship BP?
zanders3  [author] 1 Oct, 2020 @ 2:31pm 
If re-running the script didn't give 100% system health probably one of your system blocks is damaged and not at 100% health. Go weld all the terminal blocks :)
ATF_Coldblooded Carebear || 1 Oct, 2020 @ 7:09am 
Second question I alter the original BP by swapping out battery for modded version and the script tell my system is 95% so made a new BP with the modded ship and installed it, recompile the scrip with the new BP installed and still show as a 95% ... what your thought on this??
ATF_Coldblooded Carebear || 21 Sep, 2020 @ 7:23pm 
here a question for you if you wish to install this in a spacestasion of a very large size what do you need to edit?

mine is L= 109, W = 159 H = 143

Will it be posible?
Shadowpheonix 19 Aug, 2020 @ 7:20am 
Is it possible to get the image to display on screens that are part of other blocks (like cockpits and programmable blocks)?
zanders3  [author] 30 Jul, 2020 @ 12:16pm 
Yes you can specify e.g. 'ShipLayout 0' or 'ShipLayout 1' etc in the custom data of an LCD to keep the view at a specific angle.
Apollo235 29 Jul, 2020 @ 4:26pm 
is there a way to get the view to be at a specific angle?
zanders3  [author] 25 Jun, 2020 @ 3:20pm 
The LCD must be in the same grid (not a small grid) both must be owned by the same person and you must put 'ShipLayout 0' (without quotes) in the CustomData field of the LCD you want the ship layout to display on.

Also make sure that scripting is enabled in your world settings, and that the ship layout actually appears on the programmable block. That's a good quick to check the script is working. Good luck + hope that helps :)
Jet 25 Jun, 2020 @ 2:25pm 
I cant seem to get this script to work i've tried naming the LCD putting the name of the layout in the custom data and recompileing the script but it wont work
zanders3  [author] 13 Jun, 2020 @ 12:52pm 
Manually running the script on the PB forces a refresh :)
Lohkrim 11 Jun, 2020 @ 2:50pm 
@3zanders I've noticed the LCD updates quickly when something gets damaged, but seems to not want to update once it's been fixed. Is there a setting somewhere I'm missing?
ViperInfinity 10 Mar, 2020 @ 5:02pm 
Does not support WIDE LCD panels, all other panels work fine
Piksel 11 Jan, 2020 @ 5:13pm 
Is there any way to make the image bigger, to fill whole lcd?
Does not the image displayed on the Display
Osker 28 Dec, 2019 @ 11:19pm 
Cool script!
Astronomical 11 Nov, 2019 @ 11:19am 
I'm getting the same problem as Xscreade. The ship layout image is orientated along the bottom of the LCD instead of centered so only half of the ship is displayed in any view.
woostyboy 8 Nov, 2019 @ 3:26am 
Hi. Does the display LCD have to be on the same grid as the PB? Thanks.
Xscreade 25 Oct, 2019 @ 11:52am 
why does the ship is half not displayed? Like its not centered
Comrade Corwin 27 Sep, 2019 @ 10:58pm 
For some reason, the script won't execute the display to the LCD. It said this after I recompiled:
"Caught exception during execution of script: Object reference not set to an instance of an object."
I put "ShipLayout 0" into the custom data of the LCD.

I'm using some mods like the Micro Programmable Block mod, if that helps. Though I wouldn't think that would be a problem.
woostyboy 19 Aug, 2019 @ 7:56am 
Had an idea to show the turret AND hull of tank. Have two half height LCDs one above the other and have the script running on two PBs, one in the hull, one in the turret. I'm assuming the LCD does not have to be on the same grid as the PB to show, does it?
Seyha 9 Aug, 2019 @ 12:25am 
@-=312th=- BuzzedBear, just change background color at LCD or PB as usual you do.

Also ShipLayout XX (is about 1-20++), so just change number to see what you will like
🍁BuzzedBear🍁 8 Aug, 2019 @ 11:06pm 
Is there a way that I can change the bg color of the display. I am not a fan of the baby blue.
I also noticed that putting "ShipLayout X" where X = 1 - 0, the view of the ship changes. Anything else we should know that might be of help? Awesome script!
Seyha 25 Jul, 2019 @ 10:20am 
Greetings. Thanks for your hard work and this awesome script.
Are you will work on it more? I hope so.

And if you can do, some upgrades.
1. Can you make that script save what block was destroyed/removed somewhere like in PB Custom Data. Just for to remember after load save, reload etc.
2. Can you separate armor blocks and terminal in ShipLayoutHealth, because Hull counts terminal blocks also.
3. And of course subgrids - look at "3D ship projection". He use whitelist with main tag for tblocks to know what grids to use. You can also do something like that.

Sorry for my english and best regards!
RobRendell 28 May, 2019 @ 5:38pm 
Apologies for spamming your comment thread :) Just a note to say that instead of using Vector3I.Abs(XUp(size, Vector3I.Zero)) for the size param in the [XYZ](Up|Down)[123] functions as I noted below, I realised I could get the same effect by using e.g. XUp(size, size * 2), as you do in the Draw() function.
RobRendell 27 May, 2019 @ 9:57pm 
Here's a blueprint of an asymmetrical "ship" with LCDs pointing in each direction, so you can see how the script is rendering the layout from each side (note that this blueprint doesn't have the changes I suggested below, it's running the version of Ship Layout that's currently published to the Workshop).

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1754043717
RobRendell 27 May, 2019 @ 9:36pm 
In order to get the swizzle functions to orient things correctly for me, I had to make the Up and Down functions use left-handed coordinates, which was peculiar.

static Vector3I XUp(Vector3I pos, Vector3I size) { return new Vector3I(pos.Z, pos.Y, pos.X); }
static Vector3I YUp(Vector3I pos, Vector3I size) { return new Vector3I(size.Z - pos.Z, pos.X, pos.Y); }
static Vector3I ZUp(Vector3I pos, Vector3I size) { return new Vector3I(size.X - pos.X, pos.Y, pos.Z); }

static Vector3I XDown(Vector3I pos, Vector3I size) { return new Vector3I(pos.Z, size.Y - pos.Y, size.X - pos.X); }
static Vector3I YDown(Vector3I pos, Vector3I size) { return new Vector3I(size.Z - pos.Z, size.X - pos.X, size.Y - pos.Y); }
static Vector3I ZDown(Vector3I pos, Vector3I size) { return new Vector3I(size.X - pos.X, size.Y - pos.Y, size.Z - pos.Z); }

I also needed to change the 1/2/3 versions to use e.g. Vector3I.Abs(XUp(size, Vector3I.Zero)) as the size param
RobRendell 24 May, 2019 @ 4:53am 
Showing those four states for terminal blocks with those four colours sounds good to me :)

Another suggestion (an easy one this time!)... it would be cool if you allowed LCDs to have more than one user-selected view, i.e. an LCD with custom data "ShipLayout 13 17 21" would cycle between those three views.
zanders3  [author] 24 May, 2019 @ 12:37am 
Also for displaying damage on terminal blocks - I could change the terminal colours to mean green means '100% grid integrity', yellow means 'damaged but working', orange means 'no longer functional', red means 'destroyed'
zanders3  [author] 24 May, 2019 @ 12:32am 
The only difference a top vs bottom view currently makes is the depth calculation. i.e. blocks at the front of the view are coloured white, blocks at the back are dark grey.
So if you had a box on top of your ship, you won't see it on the bottom view, but the overall view looks the same.

It makes sense that the bottom views should be flipped horizontally. Something easy to fix!

I've been looking at multiblock support as well - it's a complete nightmare. ;) I've got the multiple grids drawing but getting them to:
a. offset/rotate from each other
b. calculate the overall size
is proving tricky!
RobRendell 23 May, 2019 @ 5:27pm 
Also, if you're not sick of me yet, I noted that you use IMyTerminalBlock.IsWorking to determine whether the component should be shown as green or yellow, but IsWorking also factors in things like if the block is turned on or off - if you turn off your atmo thrusters in space, they come up as damaged on the diagram.

You could use IMyTerminalBlock.IsFunctional to see if the block has been damaged below the Functional line, or if you use grid.GetCubeBlock(position) to get an IMySlimBlock, you can call IMySlimBlock.IsFullIntegrity to test if the terminal block has any damage at all.

You could even use both (plus your existing CubeExists call) to have four colours: undamaged, damaged but functional, damaged and non-functional, destroyed.
RobRendell 23 May, 2019 @ 5:26pm 
I was going to note the same thing as Teh H4mst0R - the swizzle functions don't seem to be quite right.

For example, with the Rock Lobster blueprint I shared with you before 3zanders, Layout 5 should be a plan view looking from below, and Layout 17 should be a plan view looking from above. However, both layouts have the functional blocks in the same position - if you damage the starboard large atmo thruster, you'll see that it appears on the left side of the diagram in both 5 and 17, where it should be flipped around if you're looking from the top compared to the bottom.
BÖrbZ1LL4 22 May, 2019 @ 10:48pm 
Hi 3zanders,

to me for example "ShipLayout 3" and "ShipLayout 15" show the same thing.

I can only manage to get a view from the right side of my ship (not from the left side). Also I can't find a view from top. (I have an asymetrical ship and what should be displayed at the right side stays on the left. As if you'd look from the bottom.)

Sorry for my english. I hope you can understand what my problem is.

And thanks for the awesome script. Keep up the good work!
woostyboy 22 May, 2019 @ 2:27am 
Hi 3zanders.
Couple of questions please: -

"Note: Multigrid ships are not supported! It can only draw the layout for the grid the PB is on."

I would like to show the status of my tank using this script, it does however have 2 grids, base and turret.

https://steamuserimages-a.akamaihd.net/ugc/916953854633788943/0208D17B4988BF6725371DCFA6327415ED61453B/

1. If I place a PB on each of the sub grids running your script, could there be a way of merging the two outputs onto one LCD screen?

2. Will the output of a PB on grid 1 be able to display on an LCD on grid 2?

Thanks in advance,
Woostyboy :)
RobRendell 22 May, 2019 @ 12:31am 
Here's one change that works for me (but may not be universally applicable) - instead of always using the Me.CubeGrid grid, use the largest grid that's part of the same ship. To avoid the expense of running it every 100 ms, I set a "largestGrid" field which I only update when want_reset is true.

private IMyCubeGrid GetLargestCubeGrid(IEnumerable<IMyTerminalBlock> fullBlocks) {
var result = Me.CubeGrid;
foreach (var terminalBlock in fullBlocks) {
if (terminalBlock.CubeGrid.IsSameConstructAs(Me.CubeGrid) && terminalBlock.CubeGrid.GridSize > result.GridSize) {
result = terminalBlock.CubeGrid;
}
}
return result;
}
RobRendell 21 May, 2019 @ 10:30pm 
Ok - thanks! I'll also tinker with it myself. If I come up with anything worth sharing I'll let you know.
zanders3  [author] 21 May, 2019 @ 2:13pm 
Thanks for the report - I've fixed the script so it doesn't try to draw blocks that are not on the same grid. I don't support multigrid ships - not completely sure how to fix it yet but I'm thinking about it ;)

If you use the large grid PB the script works fine in the example ship. Sorry it takes up space D:
RobRendell 20 May, 2019 @ 12:35am 
I've published a blueprint which demonstrates the problem: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1746912631

You'll need at least this mod installed: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=516770964

(I use that block to put the small grid PBs in the large grid ship without wasting excessive space.)
zanders3  [author] 18 May, 2019 @ 1:00am 
Huh TIL I haven't actually tested a ship with subgrids or anything like that :) I can certainly have a look if someone has an example ship thats broken? Also multiplayer hasn't been tested.
@Devid could you paste in the error in the PB you're seeing? If you don't own the entire ship strange things can happen.