adjust candidate home text conditions in blockinfo
This commit is contained in:
@@ -29,7 +29,7 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
private BlockPos? targetPos;
|
||||
private bool targetIsVanillaSkep;
|
||||
private string? targetPopulatedSkepCode;
|
||||
private int eligibleTargetsAtLastSelection;
|
||||
private int? eligibleTargetsAtLastSelection;
|
||||
private List<SwarmTargetCandidate>? targetHiveCandidates;
|
||||
private long? candidateRefreshListenerId;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
if (api.Side != EnumAppSide.Server)
|
||||
return;
|
||||
|
||||
if (SwarmState == SwarmState.HangingOut)
|
||||
if (SwarmState is SwarmState.BuildingSwarm or SwarmState.HangingOut)
|
||||
StartCandidateRefresh();
|
||||
|
||||
FastForwardTo(api.World.Calendar.TotalHours, debugAsCatchUp: true);
|
||||
@@ -70,7 +70,6 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
targetPos = null;
|
||||
targetIsVanillaSkep = false;
|
||||
targetPopulatedSkepCode = null;
|
||||
eligibleTargetsAtLastSelection = 0;
|
||||
targetHiveCandidates = null;
|
||||
migrationStartPopulation = 0;
|
||||
transferredDuringMigration = 0;
|
||||
@@ -87,7 +86,7 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
|
||||
private void OnCandidateRefreshTick(float dt)
|
||||
{
|
||||
if (Api.Side != EnumAppSide.Server || SwarmState != SwarmState.HangingOut)
|
||||
if (Api.Side != EnumAppSide.Server)
|
||||
return;
|
||||
|
||||
targetHiveCandidates = FindEligibleTargets();
|
||||
@@ -470,8 +469,14 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
dsc.AppendLine(GetPhaseStatusLine());
|
||||
dsc.AppendLine(Lang.Get("orekiwoofsbeehives:beeswarm-info-population", Population.ToString("N0")));
|
||||
|
||||
if (SwarmState is SwarmState.MigratingToNewHive)
|
||||
return;
|
||||
|
||||
var eligibleTargets = targetHiveCandidates?.Count ?? eligibleTargetsAtLastSelection;
|
||||
dsc.AppendLine(Lang.Get("orekiwoofsbeehives:beeswarm-info-eligible-targets", eligibleTargets));
|
||||
|
||||
if (!eligibleTargets.HasValue)
|
||||
return;
|
||||
dsc.AppendLine(Lang.Get("orekiwoofsbeehives:beeswarm-info-eligible-targets", eligibleTargets.Value));
|
||||
}
|
||||
|
||||
private string GetPhaseStatusLine()
|
||||
@@ -589,7 +594,8 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
tree.SetInt("retryDay", retryDay);
|
||||
tree.SetBool("targetIsVanillaSkep", targetIsVanillaSkep);
|
||||
tree.SetString("targetPopulatedSkepCode", targetPopulatedSkepCode ?? string.Empty);
|
||||
tree.SetInt("eligibleTargetsAtLastSelection", eligibleTargetsAtLastSelection);
|
||||
if (eligibleTargetsAtLastSelection.HasValue)
|
||||
tree.SetInt("eligibleTargetsAtLastSelection", eligibleTargetsAtLastSelection.Value);
|
||||
|
||||
// for roamingbees
|
||||
tree.SetInt("roamingbees_swarm_state", (int)SwarmState);
|
||||
@@ -638,7 +644,9 @@ public class BlockEntityBeeSwarm : BlockEntity
|
||||
retryDay = tree.GetInt("retryDay");
|
||||
targetIsVanillaSkep = tree.GetBool("targetIsVanillaSkep");
|
||||
targetPopulatedSkepCode = tree.GetString("targetPopulatedSkepCode");
|
||||
eligibleTargetsAtLastSelection = tree.GetInt("eligibleTargetsAtLastSelection");
|
||||
eligibleTargetsAtLastSelection = tree.HasAttribute("eligibleTargetsAtLastSelection")
|
||||
? tree.GetInt("eligibleTargetsAtLastSelection")
|
||||
: null;
|
||||
|
||||
targetPos = tree.GetBlockPos("targetPos");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user