Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - justarandomgeek

#1
I'm pretty sure this is currently impossible, after looking around for it for a while, but I'd like to be able to get a List<ThingComp> of all the comps on a given ThingWithComps that derive from one of my base classes/interfaces. Specifically, I want to get List<CompSignal> or List<ICompSignal>and have it contain all the direction-specific subclasses too. My goal is to make it so that CompSignal connects on any sides that aren't already connected by direction-specific subclasses, without having to actually specifically check every possible variation in the code (That's 7 so far, N/S/E/W, NS, EW, and N+Source, but I expect that list to grow over time).

Is there a way to get all Comps of a given supertype (or just all, I'll filter it myself...) from a ThingWithComps?
#2
Unfinished / [WIP] Signals, you can't stop them!
March 07, 2015, 08:40:14 PM
I'm working on a mod that adds Signals to RimWorld, so that you can automatically detect and react to various events

Currently functional parts:
Signal Conduit - Works like Power Conduit, but it carries a signal (true/false). It links under similar rules to Power Conduit. Currently conduit connects on all sides, but a future release will add the option to block connecting on some sides, to allow running multiple signals side-by-side.

Power Sensor - Produces a signal based on the amount of power available in the connected PowerNet. Currently hardcoded to output the result of [Stored Power > 100WD], but this will be configurable soon with an interface similar to the temperature buttons on heaters/coolers. (This also eventually needs a new graphic - it currently looks like a Power Switch.)

Power Relay - A modified Power Switch that switches on/off by a signal.

Pressure Plate - A floor tile which emits a signal when items are placed on top of it.

AND/XOR gates - These take up to 3 input signals, and AND/XOR them, to produce one output. Gate can be rotated in any direction. Also has an option to invert output. I'm terrible at drawing :(

Logic Buffer - Passes a signal in one direction. Has an option to invert output, to be used as a NOT gate.

Crossover Node - Allows one signal to run across another. Useful for designing large circuits with many signals.

De/Mux and dense conduit - 3-into-1 De/Mux, and 3-signal conduit. Further upgrade to take three bundles of three and combine into a 9-signal conduit.


Planned Components (in no particular order):
Switch - An input switch for colonists to flip.
Radios - for sending signals long distances. Multiple levels for range/channels.
Solenoid-locking Doors - Doors that lock/unlock based on a signal.
Light Sensor - Either a 1-signal output of above/below threshold, or a multi-signal output for light levels.
Temperature Sensor - Either a 1-signal output of above/below threshold, or a multi-signal output of temperature value.
Simple functional blocks (maybe) - A Flip-Flop, 3/9 bit adders/comparators/logical operations. (Yep, definitely building a computer...)

Eventually I'm also hoping to tie in the mechanical walls from MD2 (to make a "lockdown" button, that activates turrets and re-arranges external walls to route all traffic through the killbox(es)), and make some components that link with the A2B belts to allow smarter thing-routing.

[attachment deleted due to age]
#3
I'm trying to sort out a particularly hairy bit of code for managing networks between Things (well, technically ThingComps) for my in-progress Signals mod, but it's very difficult to see what's going on without a debugger attached. Is there any way to run RimWorld such that I can drop breakpoints in the code for my mod and step through it? If it makes a difference, I'm using SharpDevelop instead of Visual Studio, but afaik they should be interchangeable for this purpose (and since Unity is using Mono, SharpDevelop is actually a little bit more closely related!).

When I try, it seems like the debugger never really attaches, possibly because of something Unity/Mono does under the hood?

I know this must be possible, I just can't seem to make it work...
#4
I'm trying to make a mod that provide Signal Conduit and various input/output devices. First up will be a relay to switch power on/off by signal, and a pressure plate to switch a signal on/off by Things and/or Pawns being on that tile, but I'll likely be adding much more after that (logic gates (at least AND/NOT, the conduit will be a wired-OR), integration with A2B with a new selector type). Basically, I want to make the building blocks with which to automate things!

However, I'm starting with what is probably the hardest part: Making conduit that connects to itself, but not the power grid, and holds a single bit 0/1, instead of a power value. I've got the XML stuff figured out, but I'm still having a little trouble wrapping my head around the architecture inside the game's code for dealing with power. It looks like I'm going to have to not-quite-duplicate a lot of PowerNet and it's related components, and then not-quite-duplicate CompPower on top of that to make SignalNet and related, and CompSignal. Am I on the right track, or is there a vastly easier way to do this?