Marvin Martian wrote:but in case, i would like in my example check if $repairratefactor is realy below 1 like in vanilla (bacause that is what you want to change)
and then not operation="add", because if some mods does the same you like to do. you have in the end instead of 30 drones, 60 or factor X, ok would be not bad, but not the original idea
Right again. I really shouldn't do updates first thing in the morning. Got rid of operation="add" in v0.03 (you're right. Wasn't necessary because $repairratefactor should be 0 at the start of that node.), and added $repairrate lt 1, and removed the now redundant do_else node in v0.04. Thanks!
I'm pretty sure that your mod loads after mine, so that code section should look like this with both of our mods installed:
Code: Select all
<do_if value="$repairratefactor == 0">
<do_if value="$networkcreated">
<debug_text text="$Defensible.knownname + ' is ending mass traffic (no more units are flying)'" chance="$debugoutputchance" />
<end_repair_mass_traffic object="$Defensible" />
<set_value name="$networkcreated" exact="false" />
</do_if>
<!-- if no welders are underway, repair 10 times more slowly than with just one mk1 drone -->
<set_value name="$repairratefactor" exact="0.1" />
<do_if value="($repairratefactor lt 1) and ($Defensible.units.{unitcategory.welder}.count ge 1)">
<set_value name="$repairratefactor" exact="$Defensible.units.{unitcategory.welder}.count" />
</do_if>
<do_if value="$Defensible.isclass.ship_m or $Defensible.isclass.ship_s">
<!-- rate like a mk1 drone -->
<set_value name="$repairratefactor" exact="1" />
</do_if>
</do_if>
Assuming that I've had enough coffee to bring me to a semi-sentient state, that should mean:
- If small ship, then $repairratefactor == 1
- If object has at least one welder drone, regardless of availability, then $repairratefactor == number of Construction URVs
- In all other cases, if $repairratefactor == 0, then $repairratefactor == 0.1 as per vanilla.
edit: edited to reflect change in EngineerDroneFix v0.04. Should be ok until someone adds welder drones into small ships. Getting more coffee.