Conan Exiles

Conan Exiles

Auto Lights Off v1.0.1
Ideas on "how to do" it better.
Hi there - As I didn't see you in the modding discord.
Nice idea, however you should change the basic concept.

1. have a timer running on the server - like once every 30 to 45 seconds - time does not fly that fast on the server anyway.

2. keep the code server side only.

either:
3a. attach an actor component (server side) to the master placeable class, have that component check if that placeables actually has an "LightsOnOff"-component (or whatever you use to toggle). if "valid" keep a list of references on the mod controller.
if the actor component gets destroyed, just tell the mod controller to remove the owner item from the reference list.

3b. use a "get all actors of class"-call to get all master placeables.

4. when your timer fires, actually trigger an "interact" on those placeables to turn them off server wide - replication will make sure those placeables are turned off for the client.

5. you might add all static actors (level stuff) to the list as well on start of the modcontroller.
no need to iterate over everything all over again.

feel free to contact me :)