forked from Mirrors/openclonk
Liquid Container: Let liquid object handle removing liquids
parent
8a49ae10c0
commit
af8e681ec8
|
@ -263,12 +263,6 @@ func RemoveLiquid(string liquid_name, int amount, object destination)
|
|||
FatalError(Format("You can remove positive amounts of liquid only, got %d", amount));
|
||||
}
|
||||
|
||||
if (Contained() && Contained()->~IsLiquidContainer())
|
||||
{
|
||||
return Contained()->RemoveLiquid(liquid_name, amount, destination);
|
||||
}
|
||||
|
||||
|
||||
// default parameters if nothing is provided: the current material and level
|
||||
liquid_name = liquid_name ?? IsLiquid();
|
||||
amount = amount ?? GetLiquidAmount();
|
||||
|
|
|
@ -205,17 +205,14 @@ func RemoveLiquid(string liquid_name, int amount, object destination)
|
|||
FatalError(Format("You can remove positive amounts of liquid only, got %d", amount));
|
||||
}
|
||||
|
||||
// default parameters if nothing is provided: the current material and level
|
||||
liquid_name = liquid_name ?? GetLiquidType();
|
||||
amount = amount ?? GetLiquidFillLevel();
|
||||
|
||||
//Wrong material?
|
||||
if (!WildcardMatch(GetLiquidType(), liquid_name))
|
||||
return [GetLiquidType(), 0];
|
||||
|
||||
amount = Min(amount, GetLiquidFillLevel());
|
||||
ChangeLiquidFillLevel(-amount);
|
||||
return [liquid_name, amount];
|
||||
if (GetLiquidItem())
|
||||
{
|
||||
return GetLiquidItem()->RemoveLiquid(liquid_name, amount, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
return [nil, 0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue