Jump to content

A16 - Logic Gates (N)OR, (N)AND, Buffer(Relay) [under Development]


fryakatkop

Recommended Posts

Logic Gate for A16.3 + SDX 0.7.1

 

Intro

Hello fellow survivors,

 

I love the new Powersystem TFP introduced in A16.

After tons of hours in A16 exp and stable, i found there is missing something to make the fancy circuits i'd like to have.

imagine a triggerplate you can stand on or a motionsensor to temporary disable your electrofences while you are in the Area.

So we need some kind of NOT Gate, this raised the idea in my Head.

 

Idea

One main logic block which you can add input gates as you need.

It will have 3 possible AND inputs:

place a Gate Block, then add a input gate in front, this will be your first AND input. Standing on the gate block, you can add now your 2nd or 3th input left or right of the first input gate

Any AND input will have up to 3 OR inputs:

add a input gate in row of a AND input, this will be logic OR with other input gates inline

 

The output (continue wire from main logic block) and any InputGate can be toggled to be ActiveLOW or ActiveHigh.

 

Download

not yet available, sorry

 

Repository

https://github.com/FrYakaTKoP/7dtd-SDX-LogicGates

 

About

i'm a electronic technician with some little C# experience. With +1500 hrs ingame and some simple XML modding i like to go the next step into modding this awesome game. But don't expect this to complete quickly, it's done when it's done ;)

 

Development Status

- under development / not released

 

Still got some unsolved problems/questions/todo:

- how to restrict placeing at side of a block (so it can only be place on ground)

- is it possible to have unlimited AND or OR input gates?

- find the Bug causeing the output to not update children with activeHigh outputmode

- implement inputGate code

- implement OR functionallity

 

any suggestions are welcome

 

FrY

Link to comment
Share on other sites

thanks @AnsontheToad

 

still trying to understand the powersystem

 

i can connect wire to my custom block BlockLogicGate : BlockPowered (it consums power from the generator too) but still didn't find the right event to start my script.

 

ILSpy, NPP++ and SDX seems not to be the optimal reverse engineering environment, i would almost die for live debugging (or API docu). ;)

Link to comment
Share on other sites

  • 2 weeks later...

small update...

 

 

like you may see in the video the output changes to OFF (watch lamps) when the 2nd input changes as it should. If i turn it back on my code change the color and output state as it should, but the consumers don't notice. I need to Interact (player) with anything in the PowerNet to update the output state.

 

strange thing is that onBlockActivated (Player interact with block) seems to update the state too. But i removed all related "power" code in there. Seems that there is something before or after which invokes the update. (nope calling it from my script does not update it)

 

Anybody got some insight how to update the isPowered state of childrens TileEntityPoweredTrigger?

 

 

** Updated OP

Link to comment
Share on other sites

  • 4 weeks later...

dev diary update...

 

[video=youtube_share;e2jOox98sfo]

 

a list of things you may see in the video...

 

- 3 AND inputs are working (normal wire relays still -> no OR Gates and ActiveLow)

- Power indicator is working

- Toggle activeHigh / Low outputMode incl. indicator is working

- Output indicator is working

- Output is working when activeLow outputMode (still a bug where the children did not receive power correctly)

 

if you like to play arround with this, you can download it on github but there is still alot to change which will break savegames.

 

 

** updated OP

 

 

** update 26 Sept

 

found a way to add light to the vanilla wirerelay model. Maybe there is no need for a custom model for the input.

 

some eye candy:

1.jpg.6148e53a1f2311b73fd7dc0f9996516e.jpg

2.thumb.jpg.404ac9640989f8173c1447e22c2013b1.jpg

Link to comment
Share on other sites

I'm not sure what you mean with power controller?

If you mean a power management controller, where is limiting/monitoring/managing power/consumption, no this isn't.

Don't know atm., if this is even "possible", without changing the whole electricity system from TFP.

 

This mod adds a method to logically connect two (or more) powerwires (or more exactly their state). Which means you could connect your bladetrap (or other powered blocks) so it would turn on if your Pressureplate and Trapwire are triggered, but turn back off if a camera triggers too.

 

if your interested to learn more about logic gates :https://en.wikipedia.org/wiki/Logic_gate

 

FrY

Link to comment
Share on other sites

I'm not sure what you mean with power controller?

If you mean a power management controller, where is limiting/monitoring/managing power/consumption, no this isn't.

Don't know atm., if this is even "possible", without changing the whole electricity system from TFP.

 

This mod adds a method to logically connect two (or more) powerwires (or more exactly their state). Which means you could connect your bladetrap (or other powered blocks) so it would turn on if your Pressureplate and Trapwire are triggered, but turn back off if a camera triggers too.

 

if your interested to learn more about logic gates :https://en.wikipedia.org/wiki/Logic_gate

 

FrY

sorta but wut I meant was like ur gates but with different input n output for wires and power and read and act like one of us is there sorta like afk switches but a controlled sequence

 

- - - Updated - - -

 

n nvm I take that back exactly like ur gates but like an auto read on the cable sorta thing

Link to comment
Share on other sites

with different input n output for wires and power and read and act like one of us is there sorta like afk switches but a controlled sequence

May a advanced "timerrelay" with programable sequence? I need to think about this a little more, but obvious a new mod or atleast i need to finish the main- and inputgate first.

 

or a gui on the device nothing fancy just a more controlled version of a gate and multiple ins and outs

already thought about a small ui but more the simple version where you still have alot of variety but only one config per 'Gate' the ActiveLow/High input-/outputMode. I will definitely look into ui modding, but atm the simple "<E> toggle Output Mode" seems pretty nice. And with this Hardcoded 3 input AND Gate which any AND input can have 3 OR inputs, which are all switchable to inverse there activestate. You could do really heavy logical circuits, i can not see a limitation then performance :( . You could even build a CPU, since all you need are NAND gates, btw.

 

speaking of future plans, i may look into:

- remote controlled switchbox

a switchbox where you can add inputs and give them a uniqe number. Then a second box else where in the world could be connected to it as remotecontrolled output. Byebye wire mess

 

- chat spammer block

a block where you can define a sentence to be sent to chat. Setup your sentence, select worldchat, place pressureplate, wireup and jump, jump, jump

 

</OffTopic>

 

**

 

I added the code for the 3 OR inputs and activeLow to the inputs. Got almost all features in, still alot code cleanup and improvement todo. And the output not receive power bug still persist :(

 

FrY

Link to comment
Share on other sites

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...