From a13a9036a51654643c7cb9b4e6298b840226cb32 Mon Sep 17 00:00:00 2001 From: David Dormagen Date: Fri, 5 Feb 2016 21:06:30 +0100 Subject: [PATCH] shovel: changed GetModifiedDigSpeed to GetDigSpeed Half of the callback's work was done outside (fetching the target speed) for no good reason. It's now all done in the callback, making it less weird. --- .../Objects.ocd/Items.ocd/Tools.ocd/Shovel.ocd/Script.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Shovel.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Tools.ocd/Shovel.ocd/Script.c index b0252d727..cdd095112 100644 --- a/planet/Objects.ocd/Items.ocd/Tools.ocd/Shovel.ocd/Script.c +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Shovel.ocd/Script.c @@ -134,9 +134,8 @@ public func FxShovelDigTimer(object clonk, effect, int time) } if(fDigging) { - // Adjust speed at current animation position - var speed = clonk.ActMap.Dig.Speed*2; - speed = this->GetModifiedDigSpeed(clonk, speed); + // Get animation-adjusted dig speed. + var speed = this->GetDigSpeed(clonk); // Limit the digging angle: one can dig maximally 30 degrees upwards. DigAngle = BoundBy(DigAngle, 60, 300); @@ -167,8 +166,10 @@ public func FxShovelDigTimer(object clonk, effect, int time) } } -func GetModifiedDigSpeed(object clonk, int speed) +private func GetDigSpeed(object clonk) { + var speed = clonk.ActMap.Dig.Speed * 2; + // Adjust speed at current animation position. var iAnimation = GetEffect("IntDig", clonk).var1; var iPosition = clonk->GetAnimationPosition(iAnimation)*180/clonk->GetAnimationLength("Dig"); speed = speed*(Cos(iPosition-45, 50)**2)/2500;