• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Help with electricity-powered workstations

vedrit

Refugee
Hi all, 

 I'm trying to make a mod that adds workstations that run off of electricity rather than fuel (and eventually will be faster than vanilla) and I've run into a few stumbling points

1) Output slots seem to be missing in-game Seems to have fixed itself, somehow.

2) I can't figure out how to add the Power On/Off button

3) The recipe categories/filters are missing

My code repository is here, I'm sure I've missed something(s) but this is my first 7DTD mod, so I'm not sure.

Thanks!

Edit: From what little discussion around electrical workstations I've seen, C# programming is required. This is fine by me, as I'm more familiar with C# than I am XML (weird, I know) I just need to know where to start

 
Last edited by a moderator:
I have not tried anything like this myself, but from what little I know, electricity is tricky to work with. The block needs to be a tile entity and that tile entity needs to be one that can accept electrical power. The tile entity class needs to be defined as a new C# class.

...and that's about where my knowledge ends.

The SCore modlet (by @sphereii) has a "powered workstations" feature which takes a different approach. It uses a Harmony patch to the vanilla code, so that if you set a "RequirePower" property (to "true") in the workstation's XML, it will scan the surrounding chunks for active power sources, and set the workstation's "burn time" if it finds any.

Here's the SCore repo if you want to take a look:

https://github.com/SphereII/SphereII.Mods/tree/master/0-SCore

That's the entire repo, here's the Harmony patch to workstations:
https://github.com/SphereII/SphereII.Mods/blob/master/0-SCore/Harmony/TileEntities/PoweredWorkstations.cs

But, that might not work the way you want. I think it only checks if there is an active power source in the area, and not whether that power source has actually been hooked up to the workstation (with the wire tool). I could easily be wrong though.

 
I have not tried anything like this myself, but from what little I know, electricity is tricky to work with. The block needs to be a tile entity and that tile entity needs to be one that can accept electrical power. The tile entity class needs to be defined as a new C# class.

...and that's about where my knowledge ends.

The SCore modlet (by @sphereii) has a "powered workstations" feature which takes a different approach. It uses a Harmony patch to the vanilla code, so that if you set a "RequirePower" property (to "true") in the workstation's XML, it will scan the surrounding chunks for active power sources, and set the workstation's "burn time" if it finds any.

Here's the SCore repo if you want to take a look:

https://github.com/SphereII/SphereII.Mods/tree/master/0-SCore

That's the entire repo, here's the Harmony patch to workstations:
https://github.com/SphereII/SphereII.Mods/blob/master/0-SCore/Harmony/TileEntities/PoweredWorkstations.cs

But, that might not work the way you want. I think it only checks if there is an active power source in the area, and not whether that power source has actually been hooked up to the workstation (with the wire tool). I could easily be wrong though.
I'll take a look, might have some handy nuggets of information, but from what you're describing, it indeed does not work how I'm wanting.

 
Back
Top