From b17d0bccb6175c8c52a0ec3c0c66ca17b7613f11 Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Wed, 13 May 2015 21:18:15 +0200 Subject: [PATCH] fix pump power consumption (#1309) --- planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c b/planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c index 2c126cce2..4c7f56157 100644 --- a/planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c +++ b/planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c @@ -333,16 +333,16 @@ private func PumpHeight2Power(int pump_height) var max_power = 60; // Calculate the used power in steps of ten, every 60 pixels represents ten units. var used_power = pump_height / 60 * 10; - // If the power is positive then add the minimum energy. - if (used_power > 0) + // If the pump height is positive then add the minimum energy. + if (pump_height >= 0) used_power = Min(used_power + 10, max_power); // Pumping power downwards never costs energy, but only brings something if offset is overcome. else - used_power = Min(used_power + power_offset - 10, 0); + used_power = BoundBy(used_power + power_offset - 10, -max_power, 0); return used_power; } -/** Returns whether there is liquid at the source pipe to pump */ +// Returns whether there is liquid at the source pipe to pump. private func HasLiquidToPump() { // source