-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
Moduled buildings demolishing #922
Comments
Great report, thanks. Yes, that is weird and the FIXME on that function really was needed. We're returning half the power to build the structure if it doesn't have a module, but if it has modules, we return the full power to build one module (regardless of how many it has). It's just happenstance that gives the right numbers for a research facility with or without a module. I'll change it to return (build cost + (module cost * number of modules)) / 2 |
The function structPowerToBuild() is rather confusingly named, as it returns the power to either build the structure, or to add its next module, not the total power it took to build it as might have been mistakenly inferred. I've renamed it to structPowerToBuildOrAddNextModule(), since that's what it returns. The real problem is in structureTotalReturn() which (ab)uses structPowerToBuild() and then tries to correct the (bad) number it gets back from that depending on whether the structure has any modules (irrespective of how many). What we actually want to do is to return: (power to build basic structure + (power to build a module * number of modules)) / 2
The function structPowerToBuild() is rather confusingly named, as it returns the power to either build the structure, or to add its next module, not the total power it took to build it as might have been mistakenly inferred. I've renamed it to structPowerToBuildOrAddNextModule(), since that's what it returns. The real problem is in structureTotalReturn() which (ab)uses structPowerToBuild() and then tries to correct the (bad) number it gets back from that depending on whether the structure has any modules (irrespective of how many). What we actually want to do is to return: (power to build basic structure + (power to build a module * number of modules)) / 2
The function structPowerToBuild() is rather confusingly named, as it returns the power to either build the structure, or to add its next module, not the total power it took to build it as might have been mistakenly inferred. I've renamed it to structPowerToBuildOrAddNextModule(), since that's what it returns. The real problem is in structureTotalReturn() which (ab)uses structPowerToBuild() and then tries to correct the (bad) number it gets back from that depending on whether the structure has any modules (irrespective of how many). What we actually want to do is to return: (power to build basic structure + (power to build a module * number of modules)) / 2
Describe the bug
When player deconstruct any buiding he recieves 50% of building's cost. But thare are some problems with demolishing almost all buldings with modules:
To Reproduce
1 moduled f. -> 50 energy.
2 moduled f. ->100 energy.
3 moduled f. -> 100 energy (!not 150!).
Outcome after demolishing:
p. g. without module -> 25 energy.
upgraded p. g. -> 0 energy (!not 25!)
There is no such problem with a research facility (don't know why, but demolishing of it works properly, no matter moduled or not) I haven't tested a VTOL factory, but I can suggest, that it has problems as a vehicle factory has
Your System:
The text was updated successfully, but these errors were encountered: