Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#633 closed defect (fixed)

[PATCH] Building and Ship Repair

Reported by: Michael D. Hafer Owned by: mimo
Priority: Nice to Have Milestone: Alpha 19
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

Repair is currently taking the value from:

<Builder>

<Rate>1.0</Rate>

</Builder>

And interpreting that as a repair rate of 1 Health/Hitpoint per second. This is bad for a few reasons:

  1. It takes one value and uses it for two different things. Originally this value was (and still is) used as a base value for building x the BuildTime value of the structure being built.
  1. If we want to change a unit's Build rate, but not the Repair rate, then we can't do it.
  1. 1 hitpoint per second is painfully slow. To change the value would also be changing doubling, tripling, or quadrupling the build rate (inverse of point no. 2).

These values need to be separated. A separate "repair" tag and value need to be implemented. It could be done one of two ways:

  • In the unit templates
  • In the building templates

The benefits and pitfalls of each need to be discussed before choosing the implementation.

OR

We can just link Repair with Building at a 1:1 ratio so that repairing gives the structure the same amount of health per second as building it does. Also, any "cost" associated with repairing a building is the same cost as constructing it. Say, if the building is damaged by 25%, then it take 25% of the build cost to repair it.

Attachments (4)

repair.diff (5.1 KB ) - added by sanderd17 10 years ago.
repair-v2.diff (16.4 KB ) - added by mimo 9 years ago.
repair-v3.diff (17.5 KB ) - added by mimo 9 years ago.
new version following leper's comments.
repair-v4.diff (19.3 KB ) - added by mimo 9 years ago.
some cleanings + add number of repairing units in gui

Download all attachments as: .zip

Change History (13)

comment:2 by Markus, 11 years ago

Keywords: design added

by sanderd17, 10 years ago

Attachment: repair.diff added

comment:3 by sanderd17, 10 years ago

Keywords: patch added
Summary: Building and Ship Repair[PATCH] Building and Ship Repair

Patch adds a RepairTime and RepairRate to resp. repairable ents and builders. Similar to the BuildTime and existing Rate. Both are optional, and when undefined, the behaviour is the same (i.e. RepairTime defaults to the max health, and RepairRate defaults to the existing Rate).

Ready for inclusion if anyone wants to use it. But as long as it's not used, it'd better be not in the code (as the working of it will be forgotten).

by mimo, 9 years ago

Attachment: repair-v2.diff added

comment:4 by mimo, 9 years ago

Keywords: review added

I propose a new patch for this, creating a new Repairable component. One advantage is to be able to record builders repairing an entity, and so to be able to decrease the rate when several builders (as for building foundations). Also, instead of defining a new repairTime as in the previous patch, this patch uses a ratio of repairTime/buildTime.

comment:5 by Stan, 9 years ago

Nice, btw why did you modify the shark template ?

comment:6 by mimo, 9 years ago

There was no reason to have the repairable false attribute (the rest is only fixing the alignment).

Last edited 9 years ago by mimo (previous) (diff)

comment:7 by leper, 9 years ago

2. or 4. would be nicer as 2.0 or 4.0 in the XMLs and schema. The Engine.QueryInterface() calls for IID_Foundation or IID_Repairable are strange. Either we should have some helper function to abstract that difference (similar to Mirages), or just have Foundations provide a repairable component.

Add some () for the multiple divisions, also in case you divide by 0 you'll end up with strange values. It'd be better to check for that case (or rather sanity of the resulting value) explicitly.

Apart from that the patch looks good.

by mimo, 9 years ago

Attachment: repair-v3.diff added

new version following leper's comments.

by mimo, 9 years ago

Attachment: repair-v4.diff added

some cleanings + add number of repairing units in gui

comment:8 by mimo, 9 years ago

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 16943:

add a new Repairable component defining a ratio of repairTime/buildTime for repairable entities. Fixes #633

comment:9 by mimo, 9 years ago

Keywords: design review removed
Milestone: BacklogAlpha 19
Note: See TracTickets for help on using tickets.