Auto-unstick produced vehicles from landscape by moving them upwards a bit.

Thanks to Ann for reporting this!
stable-5.4
Sven Eberhardt 2013-10-05 16:10:43 +02:00
parent 7ba5333f8b
commit 2f37347b09
1 changed files with 6 additions and 1 deletions

View File

@ -595,7 +595,12 @@ public func OnProductEjection(object product)
{
var x = GetX();
var y = GetY() + GetDefHeight()/2 - product->GetDefHeight()/2;
product->SetPosition(x, y);
product->SetPosition(x, y);
// Sometimes, there is material in front of the building. Move vehicles upwards in that case
var max_unstick_range = Max(GetDefHeight()/5,5); // 8 pixels for tools workshop
var y_off = 0;
while (product->Stuck() && y_off < max_unstick_range)
product->SetPosition(x, y-++y_off);
}
// Items should stay inside.
else