RimWorld

RimWorld

PowerSwitch
262 Comments
Haplo_X1  [author] 11 Jul @ 2:11pm 
Done
The Byzarkandian 11 Jul @ 11:44am 
1.6?
Haplo_X1  [author] 8 May @ 11:53am 
You can do a pull request if you like, then I can merge it
Scentese 6 May @ 7:40am 
Haplo_X1, should I make a push/fork/anything? All the code changes are just one block and one line. And thank you for the great mod!
Scentese 6 May @ 7:36am 
also add this in your class scope (outside of the method) if anyone is using the fix

private int lastCheckedHour = -1;
Scentese 6 May @ 7:33am 
I was using this mod along with Logic Switch. I am not sure if it resulted in any conflict, but this fix seems to have made the timer of this mod work for me, by flicking the switch only once per hour. The timer may not start to work immediately, but should do after an hour of in game time.
Scentese 6 May @ 7:33am 
with

[code]
// Improved Timer switching
if (autoSwitchTimerActive)
{
int currentHour = GenLocalDate.HourInteger(Map);

if (currentHour != lastCheckedHour)
{
lastCheckedHour = currentHour;

if (currentHour == autoSwitchTimerOnTime && !flickableComp.SwitchIsOn)
{
flickableComp.SwitchIsOn = true; // No designator usage!
SetWantSwitchOn(true);
}

if (currentHour == autoSwitchTimerOffTime && flickableComp.SwitchIsOn)
{
flickableComp.SwitchIsOn = false; // No designator usage!
SetWantSwitchOn(false);
}
}
}
[/code]
Scentese 6 May @ 7:32am 
ok I might have made a fix:

replace
[code]
// Timer switching
if (autoSwitchTimerActive)
{
// Time = Off-Time => Switch OFF
if (GenLocalDate.HourInteger(Map) == autoSwitchTimerOffTime && flickableComp.SwitchIsOn)
{
flickableComp.SwitchIsOn = false; // No designator usage!
SetWantSwitchOn(false);
}

// Time = On-Time => Switch ON
if (GenLocalDate.HourInteger(Map) == autoSwitchTimerOnTime && !flickableComp.SwitchIsOn)
{
flickableComp.SwitchIsOn = true; // No designator usage!
SetWantSwitchOn(true);
}
}
[/code]
Scentese 25 Apr @ 9:30pm 
I too feel the timer function is buggy. Could you please link the repo of 1.5 for me to take a look at?
123caboom 8 Apr @ 9:03am 
Compatible to the wall mounted switch in „hold my switch“?
Shabazza 11 Jan @ 2:11pm 
Timer function is not working for me. It always stays on.
Shodan2072 19 Dec, 2024 @ 9:30am 
Is there any way this could be combined with [Og] Automatic Power Switch, to make the different controls turn on/off automatically?
Haplo_X1  [author] 5 Dec, 2024 @ 9:45pm 
Did you add the mod midgame? Then you have to destroy, rebuild the power switch to get the new buttons
Zarkgok 11 Nov, 2024 @ 6:15am 
My module loaded successfully but no buttons are displayed, Is there any chance of conflict with other mods? (mod1.4)
Haplo_X1  [author] 3 Oct, 2024 @ 12:13pm 
If you add the mod to a running game, the powerswitch needs to be rebuild, else it continues to use the old switch.
PassingVillager 1 Oct, 2024 @ 6:40am 
My module loaded successfully but no buttons are displayed, Is there any chance of conflict with other mods? (mod1.4)
神公子 1 Jun, 2024 @ 12:02pm 
1.5?
Bardock20687 2 May, 2024 @ 10:48am 
1.5??
тетеря, блин 22 Apr, 2024 @ 7:50am 
1.5 🙏
Mike3223cz 8 Nov, 2023 @ 6:39am 
Is there a mod that adds a "one-way" cable? Something like a Diode... It allows electricity one way, but not the other... Could be used to make a "Backup power supply".
smitty_the_smith 10 Oct, 2022 @ 9:57am 
Is there a way to have Enemy Detection detect hostile animals?
jose.faunon 22 Aug, 2022 @ 1:37pm 
This mod is great! May I ask you for make a wall mounted interruptor? I know the mod "wall stuff" have one, but it is not compatible
Haplo_X1  [author] 15 Aug, 2022 @ 3:07pm 
That is an issue of the power switch: If it switches a wokbench off, this workbench will be ignored by the pawns.
AngryGuadalupe 14 Aug, 2022 @ 11:47am 
When using motion detection, do workbenches without power prevent pawns from working on active bills? Or will pawns ignore that the workbench isn't powered and go to the workbench, activating the power?
Don Castillo Esteban Gonzales 6 Jun, 2022 @ 3:42am 
Is there a way to put the switch with the motion detection inside a wall, facing a particular room? This would clean tings up and get rid of switches put randomly inside a room
Haplo_X1  [author] 4 May, 2022 @ 9:43am 
You can add it all the time. It just will not apply to already built switches,but new ones should work.
Varulv16 3 May, 2022 @ 7:51am 
So is this mod early game compatiable or is a new game required?
Haplo_X1  [author] 15 Apr, 2022 @ 7:13am 
Only if it changes the power switch.
Sundering Sober Sonder Sun 15 Apr, 2022 @ 2:47am 
Does this conflict with the mod - LightsOut?
Kuchar 4 Apr, 2022 @ 7:22am 
Is there an option to add that we can change auto on/off radius? sometimes 7 is too big for me and it is switching when pawn is in other room.
Haplo_X1  [author] 10 Mar, 2022 @ 8:55am 
You can switch this behaviour in the mod options
Fwiffo 10 Mar, 2022 @ 1:08am 
For some reason, the switch does not activate automatically on enemy detection in my game. Instead, it creates a job to flick it on/off manually instead.
Haplo_X1  [author] 24 Jan, 2022 @ 1:22pm 
I've recompiled it against version 1.3.3200. In my tests the switch is now working. On your side too?
BippyMiester 23 Jan, 2022 @ 4:54pm 
Can confirm that as of today, the mod is broken in 1.3. You can't set the time to turn the switch on or off, and the detection of hostile pawns, creatures, or enemies is hit or miss. Do not use the mod until its been updated, and make sure to BACK UP YOUR SAVE prior to you trying this mod. -1 vote from me.:steamthumbsdown:
smitty_the_smith 3 Sep, 2021 @ 10:39pm 
Someone fixed the detection of hunting animals by the power switch. I don't know who to thank.
@Jarquafelmu It works now.
Disferente 21 Aug, 2021 @ 8:50am 
Any chance to add so it can turn power off/on when it is raining?
-Mikhail- 16 Aug, 2021 @ 1:21pm 
There may be a problem in the version for 1.3. The switch is not visible on the wall.
Athos56 9 Aug, 2021 @ 1:30pm 
Just as a heads up, I had a siege raid, even after the raiders charged the walls the enemy detection never triggered. It had worked as expected for the regular raid earlier. However, the motion detection works great for my hospital, saves me tones of power. Great mod.
Haplo_X1  [author] 19 Jul, 2021 @ 8:32am 
Take a look on github..
Ex Ossibus Fumus 18 Jul, 2021 @ 6:36pm 
Can anyone confirm if this is functional as is for 1.3? just wanna make sure i can still use this with the new DLC
potoum13 14 Jul, 2021 @ 1:55am 
BUG - I use a mod call Visual Exceptions... And it report an error when loading this mod.

System.InvalidOperationException: Field descriptionDiscovered does not exist in type Verse.ResearchProjectDef.
Jarquafelmu 5 Jul, 2021 @ 5:25pm 
it would be nice if manhunting animals or animals in rage would trigger the enemy detection so that the turrets can fire at them
smitty_the_smith 30 May, 2021 @ 11:35am 
Does anyone know of a way to cross two power lines without them connecting? I want a switched line and an unswitched line
smitty_the_smith 27 May, 2021 @ 9:17am 
Just so we can be meticulous can you provide a circle showing the detection range when we setup enemy detection?
Haplo_X1  [author] 26 May, 2021 @ 12:15pm 
I don't think the performance is too hard on your gear. At least I have yet to get any complains about that. :)
For the detection: The enemy detection is not for the whole map, but roundabout 1/2 the size of your map.
Red-Eyed_Gelynome 25 May, 2021 @ 9:49pm 
how's the performance with this mod? I mean, you basically made the switches have some sensor and the likes, having too many of this on a large map, is there performance impact?

Also what does it mean on the enem detection, 1/2 of the map? can you clarify?
AFLD 14 May, 2021 @ 9:56am 
@Ronivan Search for Mlie's Auto Flicker mod if you are still looking for automated flicking
smitty_the_smith 10 Apr, 2021 @ 1:15pm 
The problem isn't how long the switch takes to turn on. It's the Enemy Detect feature doesn't detect carnivores hunting my animals. There's no card on animals hunting so the game won't pause. As a result by the time I notice my animals are being hunted they are dead. I'm hoping the switch can flip in the presence of hunting animals.
Haplo_X1  [author] 10 Apr, 2021 @ 11:33am 
Thank you very much for the translation.
I've prepared it and it will be uploaded with the next update :)