Space Engineers

Space Engineers

44 ratings
(DevTool) Programmable Block DebugAPI
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod category: Script, Other
File Size
Posted
Updated
568.195 KB
14 Nov, 2021 @ 10:49am
14 May, 2024 @ 11:03am
5 Change Notes ( view )

Subscribe to download
(DevTool) Programmable Block DebugAPI

In 1 collection by Digi
Digi's Space Engineers mods
50 items
Description
This mod adds an API for PB to allow it to draw things in 3D space or on HUD/chat, for debugging purposes.

It only works in offline worlds and its purpose is to help PB developers debug their code or visualize their vectors and such.

Current features:
- Draw point, line, AABB, OBB, sphere and matrix.
- Draw a GPS marker.
- Print to HUD and to Chat.
- Adjustable number using hotkey+scroll for realtime tweaks
- Code execution time measurement (GetTimestamp() / Measure())


Please do provide feedback on how it can be made easier to use, afterall it's a dev tool and its purpose is to help visualize things, it doesn't need to be a chore.


Using it in your scripts:
Open https://github.com/THDigi/PBDrawAPI/blob/master/Data/Scripts/PBDebugAPI/ForPB.cs or https://github.com/THDigi/PBDrawAPI/blob/master/Data/Scripts/PBDebugAPI/ForPB_Lite.cs, they're functionally identical but lite one has no comments or examples to just show the required setup.

Then you can copy the DebugAPI class to your code, instantiate and use the methods you find in it.


Note that there's also 2 primary kinds of workflows:

A. Easiest one is to call Debug.RemoveDraw() at the start of your Main() which results in your drawables living for a single PB run no matter how long or short that is.

B. Use the seconds parameter on various drawables to have them self-expire after that time and/or store IDs of things you draw then Debug.Remove(id) when you wish for them to be removed.


mod io?
Please read[gist.github.com]
17 Comments
SirHamsterAlot 2 Jul @ 9:25am 
bro thanks for the mod fr this helped tons just now
Gorgazor 13 May @ 12:10am 
Absolutely love this mod, its been a great tool for learning vectors/matrixes
Digi  [author] 17 Feb @ 5:05pm 
If you have a direction then just add it to your position, and if it's a normalized direction and you want it longer, multiply the direction by the distance.

It's also shown in one of the examples: https://github.com/THDigi/PBDrawAPI/blob/master/Data/Scripts/PBDebugAPI/ForPB.cs#L76
Gorgazor 17 Feb @ 1:19pm 
Is there a way to draw a vector from an origin? Rather than drawing one between two world coordinates
CTH2004 8 Sep, 2022 @ 10:53am 
nah, won't bother asking them.
First off, I think it's a steam issue. Second off, I have had issues with that discord in the past, and I know multiple people who have been banned for no apparent reason (maybe there was, but no one knows what it was), so I only go there in case of emergency. So, I will just upload 3.0!
Digi  [author] 8 Sep, 2022 @ 6:55am 
Yeah linking mods to worlds/blueprints/etc is I think generally accepted, I don't have a problem with it.
Where it's expected to ask is when re-uploading someone else's stuff :P

As for your world not updating to workshop, you should ask in keen discord (probably in #help-se) as I'm sure there's a way to make your existing world be uploaded as one of the other ones instead of having to upload a new one.
CTH2004 8 Sep, 2022 @ 6:19am 
thanks!
You okay if I put it in my "testing world" that I upload? It will be the 3.0, as the 2.0 and 1.0 are not updateing! (Curse you STEAM!)
Digi  [author] 7 Sep, 2022 @ 11:00pm 
It will print a message in chat and log to everyone involved (server, joining players) that the mod is there but won't do anything, which is exactly what would happen, the PB won't be able to get the API and would be identical to the mod not existing in the first place.
CTH2004 7 Sep, 2022 @ 1:42pm 
Quick question: What happens if this is loaded in a online world? will it just turn off? crash?
Khazul 11 Jul, 2022 @ 6:56am 
Great job with this - very useful :)

Did make me think if you get the mp sync working and per-client server side draw space, then it could make an excellent basis for advanced cockpit HUDs :)