25 lines
1.2 KiB
C#
25 lines
1.2 KiB
C#
using Vintagestory.API.Common;
|
|
using Vintagestory.API.MathTools;
|
|
|
|
namespace RoamingBees.Behaviors;
|
|
|
|
public class BlockBehaviorBeeSwarm(Block block) : BlockBehavior(block)
|
|
{
|
|
public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer)
|
|
{
|
|
if (!world.EntityDebugMode)
|
|
return base.GetPlacedBlockInfo(world, pos, forPlayer);
|
|
|
|
var entityBehavior = block.GetBEBehavior<BlockEntityBehaviorBeeSwarm>(pos);
|
|
if (entityBehavior is null)
|
|
return base.GetPlacedBlockInfo(world, pos, forPlayer);
|
|
|
|
var str = $"Active bees: {entityBehavior.ActiveBeesCount} (hover: {entityBehavior.ActiveHoveringCount}, travel: {entityBehavior.ActiveTravelingCount}, scout: {entityBehavior.ActiveScoutingCount})\n";
|
|
str += $"Target bees: hover {entityBehavior.TargetHoveringCount}, travel {entityBehavior.TargetTravelingCount}, scout {entityBehavior.TargetScoutingCount}\n";
|
|
str += $"State: {entityBehavior.SwarmState}\n";
|
|
str += $"Time since last spawn: {entityBehavior.TimeSinceLastSpawn:F1} | hover: {entityBehavior.TimeSinceLastHoverSpawn:F1}\n";
|
|
|
|
return base.GetPlacedBlockInfo(world, pos, forPlayer) + str;
|
|
}
|
|
}
|