protected override void Update() { if (ProcessTask == null) { return; } //Transportation volume and energy usage float range = Loader.GetRange(Processor.VolumePerSecond); float sample_volume = Processor.VolumePerSecond * Time.deltaTime * YieldAdjustedUsageFraction; Pile sample = Scene.Main.World.Asteroid.Regolith .TakeSample(ProcessTask.Target.Position, range, sample_volume); input_concentration = sample.GetVolumeOf(ProcessTask.Feedstock.GetPrincipleComponent()) / sample.Volume; //Separation float sample_concentration = 1; foreach (Resource resource in ProcessTask.Feedstock.Resources) { float maximum_concentration = ProcessTask.Feedstock.GetVolumeOf(resource) / ProcessTask.Feedstock.Volume; float actual_concentration = sample.GetVolumeOf(resource) / sample.Volume; sample_concentration = Mathf.Min(sample_concentration, actual_concentration / maximum_concentration); } effective_separation_efficiency = ProcessTask.GetEffectiveSeparationEfficiency(sample_concentration); float removed_volume = effective_separation_efficiency * sample_concentration * sample_volume; Pile product = ProcessTask.Product.Normalized() * sample.TakeOut(ProcessTask.Feedstock.Normalized() * removed_volume).Volume * (ProcessTask.Product.Volume / ProcessTask.Feedstock.Volume); if (IsProducingTools) { float tools_produced = product.TakeOut(Resource.Tools).Volume; float net_tools = tools_produced - YieldAdjustedUsageFraction * Appliance.ToolsPerSecond * Time.deltaTime; if (net_tools < 0) { Unit.Team.Stock.Pile.TakeOut(Resource.Tools, -net_tools); Unit.Task = null; } else { Unit.Team.Stock.Pile.PutIn(Resource.Tools, net_tools); } } Unit.Team.Stock.Pile.PutIn(product); Scene.Main.World.Asteroid.Litter(Processor.Waster.WasteSite, sample); base.Update(); }