#Light of a Players Current Room
1 messages · Page 1 of 1 (latest)
could you be more specific on which one is null
room or light controller
and when do you do it
Well to test it I'm just putting it in one of my while loops and logging to the console to see and it appears to be the light controller that is null
i would recommend doing null checks though
room can be null
(if player is dead, not fpc or just noclips out)
light being null is weird
but might be specific rooms
or a bug
Well when I do player.Room it'll return something but once doing player.Room.LightController I get the NullReferenceException
Might it be because I am trying to get it in a coroutine?
I am literally just printing player.Room.LightController that I've just chucked into one of my coroutine while loops
ok
@tribal turtle !!
public LightsController? LightController => Base.LightControllers.Count > 0 ? LightsController.Get(Base.LightControllers[0]) : null;
thats all it rly does
Im 99% sure that this is labapi game version issue now only
as this LightController cache assignment has been fixed on master
Also, I reported is as a bug, as player.Room.AllLightControllers.Any(lights => lights.LightsEnabled) always returns false and it got closed saying that it was fixed on the latest internal version
And that it should be fixed in the next update, and it has been the next update but the bug is still here
The labapi version 0.5.0 is in the steam build right?
Can you print count of AllLightControllers?
As I said, this uses the base-game added caching which is not fixed in this version most likely
Ill download some server build and test it real quick if its works there
Yes
Okay, wanted to make sure I had that latest
player.Room.AllLightControllers.Count() gave NullReferenceException
Aha
Aha?
Well let me test it on newest version
LabApi.Features.Console.Logger.Info(player.Room);
LabApi.Features.Console.Logger.Info(player.Room.AllLightControllers);
LabApi.Features.Console.Logger.Info(player.Room.AllLightControllers.Count());
So it is fixed on master
F
So until like public beta you cant finish it
Alright, looks like that'll be commented out for a while then
Welp, thank you for the help, I shall work on other things while I wait, I am the man who waits
So what is the go on this? When will it work, because it's still broken
LabApi.Features.Console.Logger.Info("test");
LabApi.Features.Console.Logger.Info(player.Room != null);
LabApi.Features.Console.Logger.Info(player.Room?.AllLightControllers != null);
LabApi.Features.Console.Logger.Info(player.Room?.AllLightControllers?.Count() != null);```
And it prints test, false, false, false, meaning they are all still null, what's goin on??
do you mean test, true, true, true? false means its not null by the code you gave
should be fixed in 14.1 as i tested it and they were working
Hey when are you calling them provided code?
Public beta server & client
Works fine
You know its going to be null when the player is not in a room?
Or the player is spectator
Then the room is null aswell
nvm i cant read
I just got off so I'll have to try something later
its possible that your server install was outdated, sometimes steam just doesnt download the updated files
Oh, I completely forgot about this, basically I have absolutely no clue what was going on because I hadn't changed anything at all and it randomly started to work, and continued to work so I've got no idea what was wrong, but at least it works now