Skip to content

Commit

Permalink
Fixed schematic builders to not stop when it does not have a required…
Browse files Browse the repository at this point in the history
… item in the stockpile

Fixed mana pipe not connecting to mana pump
  • Loading branch information
JBurlison committed Jul 8, 2019
1 parent 9355e95 commit dc22328
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
19 changes: 10 additions & 9 deletions Pandaros.Settlers/Pandaros.Settlers/Items/Energy/ManaPump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,17 @@ public class ManaPumpGenerate : CSGenerateType
ConnectedBlock = new ConnectedBlock()
{
BlockType = "ManaPipe",
Connections = new List<Models.BlockSide>()
AutoChange = false,
CalculationType = "Pipe",
Connections = new List<BlockSide>()
{
Models.BlockSide.Xn,
Models.BlockSide.Xp,
Models.BlockSide.Yn,
Models.BlockSide.Yp,
Models.BlockSide.Zn,
Models.BlockSide.Zp
},
AutoChange = false
BlockSide.Xn,
BlockSide.Xp,
BlockSide.Zn,
BlockSide.Zp,
BlockSide.Yn,
BlockSide.Yp
}
}
};
}
Expand Down
3 changes: 1 addition & 2 deletions Pandaros.Settlers/Pandaros.Settlers/Items/Energy/ManaTank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public class ManaTankObjective : IRoamingJobObjective

public void DoWork(Colony colony, RoamingJobState state)
{
if (!state.ActionEnergy.ContainsKey(GameLoader.NAMESPACE + ".ManaTankRefill"))
state.ActionEnergy.Add(GameLoader.NAMESPACE + ".ManaTankRefill", 0);
state.InitializeActionEnergy(GameLoader.NAMESPACE + ".ManaTankRefill", 0);

if (state.NextTimeForWork < Time.SecondsSinceStartDouble)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class PropulsionPlatform : CSType
TrainBounds = new SerializableVector3(3, 2, 3),
IdealHeightFromTrack = 3,
MoveTimePerBlockMs = 500,
ManaCostPerBlock = 0.005f
ManaCostPerBlock = 0.0001f
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class TrainStationObjective : IRoamingJobObjective

public void DoWork(Colony colony, RoamingJobState state)
{
if (!state.ActionEnergy.ContainsKey(GameLoader.NAMESPACE + ".ManaTankRefill"))
state.ActionEnergy.Add(GameLoader.NAMESPACE + ".ManaTankRefill", 0);
state.GetActionEnergy(GameLoader.NAMESPACE + ".ManaTankRefill");
state.GetActionEnergy(GameLoader.NAMESPACE + ".ManaMachineRepair");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ public void DoJob(IIterationType iterationType, IAreaJob areaJob, ConstructionJo
if (!ok && ownerStockPile.Contains(buildType.ItemIndex))
ok = true;

if (!ok && !string.IsNullOrWhiteSpace(buildType.ParentType))
if (!ok && !string.IsNullOrWhiteSpace(buildType.ParentType) && !buildType.ParentType.Contains("grass") && !buildType.ParentType.Contains("leaves"))
{
var parentType = ItemTypes.GetType(buildType.ParentType);
var parentType = ItemTypes.GetType(buildType.ParentType);
buildType = parentType;

if (ownerStockPile.Contains(parentType.ItemIndex))
{
ok = true;
buildType = parentType;
}
}

Expand Down Expand Up @@ -128,17 +128,24 @@ public void DoJob(IIterationType iterationType, IAreaJob areaJob, ConstructionJo
return;
}
}
else
{
if (!areaJob.Owner.Stockpile.Contains(buildType.ItemIndex) && buildType.ItemIndex != ColonyBuiltIn.ItemTypes.AIR.Id)
state.SetIndicator(new Shared.IndicatorState(5f, buildType.Name, true, false));

if (buildType.ItemIndex == ColonyBuiltIn.ItemTypes.AIR.Id)
continue;
else
return;
}
}
else
{
if (!_needsChunkLoaded.Contains(bpi))
_needsChunkLoaded.Add(bpi);

ChunkQueue.QueuePlayerSurrounding(iterationType.CurrentPosition);

if (areaJob.Owner.Stockpile.Contains(buildType.ItemIndex) && buildType.ItemIndex != ColonyBuiltIn.ItemTypes.AIR.Id)
state.SetIndicator(new Shared.IndicatorState(5f, buildType.Name));

state.SetIndicator(new Shared.IndicatorState(5f, ColonyBuiltIn.ItemTypes.ERRORIDLE.Name));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,19 @@ public void ResetActionToMaxLoad(string action)
SetActionEnergy(action, GetActionsMaxEnergy(action, Colony, RoamingJobSettings.ObjectiveCategory));
}

public float GetActionEnergy(string action)
public float InitializeActionEnergy(string action, float valueIfNotInitialized)
{
if (!ActionEnergy.ContainsKey(action))
ActionEnergy.Add(action, GetActionsMaxEnergy(action, Colony, RoamingJobSettings.ObjectiveCategory));
ActionEnergy.Add(action, valueIfNotInitialized);

return ActionEnergy[action];
}

public float GetActionEnergy(string action)
{
return InitializeActionEnergy(action, GetActionsMaxEnergy(action, Colony, RoamingJobSettings.ObjectiveCategory));
}

public void SetActionEnergy(string action, float value)
{
ActionEnergy[action] = value;
Expand Down

0 comments on commit dc22328

Please sign in to comment.