RimWorld

RimWorld

LightsOut
This topic has been locked
Murmur 23 Oct, 2022 @ 11:58pm
Pending Wall Light Update
While trying to pin down a compatibility issue with Performance Optimizer I ended up redoing a significant portion of the mod to be moderately less derpy. I have tested it with Lights Out, doesn't seem to be any issues. I am waiting to see what the situation is with Performance Optimizer before I push the update so in the meantime I am linking it to you in case you want to make sure nothing will burst into flames when it goes out.

https://github.com/Mmuurrmmuurr/RimWorld/raw/master/WallLightExp.zip
< >
Showing 1-11 of 11 comments
juanlopez2008  [developer] 24 Oct, 2022 @ 9:40pm 
I think it looks like it'll work fine with my mod, thanks for the heads up!

Unrelated...

One thing I've been curious about when looking at the code, is there a reason you opt to make your own glower comp instead of inheriting from CompGlower and just overriding the pieces you need? Seems like you could get rid of the extra work of recreating ShouldBeLitNow/ReceiveCompSignal/UpdateLit/etc... Then you'd get any vanilla changes for free whenever they update and not need to try and keep parity with it manually. Doing that I imagine you would have gotten the color changing update without making any changes.

A cursory glance says that the biggest road block to that would be that the vanilla glower spawns at the location of its parent, which is currently in the wall, but that seems like a solvable problem by making the def 2x1 with the base position being the cell the glower should spawn in, then the graphic spawning in the cell next to it. I haven't tinkered with buildings, though, so maybe it's not as easy as it seems to pull that off. But if you could then it seems like you can stop maintaining your own glower, which would probably be convenient and more compatibility-friendly for other mods.

Not sure that it would have made things easier in my mod (except for the position thing, as-is if a wall light is attached to a wall that divides two rooms, it's a crapshoot which room it "belongs" to when you call GetRoom on it).

Not that any of that is necessary, your mod works perfectly fine how it's set up today and it might not be worth a refactor at this point, if it's even a workable solution.
Murmur 24 Oct, 2022 @ 10:17pm 
You are correct about the glower spawning in the wall. A previous iteration of the mod used a method similar to what you suggest, but that required the user to physically click on the space in front of the wall, so that the base portion of the 2x1 object occupies the space in front of the wall, thus making the lighting correct. Nobody could figure it out and I got complaints all day long.

My glower comp is not actually a glower at all. My fake glower spawns a Thing that has the real CompGlower on it, precisely so I don't have to copy a lot of vanilla glower code. The color changing stuff is all vanilla code but I had to come up with a solution to access it from something that isn't a CompGlower. My first version of it was really ♥♥♥♥♥♥ because I was panicking trying to get it to work on short notice, and involved making a duplicate CompGlower that was overriden to do absolutely nothing other than provide access to the recoloring, and then pass that along to the real CompGlower on a separate spawned object. I assume this is what caused you some problems. I've made that a lot better now, but still have a few kinks to work out.

There's a lot of hoops to jump through in order to put something on a damn wall. Nobody has come up with a good solution for it. I was the first person to do it this way, and now the Vanilla Expanded people do it in a similar way. Albeit a lot more professional, but the core concept of spawning another Thing so that the glower is in the proper position is the same. I think the only way there's ever going to be a good solution to the problem is if Ludeon adds a real wall attachment system so everyone can stop with these hacky methods.
juanlopez2008  [developer] 24 Oct, 2022 @ 10:46pm 
That makes sense. Yeah, like I said before, it’s the Wild West out here in these mods. Sparse documentation at best. I guarantee there are better ways to do my mod that I just don’t know about (the new power upgrade system could be a game changer for me, but I haven’t had time to investigate it yet).

Believe it or not, the thing that broke compatibility this last time was that my definition of a custom glower required the word “glower” to be in the name; you used to call it CompGlowerOffset, now you call it CompOffsetGlow, so it no longer had “glower” in the name and just never got patched. Easy fix once I looked at it.

Spawning a new Thing as the glower totally screwed with me for a bit; I think my mod initially picked it up as it’s own light, since there’s no convenient way to identify a damn light in the game. I literally match to substrings in the def name and have keywords for things that could be lights (notably your mod’s def prefix reasonably has the word light in it, so like… they all kinda qualify by default). It’s a dinky and fragile system. Don’t even get me started with other mods misusing benches lol
Murmur 24 Oct, 2022 @ 11:04pm 
Yeah I tend to make arbitrary changes because I forget that other people use the mod lol. Speaking of which, I may have just invalidated all the extra ♥♥♥♥ you've had to do for compatibility with wall lights. Everything still seems to be working with Lights Out somehow but the CompGlower is now on the Wall Light itself, and the old glowers are now just temporary placeholders that despawn after registering the glower.

Err.. "Invalidated" as in made obsolete, not broken everything again, lol
Last edited by Murmur; 24 Oct, 2022 @ 11:05pm
Murmur 24 Oct, 2022 @ 11:24pm 
So there are two problems I noticed now:

Wall sun lights now have the Keep On option, and it errors when clicked.

When a light that is off because nobody is in the room has its color changed, it turns itself back on but still uses no power.

https://github.com/Mmuurrmmuurr/RimWorld/raw/master/WallLightExp2.zip these should be the final major changes. Finally have compatibility with Performance Optimizer working.

It works pretty similar to the Vanilla Expanded Wall Lights, whatever you did for those might work for these now.

EDIT: The light turning itself on when the color is changed is a problem on my end.

EDIT AGAIN: Actually both problems were a "me" problem, you can completely disregard this entire post.
Last edited by Murmur; 25 Oct, 2022 @ 12:54am
juanlopez2008  [developer] 25 Oct, 2022 @ 5:46am 
Not sure if it's a compatibility issue here, but I get an exception in the latest version when I click on a newly-constructed wall light:

https://gist.github.com/4ecde24051485ec0bc1ea3ff467907d5

It seems to suggest it's coming from CompOffsetGlow, but the last gizmo I see is the one that comes from my KeepOnComp so it's suspicious.

Edit: I'm not able to reproduce that issue currently, not sure what's up there.

Edit 2:
Looks like it's related to the compatibility issue below if I had to guess, but I'm unfortunately out of time this morning to investigate.

Steps to reproduce:
1. Restart the game (it's not enough to reload a save or go to the main menu)
2. Load up whatever map, dev quicktest works for me
3. Build a wall light in an empty room
4. Click on that wall light before any pawn enters the room
5. Kaboom
Last edited by juanlopez2008; 25 Oct, 2022 @ 6:01am
juanlopez2008  [developer] 25 Oct, 2022 @ 5:56am 
That being said, there is a compatibility issue now: if you build a wall light in an empty room, it starts in the "On Standby" state and (presumably) never spawns the glower; because of this, the gizmos for color customization don't appear on the light until a Pawn enters the room and turns the light on.

In fact most of the gizmos are missing from it in that case... is that a me thing or a you thing?

https://imgur.com/a/hC3skSW
Murmur 25 Oct, 2022 @ 8:17am 
That exception is something I fixed after sending you the link to the test build but before updating on steam. v1.4.8333.7398 should not have that issue anymore. However the issue of the lights not being recolorable until turned on the first time is something that is still happening, but all the gizmos should be there minus the recoloring ones, in the latest version.
Murmur 25 Oct, 2022 @ 9:24am 
And I just pushed an update that fixes the "need to be lit one time before able to be recolored" issue. Everything still seems to be working between the two mods.
juanlopez2008  [developer] 25 Oct, 2022 @ 9:53am 
That didn’t require doing anything hinky in your mod, right?

I’ve slowly been working on a feature to do delayed-off for lights to stop them from flashing in high-traffic areas, so if the correct, non-janky, solution is for my mod to let it light up before turning off then that’s something manageable on my end. I don’t want you to have to carve out special cases for my mod, especially if it ends up being a problem for the VE wall lights as well.
Murmur 25 Oct, 2022 @ 10:09am 
The problem was purely a "me" problem, it was happening with or without Lights Out so no special cases needed.
< >
Showing 1-11 of 11 comments
Per page: 1530 50