[1.2] Power Logic - (v1.16c) (10.05.2021)

Started by Supes, December 04, 2016, 10:24:37 PM

Previous topic - Next topic

Supes


Description:
Power Logic is primarily based on Switching logic gates and sensor logic.

Additional Info
Originally I was going to create a bunch of And Gates, Or Gates, Not Gates, but after the And gate I thought to myself hmm, needs some switches to show it off and after creating one sensor, then I decided hmm, what about a remote switch, and so on and so forth.  so now it turned into a mod with an And gate and a bunch of sensor switches with some wifi thrown in for good measure. 

Switches


Stay On Switch (Formally the 'And Gate Switch' in A15)
This switch is intended to be connected to 3 or more power conduits, when power is detected in 2 of the connected conduits, power is allowed through the switch until power is lost completely or flicked on/off.


Pressure Sensor Plate
This is a floor sensor switch that will allow power to transmit through it when a pawn is standing on the sensor. it will also work as a grid of Pressure Sensors in case one was not wide enough, and also contains Friend Foe detection.


Stack Sensor Plate
This is a floor sensor switch that powers on when it has over a certain amount of items on it.


Proximity Sensor
The Proximity sensor will allow power through it when someone is within its range, and disallow power when no one is in range. This type of sensor doesn't consume power, but has poor range.


Capacitor Sensor Switch
Monitors stored power levels, and turns off when power gets to the set 'low' point, and back on again when it reaches another set 'high' point.


Current Sensor Switch
This switches on when it detects positive or negative power.


Light Sensor Switch
This turns on when light level is low, this senses both sunlight and lamp lighting.


Heat Sensor Switch
This turns on when above or below a specific target temperature.


Entangled Switch
This does the opposite of whichever switch it is entangled with. Entanglement between this and another switch is permanent, so be sure you are linking to the correct switch (the Entangle tab shows the distance away from other devices, as well as a visual line to help).


Zone Switch
This switch counts the number of items within a zone.  For stockpiles, the count is restricted to allowed items.

Wireless Devices


Remote Proximity Sensor
Similar to the proximity sensor in the way that it triggers when someone is nearby, except this time without the switch component, and instead it transmits a wireless signal to a nearby receiver device.  This sensor is also powered, which means it has better range that can be adjusted.


Remote Controlled Switch
This switch activates when it detects a wireless signal, and deactivates when there's no signal.


Signal Repeater
The Signal Repeater does exactly what it says, it repeats any signal that it receives on the same channel as the repeater, effectively increasing the wireless range of your Transmitter or Remote Switch


Signal Transmitter
The Signal Transmitter does exactly what it says, it transmits a signal when powered.  Useful for bridging channels or when used in conjunction with another sensor to activate a Remote Controlled Switch.


Remote Controlled Door
This door does what a usual autodoor does, but when it receives a wireless signal, it can perform a series of actions.


Remote Flicker
This device flicks on any adjacent device when it receives a signal.


Remote Gizmo Servo
This device activates a gizmo button on a single adjacent device (that it is pointing at) when it receives a signal.  Unlike the remote flicker, it only works when powered.


Boom Box
A Boombox that plays a sound when powered or when powered and detecting a wireless signal.  If multiple boomboxes are used, then only one will be heard at a time in a "first on first played" basis.

Laser Tech


Laser Emitter
A Laser Emitter, well, it emits a laser.  This can be paired with a laser switch to create a laser tripwire.  The beam can be bent round corners using laser mirrors and splitters.  Using more power will extend the laser length, this has the side effect of making the beam slightly hazardous to cross if high enough.  Warning, the laser emitter generates a lot of heat, consider using vents or coolers to avoid extreme heat or explosive mishaps.  The emitter beam doesn't differentiate between hostile or friendly pawns, take this into consideration if creating a laser based trap.


Laser Mirror
This Mirror can reflect a laser beam at a 90 degree angle.


Laser Splitter
This Laser Splitter, if struck by a beam at any angle, will split the beam into two perpendicular beams.


Laser Merger
This Laser Merger, if struck by one or more beams, will direct all beams towards the same direction (directed beams will exit out the wide flat side where the arrows are pointing) using refraction through a prism.


Laser Window
This wall will allow laser beams through it unimpeded


Laser Power Panel
When a laser is directed into one of the panels, the beam is diverted into a reservoir of water, the water quickly turns to steam and that steam pushes through a central turbine, causing power to be generated.


Laser Switch
This switch will turn on if struck by a laser beam.

Logic Gates

Input Socket
All gates (with the exception of the Not Inverter) require an input socket placed directly between the gate and a power conduit you plan to use as an input.


Logic Gate
Can be configured as AND, OR, XOR. Any conduit that is neither an input socket nor inverter are considered the gates output.
If configured as AND, then when it is attached to two powered inputs, it allows power through it.
If configured as OR, then when attached to at least one powered input, it allows power through it.
If configured as XOR, then when attached to one powered input, it allows power through it.  But turns off if both inputs are powered.


Inverter (Not)
when put directly next to a gate, the Inverter reverses the function of the gate (e.g. AND become NAND). Note, this requires a constant power source to function

AND Gate Example


NAND Gate Example




Misc

Protective Fuse
Made from a very thin copper wire in a glass tube, this fuse halves the chance that batteries will completely discharge.  More effective when used in sequence or to separate groups of batteries.


Radar
Radio Detection And Ranging, or Radar for short, by sending out sensing reflected radio waves, it can determine where an object is over vast distances.  Has a popout minimap.


A common question I get is "why doesn't such and such switch connect to my conduits?", The reason is that all Switches, be them a vanilla switch or one added by a mod, work by flaging as no power grid on the switches square when off, but flagged as a power grid when on.  Therefore when off, a conduit doesn't link until the switch turns on.

All proximity type sensors have friend foe settings that can be changed.

All wireless devices can have their channel changed, and will not communicate with devices on different channels.  Selecting a wireless device will highlight transmitters or receivers the device can see, green for ones on the same channel and red for ones on another channel.

All Proximity Sensors will not detect people that are not in the same room

An example on how to use the And Gate Switch would be combining 2 power input connections, one input has a clear path to a battery/generator, and the second is connected to a pressure plate which is then connected to another or the same power source.  the and gate outputs to a conduit connected to a bunch of turrets located outside the my prison, and the pressure plate is right outside the door to the prison, I've set the sensor to trigger on Enemies only so my wardens don't trigger the sensor.  Now when a prison break is attempted, the prisoner breaks through the door, steps on the pressure plate, the And Gate Switch turns on, the turrets activate and mow down the prisoner.  Those turrets will now remain on until I flick/reset the And Gate off again.

For best use of the Capacitor Sensor Switch, use it to disconnect parts of the grid or high powered devices so it allows your batteries to recharge.  Make sure there's an unbroken route of power between the batteries and the capacitor (any switches inbetween the Capacitor sensor switch and the batteries will sever the grid between them when the switch turns off).

The Stack Sensor Plate can be placed under anything, this allows you to place it under things like a hopper so you can control power going to a nutrient paste dispenser for example.

Fun fact. it is perfectly possible to entangle an entangled switch with another entangled switch.

PowerLogic can be added to an ongoing save


Author/Mod Team
Textures and Code, Supes

How to install:
- Unzip the contents and place them in your RimWorld/Mods folder.
- Activate the mod in the mod menu in the game.

Nexus Download Link



Change List


1.16c
Changed gizmo defname to avoid hash clash

1.16b
Multiplier Compatibility Hotfix
Gizmo Servo Itab Improvements

1.16
Added Gizmo Servo
Added Offset for Current Switch
Added additional information for Capacitor Switch
Improved Textures for multiple Switches
Entanglement Switch should show line to paired switch when selected

1.14
Added Counter Mode to Remote controlled switch

1.13
Added Laser Tech
+Laser Emitter
+Laser Mirror
+Laser Splitter
+Laser Window
+Laser Switch
New craftable materials
+Laser Glass
+Optical Resonator

1.12
Added Radar
Added Zone Switch

1.10
Added Stack Sensor Plate
Improved Translations

1.9
Added Remote Flicker

1.8b
Transmitter changes
+New graphic
+Pulse mode
+Schedule mode (hour of day/day of year)

1.8
Added Protective fuse

1.7
Door Profiles added
Door Profile based actions
Door wait toggle action added
Door Play/Pause Controls
Door Presets
removed Inductors from power buildings

1.6d
Fix for Doors

1.6b
Added Short Range option for Capacitor Switch

1.6
Added Entangled Switch
Fixed Capacitor Sensor Switch throwing errors if right next to another switch
Inductor loopback will equalise
various other inductor fixes

1.5
Fixed an exploit on the Inductor to get free power
Improved compatibility between input sockets and Inductors
Remote Door
+Remote Door Macro ITab now cleaner
+Added Door Macro Copy and Paste
+Added new door actions - Forbid, Allow, Change Channel
+Added buttons for reordering Door Actions

1.4
Logic Gates (AND, OR, XOR) have been combined
Inductors have been overhauled
+positive emitter power only toggle (emitter will avoid drawing power from batteries)
+draw division will behave differently now
Multi Channel Wireless Research added

1.3b
Stay On Switch Changes
+delay after flick before active again
+will work even when no batteries are connected
Heat Sensor switch fully functional
Inductor Changes
+Forced Over Draw Setting
Transceiver Fix for AI flicking after load

1.3a
Small update for French Translation strings

1.3
Added Heat Sensor Switch
Added high/low toggle to Light Sensor
Fixed Loading Issue with Stay On Switch

1.2
Added Remote Controlled Door
Added Logical Gates (Huzzah)
+AND Gate
+OR Gate
+XOR Gate
Added Inverter (NOT)
Added Input Sockets (use these between logical gates and conduits)
Increased range of Inductors from 5 to 7 spaces
Inductors now have settings
Added Light Sensor Switch
Added AI for flicking Wireless channels

1.1a
update for Alpha 16

1.1
Added save/load persistence to wireless transmissions
Added trigger off Cooldown for Proximity sensors
Fixed rare error with wireless switch inspection string
Corrected french translation file errors
Added new research - Inductive Power Transfer
Added new switch type - Capacitor Sensor Switch
Added the Inductive Emitter Coil and Inductive Receiver Coil
Increased the Cooldown for proximity Sensors

1.0
initial version
And Gate Switch
Pressure Plate Sensor
Proximity Sensor
Remote Proximity Sensor
Remote Controlled Switch
Signal Repeater
Signal Transmitter





Power Logic by Supes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


caesius

Minecraft's Redstone system in rimworld version?

Supes

Nothing as fancy yet, but I'm aiming towards adding more logic gates (most likely using multiple objects) in the future

atm it's mainly a bunch of sensors and switches

1000101

Ermagawd, finally someone releases a mod like this.  I like Haplo's power switch and expanded on that for my own use, but I think this is a better implementation.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

faltonico

I love Terraria and i was waiting for this first step to happen.
Thanks a lot!
Now we need different set of colored cables ;)

Supes

Quote from: faltonico on December 05, 2016, 07:55:17 PM
I love Terraria and i was waiting for this first step to happen.
Thanks a lot!
Now we need different set of colored cables ;)

not sure about different cables, that might be purely cosmetic without requiring CCL detours (unless just having different colours of the same conduit that was the intended request)

faltonico

Quote from: Supes on December 07, 2016, 09:40:39 AM
Quote from: faltonico on December 05, 2016, 07:55:17 PM
I love Terraria and i was waiting for this first step to happen.
Thanks a lot!
Now we need different set of colored cables ;)

not sure about different cables, that might be purely cosmetic without requiring CCL detours (unless just having different colours of the same conduit that was the intended request)
Not cosmetic but colored cables as in Terraria; there, they are used to build several different sets of "circuits" that can be connected to logic gates, portals, traps, sensors, lights and toggleable walls. They have different colors to portrait that they don't connect to each other when overlapped.

I don't know if it is possible in Rimworld, but at least i know the "Redist heat" creator has been capable of putting 2 sets of "tubes" in the same cell that conduct heat without CCL. He said he would not try to place different cables for now, because he was busy with something else.


This is a brief summary of all the stuff possible in Terraria, if you are curious:
https://www.youtube.com/watch?v=F3-hmMtOzbA&index=17&list=LLnLheuc-OZK2F4ZSNk_U87w

But to do most of that stuff is not possible in Rimworld because it lacks something like the "statues" Terraria has (they generate "something" when activated) and some other things.

Supes

I've drawn up some plans/pseudo code for a way to cross cables, I wont spoil the surprise though, all I'll say is it wont exactly be a conduit, but I think you'll like it.

I did have some success with a conduit that doesn't transmit power that could overlap a normal conduit, but ones that do transmit power insist on joining the conduits together.


I've also been working on saving more states of the devices/sensors, in addition to a few tweaks, which I've currently been testing.  I'll have part of the weekend off work, so more time to get stuck into programming/testing then (and maybe some Christmas tree decorating as well)

Killaim

you should make new types of power cables that only connect to the same type of cable

then we could make different networks of power and the cables could crisscross and/or occupy the same tile

items would then need to be able to pick between the different power cables near them

split them up into colors? Red Blue Yellow

faltonico

Quote from: Supes on December 09, 2016, 09:20:25 PM
I've drawn up some plans/pseudo code for a way to cross cables, I wont spoil the surprise though, all I'll say is it wont exactly be a conduit, but I think you'll like it.

I did have some success with a conduit that doesn't transmit power that could overlap a normal conduit, but ones that do transmit power insist on joining the conduits together.


I've also been working on saving more states of the devices/sensors, in addition to a few tweaks, which I've currently been testing.  I'll have part of the weekend off work, so more time to get stuck into programming/testing then (and maybe some Christmas tree decorating as well)
Take your time buddy, it is enough for me to know that you are interested =)

Supes

#10
here it is, a way to cross conduits, you put an Inductive Emitter Coil on the main grid, and then put the Inductive Receiver Coil on the isolated grid (if it's in range (5-6 squares), and both devices are on different grids you should see a connecting line) power is drawn from the main grid and supplied to the receivers grid.

I created the Capacitor Sensor switch after a request on steam workshop for some way to turn a switch off when batteries get too low, this is what I came up with, it monitors stored battery power, and turns off when stored power goes down to a certain point (cut off point).  the switch will turn back on when it reaches the upper power level. both the cut off point and upper points are adjustable.

1.1
Added save/load persistence to wireless transmissions
Added trigger off Cooldown for Proximity sensors
Fixed rare error with wireless switch inspection string
Corrected french translation file errors
Added new research - Inductive Power Transfer
Added new switch type - Capacitor Sensor Switch
Added the Inductive Emitter Coil and Inductive Receiver Coil






faltonico

D=
Man you took me by surprise here, i wasn't expecting it, nor like this nor so quickly! I thought something like a new cable would be easier, but i know nothing about coding xD
I wont be able to test this for now though... my beautiful +10 years colony is running at 5 FPS and i am about to drop it >_< I was planning to wait till A16 is out to start a new one.
Small question, how long can you stretch out the Inductive Coils? Would i be able to stretch it indefinitely?
I really appreciate you taking your time to do stuff random people on the internet suggest you =)

Supes

the inductive colour line can be stretched to about 5 spaces (enough space for a blank square either side of the conduit you plan to cross), then you just connect a normal conduit to the receiver and expand that as much as you please like a normal power grid

I might not have made it very clear in the pic of my previous post, but the white lines are just normal conduits (the emitter and the receiver can connect to conduits directly adjacent to them), you can see one of the lamps connecting to the conduit at the top left

faltonico

Quote from: Supes on December 15, 2016, 10:27:40 PM
the inductive colour line can be stretched to about 5 spaces (enough space for a blank square either side of the conduit you plan to cross), then you just connect a normal conduit to the receiver and expand that as much as you please like a normal power grid

I might not have made it very clear in the pic of my previous post, but the white lines are just normal conduits (the emitter and the receiver can connect to conduits directly adjacent to them), you can see one of the lamps connecting to the conduit at the top left
I kind of imagined that, but i was already looking for a way to exploit your mod xD

Facepunch