Space Engineers

Space Engineers

26 ratings
Ground vehicle lights script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
801.688 KB
Nov 28, 2020 @ 1:58pm
Dec 8, 2020 @ 12:08pm
7 Change Notes ( view )

Subscribe to download
Ground vehicle lights script

Description
About

This script was designed to help making ground vehicles more vivid by allowing to have various car lights working as one would expect car lights to work in the real world.

As of now the script enables you to
  • Switch back lights together with front (spot) lights on and off by pressing L
  • Switch surrounding/ambient lights together with front (spot) lights
  • Automatically light up brake lights when decelerating
  • Automatically light up turn indicators if your vehicle starts turning
  • Light up reversing lights when going backwards


Requirements
Your vehicle needs to have a main cockpit set and have it's name declared in the head of the script (or just name it Driver Seat if you don't want to edit the script at all).
There must be at least one spotlight (offset spotlights work, too) on the vehicle.

Easy setup
  1. Name your cockpit / control seat / remote control block
    Driver Seat
    and set the "Main Cockpit" checkbox

  2. Add the tag
    [Front]
    to your spotlight(s) name in the terminal

  3. Add the tag
    [Rear]
    to your rear light(s) name in the terminal

  4. Add the tag
    [Brake]
    to your brake light(s) name in the terminal

  5. Add the tag
    [Reverse]
    to your reversing light(s) name in the terminal

  6. Add the tag
    [Turn Left]
    to your turn indicator light(s) name in the terminal, which should light up when turning left

  7. Add the tag
    [Turn Right]
    to your turn indicator light(s) name in the terminal, which should light up when turning right

  8. Add the tag
    [Ambient]
    to ambient or surrounding light(s) name in the terminal, if you want them to light up with the spotlights

  9. After having set all the tags in the block names, add the script to a programmable block on your vehicle and hit the recompile button

Please note that the scipt just enables / disables the light blocks.
It does neither handle the direction indicators blinking frequency nur light range or color settings, so these have to be set up with the block's own settings, SE offers.

Should you add new blocks or if you have to rebuild some, make sure to set up their respective tags and hit the "recompile" button in the programmable block, which runs the script. This will reinitialize the script in order to find new blocks.

Planned features
I intend to add the following features within a future update:
  • Fog lights, which turn on automatically depending on the current weather situation
  • A mode to combine brake lights and turn indicators, so turning and braking can be indicated using the same light blocks
24 Comments
The_Maegges  [author] Jun 19, 2024 @ 2:58am 
@Into: Contrary to real life the turn indicators only work as long as the vehicle is actually turning, as the script measures if a lateral force is being applied to the grid. So if the vehicle stops, no force is applied and therefore the turning indicators are being turned off.

I am considering a rewrite of the script and will take some of the suggestions here into consideration.
Greystone Jun 10, 2024 @ 2:12am 
Can you add a Hazard Light option that allows brake lights and marker light to flash if activated?
Into Apr 9, 2024 @ 8:51am 
using your script for indicator lights, but they go out of you stay still, what would I have to do to change it?
Maja Feb 25, 2024 @ 4:41pm 
Such a basic and yet amazing script. Short code, lightweight and does exactly what you need in any ground based vehicle.
Haddock Mar 28, 2023 @ 1:07am 
Or take a Benz and there is no need for turning lights... :-P
The_Maegges  [author] Mar 27, 2023 @ 2:54pm 
Thanks! Unfortunately I can't do much about the delay, as the sideway force can only detected as it builds up. So turning indicators are more in the style of an Audi driving down a german highway ;-)
Haddock Mar 27, 2023 @ 6:08am 
Hi, here the feedback like desired: The turning lights are working in the correct directions while the driver is placed exactly above the fwd wheel (smal grid, 3x3). Only disadvantage is a time delay till the turn lights are comming up. But anyway a good idea and job.
Entarlas Feb 7, 2022 @ 2:42am 
breaking and turn indication...
That sounds cool :) looking forward to that too then. this will be the light mod to end all light mods! :summer2019flag: Let's Gooo! lol
Entarlas Feb 7, 2022 @ 2:37am 
I did some further testing. The break lights DO register however not in a useful way. They only turn on when used at dangerously high speeds and only for a fraction of a second even then. The threshold for them needs to be turned WAY down so they register when space-bar is pressed at all preferably or at least when moving at low speed like 5m/s+
The_Maegges  [author] Feb 7, 2022 @ 2:22am 
I haven't yet integrated the logic for combined breaking and turn indication. I will look into that during the next days ;-)