Skip to content

Commit

Permalink
no message (#496)
Browse files Browse the repository at this point in the history
Co-authored-by: Dolzhukov, Viktor <[email protected]>
  • Loading branch information
Sellafield and Dolzhukov, Viktor authored May 25, 2024
1 parent 42d03b1 commit 220e239
Show file tree
Hide file tree
Showing 15 changed files with 177 additions and 231 deletions.
5 changes: 5 additions & 0 deletions src/Perpetuum/Modules/DrillerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ public void DoExtractMinerals(IZone zone)
double materialAmount = materialInfo.Amount * _miningAmountModifier.Value;
List<ItemInfo> extractedMaterials = Extract(mineralLayer, terrainLock.Location, (uint)materialAmount);

if (ParentRobot is RemoteControlledCreature creature)
{
uint materialLeft = mineralLayer.GetNode(terrainLock.Location).GetValue(terrainLock.Location);
creature.ProcessIndustrialTarget(terrainLock.Location.Center, materialLeft);
}
_ = extractedMaterials.Count.ThrowIfEqual(0, ErrorCodes.NoMineralOnTile);
extractedMaterials.AddRange(_rareMaterialHandler.GenerateRareMaterials(materialInfo.EntityDefault.Definition));

Expand Down
11 changes: 9 additions & 2 deletions src/Perpetuum/Modules/HarvesterModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
using Perpetuum.Zones.Locking.Locks;
using Perpetuum.Zones.RemoteControl;
using Perpetuum.Zones.Terrains;
using Perpetuum.Zones.Terrains.Materials.Plants;
using Perpetuum.Zones.Terrains.Materials.Plants.Harvesters;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Transactions;
Expand Down Expand Up @@ -102,12 +104,17 @@ public void DoHarvesting(IZone zone)
{
using (new TerrainUpdateMonitor(zone))
{
Zones.Terrains.Materials.Plants.PlantInfo plantInfo = zone.Terrain.Plants.GetValue(terrainLock.Location);
PlantInfo plantInfo = zone.Terrain.Plants.GetValue(terrainLock.Location);
double amountModifier = _harverstingAmountModifier.GetValueByPlantType(plantInfo.type);

IPlantHarvester plantHarvester = _plantHarvesterFactory(zone, amountModifier);

System.Collections.Generic.IEnumerable<ItemInfo> harvestedPlants = plantHarvester.HarvestPlant(terrainLock.Location);
if (ParentRobot is RemoteControlledCreature creature)
{
creature.ProcessIndustrialTarget(terrainLock.Location.Center, plantInfo.material);
}

IEnumerable<ItemInfo> harvestedPlants = plantHarvester.HarvestPlant(terrainLock.Location);

Debug.Assert(ParentRobot != null, "ParentRobot != null");

Expand Down
3 changes: 0 additions & 3 deletions src/Perpetuum/Perpetuum.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@
<Compile Include="Zones\NpcSystem\AI\CombatDrones\EscortCombatDroneAI.cs" />
<Compile Include="Zones\NpcSystem\AI\CombatDrones\GuardCombatDroneAI.cs" />
<Compile Include="Zones\NpcSystem\AI\HarvestingIndustrialTurretAI.cs" />
<Compile Include="Zones\NpcSystem\AI\HarvestingTurretIndustrialAI.cs" />
<Compile Include="Zones\NpcSystem\AI\HomingAI.cs" />
<Compile Include="Zones\NpcSystem\AI\IdleAI.cs" />
<Compile Include="Zones\NpcSystem\AI\InactiveAI.cs" />
Expand All @@ -700,13 +699,11 @@
<Compile Include="Zones\NpcSystem\AI\SentryTurretIdleAI.cs" />
<Compile Include="Zones\NpcSystem\AI\StationaryCombatAI.cs" />
<Compile Include="Zones\NpcSystem\AI\StationaryIdleAI.cs" />
<Compile Include="Zones\NpcSystem\AI\StationaryIndustrialAI.cs" />
<Compile Include="Zones\NpcSystem\AI\TurretAI.cs" />
<Compile Include="Zones\NpcSystem\Flocks\ISmartCreatureGroup.cs" />
<Compile Include="Zones\NpcSystem\IndustrialTargetsManagement\IIndustrialValueManager.cs" />
<Compile Include="Zones\NpcSystem\IndustrialTargetsManagement\IndustrialTarget.cs" />
<Compile Include="Zones\NpcSystem\IndustrialTargetsManagement\IndustrialValue.cs" />
<Compile Include="Zones\NpcSystem\IndustrialTargetsManagement\IndustrialValueExtensions.cs" />
<Compile Include="Zones\NpcSystem\IndustrialTargetsManagement\IndustrialValueManager.cs" />
<Compile Include="Zones\NpcSystem\IndustrialTargetsManagement\IndustrialValueType.cs" />
<Compile Include="Zones\NpcSystem\NpcBossInfoBuilder.cs" />
Expand Down
25 changes: 4 additions & 21 deletions src/Perpetuum/Zones/NpcSystem/AI/HarvestingIndustrialTurretAI.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
using System;

namespace Perpetuum.Zones.NpcSystem.AI
namespace Perpetuum.Zones.NpcSystem.AI
{
public class HarvestingIndustrialTurretAI : StationaryIndustrialAI
public class HarvestingIndustrialTurretAI : IndustrialAI
{
public HarvestingIndustrialTurretAI(SmartCreature smartCreature) : base(smartCreature) { }

public override void Update(TimeSpan time)
public HarvestingIndustrialTurretAI(SmartCreature smartCreature) : base(smartCreature)
{
FindIndustrialTargets(time);

base.Update(time);
}

public void FindIndustrialTargets(TimeSpan time)
{
UpdateFrequency.Update(time);

if (UpdateFrequency.Passed)
{
UpdateFrequency.Reset();
smartCreature.LookingForHarvestingTargets();
}
smartCreature.LookingForHarvestingTargets();
}
}
}
16 changes: 0 additions & 16 deletions src/Perpetuum/Zones/NpcSystem/AI/HarvestingTurretIndustrialAI.cs

This file was deleted.

Loading

0 comments on commit 220e239

Please sign in to comment.