Is there a way to mess with car headlights? Normal behaviour is that they turn off when the driver exits. Would like to turn them on and keep them on, without players.
Possible to have car headlights stay on, when car is empty?
Discussion in 'Rust Development' started by No Name Brand, May 26, 2018.
-
Yes it is possible, it depends on BaseEntity.Flags.Reserved2 (when it's true the lights are on)
-
Possible if you reference the entity and use reflection to change its value.
Code:// BaseCar : BaseWheeledVehicle private bool lightsOn = true;
-
Code:
base.SetFlag(BaseEntity.Flags.Reserved2, (!this.IsMounted() ? false : this.lightsOn), false);
Edit: which is inside FixedUpdate -
-
-
Awesome, thanks! Going to try to keep all the car headlights on forever to be used as spotlights at night.
-
FixedUpdate continues to turn the lights back off. Frowny face. Maybe have to put a crash test dummy in the driver seat to trick it.
-
-
So, something like class HeadLightController : MonoBehaviour then attach it to the car with .AddComponent<HeadLightController>, and that overrides what the car does on FixedUpdate? I'm really new to this, slowly learning. Yesterday I actually decompiled crap to get my Free Research plugin going.
-