Space Engineers

Space Engineers

Ship Layout
64 comentarii
DadBear (IGH) 9 iun. 2024 la 14:08 
Just tried this mod and it works as advertised
Cyfen 13 apr. 2024 la 20:11 
I put ShipLayoutHull and got it to display in rotation
Thundercraft 20 febr. 2024 la 1:54 
Any chance of this script getting an update?
Five years is a long time...
luisitofernandezfaba 3 febr. 2024 la 10:00 
no funciona
Amaia 24 dec. 2022 la 8:34 
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 la 16:24 
Do you think you can upload this Script on mod.io there's non exist for XBOX :\
Arthur 10 iun. 2022 la 7:56 
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 mart. 2022 la 12:12 
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 la 17:40 
@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 mai 2021 la 13:10 
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 la 1:18 
And how can i use this script with cockpit LCDs?
Arvard 16 nov. 2020 la 1:08 
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 la 15:25 
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  [autor] 1 oct. 2020 la 14:31 
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 la 7:09 
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 sept. 2020 la 19:23 
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 la 7:20 
Is it possible to get the image to display on screens that are part of other blocks (like cockpits and programmable blocks)?
zanders3  [autor] 30 iul. 2020 la 12:16 
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 iul. 2020 la 16:26 
is there a way to get the view to be at a specific angle?
zanders3  [autor] 25 iun. 2020 la 15:20 
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 iun. 2020 la 14:25 
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  [autor] 13 iun. 2020 la 12:52 
Manually running the script on the PB forces a refresh :)
Lohkrim 11 iun. 2020 la 14:50 
@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 mart. 2020 la 17:02 
Does not support WIDE LCD panels, all other panels work fine
Piksel 11 ian. 2020 la 17:13 
Is there any way to make the image bigger, to fill whole lcd?
Феньковский 29 dec. 2019 la 5:35 
Does not the image displayed on the Display
Osker 28 dec. 2019 la 23:19 
Cool script!
Astronomical 11 nov. 2019 la 11:19 
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 la 3:26 
Hi. Does the display LCD have to be on the same grid as the PB? Thanks.
Xscreade 25 oct. 2019 la 11:52 
why does the ship is half not displayed? Like its not centered
Comrade Corwin 27 sept. 2019 la 22:58 
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 la 7:56 
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 la 0:25 
@-=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 la 23:06 
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 iul. 2019 la 10:20 
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 mai 2019 la 17:38 
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 mai 2019 la 21:57 
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://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1754043717
RobRendell 27 mai 2019 la 21:36 
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 mai 2019 la 4:53 
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  [autor] 24 mai 2019 la 0:37 
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  [autor] 24 mai 2019 la 0:32 
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 mai 2019 la 17:27 
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 mai 2019 la 17:26 
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.
Uwunicorn69 22 mai 2019 la 22:48 
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 mai 2019 la 2:27 
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://gtm.steamproxy.vip/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 mai 2019 la 0:31 
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 mai 2019 la 22:30 
Ok - thanks! I'll also tinker with it myself. If I come up with anything worth sharing I'll let you know.
zanders3  [autor] 21 mai 2019 la 14:13 
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 mai 2019 la 0:35 
I've published a blueprint which demonstrates the problem: https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1746912631

You'll need at least this mod installed: https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=516770964

(I use that block to put the small grid PBs in the large grid ship without wasting excessive space.)
zanders3  [autor] 18 mai 2019 la 1:00 
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.