using System;
using System.Collections.Generic;
using System.Drawing;
-
+using System.Text;
using Vintagestory.API.Client;
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
public static BlockDesignator Translocators =
new BlockDesignator(
new AssetLocation("game", "statictranslocator-normal"),
- Color.Violet,
- EnumBlockMaterial.Metal
- //DecodeTranslocator
+ Color.SteelBlue,
+ EnumBlockMaterial.Metal,
+ DecodeTranslocator
);
public static EntityDesignator Traders =
KeepTrackOfMerchant
);
-
+ /// <summary>
+ /// Not just blocks, but block-entities as well!
+ /// </summary>
+ /// <returns>The block designators.</returns>
public static List<BlockDesignator> DefaultBlockDesignators( )
{
return new List<BlockDesignator>{
DefaultDesignators.GroundSigns,
DefaultDesignators.WallSigns,
DefaultDesignators.PostSigns,
+ DefaultDesignators.Translocators,
};
}
}
poi.Upsert(entity, message);
}
+
+ internal static void DecodeTranslocator(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block)
+ {
+ clientAPI.Logger.VerboseDebug("TRANSLOCATOR Designator Invoked!");
+ //Where to? and from!
+
+ BlockEntityStaticTranslocator te = clientAPI.World.BlockAccessor.GetBlockEntity(posn) as BlockEntityStaticTranslocator;
+
+ if (te != null ) {
+
+ StringBuilder textTarget = new StringBuilder( );
+ //translocatorEntity.GetBlockInfo(clientAPI.World.Player, textTarget);
+
+ textTarget.Append(te.Activated ? "Online " : "offline ");
+ textTarget.Append(" Dest.: ");
+ textTarget.Append(te.TargetLocation != null ? te.TargetLocation.PrettyCoords(clientAPI) : "???");//Or ABS coords?
+
+ poi.AddReplace(
+ new PointOfInterest {
+ Location = posn.Copy( ),
+ Notes = textTarget.ToString(),
+ Timestamp = DateTimeOffset.UtcNow,
+ }
+ );
+
+ }
+ }
}
}