Jump to content

Help with electricity-powered workstations


Recommended Posts

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

Edited by vedrit (see edit history)
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

6 hours ago, khzmusik said:

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...