[A17] Water Power

Started by Swenzi, June 16, 2017, 12:54:49 PM

Previous topic - Next topic

Swenzi

Adds new power generation buildings that use hydropower.
Download Available At: https://github.com/yliankuo/WaterPower
Steam Link: http://steamcommunity.com/sharedfiles/filedetails/?id=934418281

Additions:

Underwater Power Cable:
Designed to built underwater, as such is unbuildable on land. Cost: 2 Steel.

Water Turbine:
Designed to generate power from river tiles. Increased power output during
rain/thunderstorms. Can only be built in deep moving water tiles.
Cost: 150 Steel, 2 Components

Tidal Plant:
Designed to generate from the ocean. Power output can be boosted by up to 300%
from the use of Tidal Turbines (10 max). Can only be built in shallow ocean
water tiles. Requires Tidal Power research. Cost: 750 Steel, 50 Plasteel, 30 Components

Tidal Turbine:
Boosts the power output of the tidal plant by 20%, boost can be stacked up to
10 times. Can only be built in ocean tiles. Requires Tidal Power research.
Cost: 100 Steel, 7 Plasteel, 4 Components

Lighthouse:
Misc. building that produces light in a large area, only built on ocean tiles.
Cost: 200 Steel, 10 Components

Power Output:

Water Turbine Base Output: 1250 Watts to 2500 Watts
Rain Effect:
Up to 500 Watts of increased power output increase during thunderstorms/rain.

Tidal Plant Base Output: 4000 Watts (up to 12000 Watts, vial Tidal Turbines)
Rain Effect:
Up to 500-1500 Watts of increased power output increase during thunderstorms/rain.

v1.1.0
-Rebalanced/Reworked Water Turbine image/requirements/cost/output
-Added Tidal Plant and Tidal Turbines
-Added Lighthouse
v1.0.2
-Underwater Power Cables no longer block path
v1.0.1
-Balancing issues, modified power output from different water tiles.
-Added Electricity research requirement.
v1.0.0
-Initial Release



Compatability:
Compatible with Basic Bridges by Rainbeau, Bridgello by Shinzy, and Vegetable Garden by Dismarzero. However error messages occur in dev log due xpathing conflicts that DO NOT effect gameplay. If you wish to remove those error messages, check out the compatibility patch available at the SubMod below:
https://github.com/yliankuo/WaterPower--Basic-Bridges-Compatible-

Please report other compatibility issues.


Suggestions:
Suggestions on balancing/additional features for the mod would be appreciated.


Credits:
-Swenzi: Coding Mechanics
-Zairya: Textures
-Skratchey: Sounds
-DrizzlyBear: Bug Testing

[attachment deleted by admin due to age]

Swenzi


Swenzi


SpaceDorf

First :)
Right from the wishlist.
Thank you swenzi, Subscribed.
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

Swenzi

Quote from: SpaceDorf on June 16, 2017, 04:37:59 PM
First :)
Right from the wishlist.
Thank you swenzi, Subscribed.

Cool. If you wanna elaborate on that wishlist, it might give me some mod ideas.

AngleWyrm

#5
This post explains how to make an xpath statement that isn't going to generate duplicate field errors. Quick recap:

<Operation Class="PatchOperationSequence">
  <success>Always</success>
  <operations>
    <li Class="PatchOperationTest">
      <xpath>*/ThingDef[defName = "ChosenThingy"]/elementThatIWannaAdd</xpath>
      <success>Invert</success>
    </li>
    <li Class="PatchOperationAdd">
      <xpath>*/ThingDef[defName = "ChosenThingy"]</xpath>
      <value>
        <elementThatIWannaAdd> someValue </elementThatIWannaAdd>
      </value>
    </li>
  </operations>
</Operation>
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Swenzi

Quote from: AngleWyrm on June 16, 2017, 09:54:05 PM
This post explains how to make an xpath statement that isn't going to generate duplicate field errors. Quick recap:

<Operation Class="PatchOperationSequence">
  <success>Always</success>
  <operations>
    <li Class="PatchOperationTest">
      <xpath>*/ThingDef[defName = "ChosenThingy"]/elementThatIWannaAdd</xpath>
      <success>Invert</success>
    </li>
    <li Class="PatchOperationAdd">
      <xpath>*/ThingDef[defName = "ChosenThingy"]</xpath>
      <value>
        <elementThatIWannaAdd> someValue </elementThatIWannaAdd>
      </value>
    </li>
  </operations>
</Operation>


So if i use this to test than I won't need the submod?

PixelBitZombie

#7
Is anyone able to use the water turbine in deep water? I got the materials but it's not working. The light house works and looks great, I haven't got to the research yet so maybe this is why. But thought I'd give you a heads up!

Edit: Deep Moving Water, odd I figured the ocean would be considered this. Doesn't matter, this mod still kicks ass, water power is great when starting out like wind.
"When logic and proportion have fallen sloppy dead
And the White Knight is talking backwards
And the Red Queen's off with her head"


AngleWyrm

#8
Quote from: Swenzi on June 16, 2017, 11:23:39 PM
So if i use this to test than I won't need the submod?
I've used this test to do the same thing: Add a sub-element if it doesn't exist.

The error messages are saying that two separate attempts (by two different mods) were made to add a specific element, and so it failed the second time because that element already exists.

This test checks to see if the element already exists (maybe because some other mod created it), and if it doesn't then there's a spot in there to add the element. And if it does already exist, then the check quietly bails out of it's sequence without spilling big red oops onto the user's screen.
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Antaios

#9
Quote from: AngleWyrm on June 17, 2017, 01:09:25 AM
Quote from: Swenzi on June 16, 2017, 11:23:39 PM
So if i use this to test than I won't need the submod?
I've used this test to do the same thing: Add a sub-element if it doesn't exist.

The error messages are saying that two separate attempts (by two different mods) were made to add a specific element, and so it failed the second time because that element already exists.

This test checks to see if the element already exists (maybe because some other mod created it), and if it doesn't then there's a spot in there to add the element. And if it does already exist, then the check quietly bails out of it's sequence without spilling big red oops onto the user's screen.

Do take note that PatchSequenceTest operates per file, not global and not per def.

So if for example you're editing ThingDefs and looking to add RandomProperty1 if it doesn't exist in any of them, you need to be sure that no single file contains both ThingDefs which are missing RandomProperty1 and ThingDefs which include RandomProperty1 already.

It's why when I did that, I use a placeholder tag and some gymnastics with '../' in xpath, rather than PatchOperationTest.

AngleWyrm

#10
Quote from: Antaios on June 17, 2017, 05:30:32 AM
Do take note that PatchSequenceTest operates per file, not global and not per def.
There should be no connection between xpath data searches and the underlying physical storage of that data.

The assertion that there is implies a defect in the implementation of the PatchSequenceTest function. Can you construct a test case that fails if the test draws values from different files, but succeeds if those values are drawn from the same file?
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Antaios

#11
Quote from: AngleWyrm on June 17, 2017, 08:03:37 PM
Quote from: Antaios on June 17, 2017, 05:30:32 AM
Do take note that PatchSequenceTest operates per file, not global and not per def.
There should be no connection between xpath data searches and the underlying physical storage of that data.

The assertion that there is implies a defect in the implementation of the PatchSequenceTest function. Can you construct a test case that fails if the test draws values from different files, but succeeds if those values are drawn from the same file?

It is evident in the code, if you take a look at ModContentPack.LoadDefs(IEnumerable<PatchOperation> patches), PatchOperation, PatchOperationSequence and PatchOperationTest.
But a simple test is to take tuning fork, and in the core defs of Rimworld, add a blank abstract in Core\Defs\ThingDefs_Items.xml which has an ingestible/chairSearchRadius. You'll notice the patch no longer works on core meals.

Sorry Swenzi, since this is only half relevant to your mod :/.
I copied the discussion the mod help forum, AngelWyrm.

MadsMartinMadsen

Looks very interesting, I have to try it out.
Honestly the first thought I had when I saw there was rivers in A17 was "I wonder how long till watermills or water power"  ;D

asquirrel

#13
The water generator is listed and I can drag the blueprint but there is no body of water I can place it in.  I've tried all colors of water (light and dark blue) but the blueprint stays red.  Is there a technology I have to research before I can place it?  Thanks!

Edit: 
I have the base water power mod installed and then the patch for basic bridges installed below that.  It looks like this in my mods list:

WaterPower
WaterPower [Basic Bridges Compatible]

jts1702

Quote from: asquirrel on June 25, 2017, 11:32:06 AM
The water generator is listed and I can drag the blueprint but there is no body of water I can place it in.  I've tried all colors of water (light and dark blue) but the blueprint stays red.  Is there a technology I have to research before I can place it?  Thanks!

Edit: 
I have the base water power mod installed and then the patch for basic bridges installed below that.  It looks like this in my mods list:

WaterPower
WaterPower [Basic Bridges Compatible]

Nothing. You are not putting in MOVING water (which are what river tiles are - they are not typical water tiles). Ponds and swamps do not generate water, and seawater is another beast altogether (which is what the tidal power station is for).