sol-oriens / SR2-Community-Patch

Star Ruler 2 Community Patch - A collection of bug fixes and non-gameplay changing improvements
5 stars 4 forks source link

Bug with ships never stopping from repairing #2

Open sol-oriens opened 6 years ago

sol-oriens commented 6 years ago

This needs to be reviewed with Dalo and dolynick to maybe find a more proper way to fix it.

DaloLorn commented 6 years ago

Never what?

sol-oriens commented 6 years ago

That was just a reminder for later after having another look at it, but since you ask... https://github.com/sol-oriens/Shores-of-Infinity/commit/b8d4a1e012b21e5c7578cf11c030f5241a015ab7#diff-bcc74daa79ddaa145ad66642c8f5eff4

I explained the issue in the comments.

Skeletonxf commented 3 years ago

I independently ran into this in my own mod and wrote a slightly different fix which might be of interest https://github.com/Skeletonxf/star-ruler-2-mod-ce/blob/master/colonisation-expansion/scripts/server/objects/Ship.as#L1203

DaloLorn commented 3 years ago

No, that's wrong. bp.removedHP counts hexes which have been removed from the blueprint, such as Crystalline Armor. Telling the blueprint that it's fully repaired (at full HP) when it isn't is also less than ideal, since it may introduce a different kind of inaccuracy. Simply canceling the repairs (damage = 0) would suffice.

Skeletonxf commented 3 years ago

Whoops I'll fix that. Regardless I did empirically find that the damage not being repaired was orders of magnitude less than 1, so I think checking damage against a fractional threshold rather than casting it to an integer may be a better solution.