Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Customizing power output decrement when a power plant is damaged #1433

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Coronia
Copy link
Contributor

@Coronia Coronia commented Nov 29, 2024

This implementation worked in practice, but not sure if it's the proper approach. Also there might be missing check and cases, and its interaction with Drain (especially Ares's new options) still remains a question. For now I'd pull it as a draft to get some advice and testing. If anyone finds problem or has better idea please make me know, thank you very much.

  • It is possible to customize the power decrement of a power plant when it's damaged. The actual power output for this plant will be: Power minuses the product of original power decrement and Powerplant.DamageFactor. Can't reduce power output lower than 0.
    • Specifically, if the factor is set to 0.0, power output won't be decreased by losing health for this power plant.

In rulesmd.ini:

[SOMEBUILDING]                     ; BuildingType
PowerPlant.DamageFactor=1.0        ; floating point value

@chaserli chaserli marked this pull request as draft December 1, 2024 07:49
@mevitar
Copy link

mevitar commented Dec 1, 2024

There was already an attempt to make power not degrade with powerplant's damage, in #550 (but that one seems to be abandoned and this one is more customizable).

I think it would be better if the tag name was something like Power.DamageFactor= (or even PoweredSpecial.DamageFactor=, but this one is pretty long).

@tyuah8
Copy link

tyuah8 commented Jan 5, 2025

Unless I am not understanding something, how come we can't just hook at 0x44E861 inside BuildingClass::GetPowerOutput() and change the call to GetHealthPercentage() to something else? It is how the game now, even with Ares, is handling power loss on power plant damage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants