1 using Microsoft.Xna.Framework;
34 order?.GetChatMessage(targetCharacter?.Name,
36 givingOrderToSelf: targetCharacter == sender, orderOption: order.Option, isNewOrder: isNewOrder),
37 targetCharacter, sender, isNewOrder)
56 _ =>
throw new ArgumentException(
"Entity is not a character or item", nameof(entity))
62 msg.
WriteUInt16(targetCharacter ==
null ? (UInt16)0 : targetCharacter.
ID);
73 if (order.
Option != Identifier.Empty)
76 string[] dismissedOrder = order.
Option.Value.Split(
'.');
77 msg.
WriteByte((
byte)dismissedOrder.Length);
78 if (dismissedOrder.Length > 0)
80 Identifier dismissedOrderIdentifier = dismissedOrder[0].ToIdentifier();
83 if (dismissedOrder.Length > 1)
85 Identifier dismissedOrderOption = dismissedOrder[1].ToIdentifier();
86 msg.
WriteByte((
byte)orderPrefab.Options.IndexOf(dismissedOrderOption));
105 msg.
WriteUInt16(orderTarget.Hull ==
null ? (UInt16)0 : orderTarget.Hull.ID);
162 int? optionIndex =
null;
163 Identifier orderOption = Identifier.Empty;
166 if (orderIdentifier != Identifier.Empty)
169 if (!orderPrefab.IsDismissal)
176 int identifierCount = msg.
ReadByte();
177 if (identifierCount > 0)
181 if (dismissedOrderIdentifier != Identifier.Empty)
184 orderOption = dismissedOrderPrefab.
Identifier;
186 if (identifierCount > 1)
188 int dismissedOrderOptionIndex = msg.
ReadByte();
189 if (dismissedOrderPrefab !=
null)
191 var options = dismissedOrderPrefab.
Options;
192 if (options !=
null && dismissedOrderOptionIndex >= 0 && dismissedOrderOptionIndex < options.Length)
194 orderOption = $
"{orderOption.Value}.{options[dismissedOrderOptionIndex]}".ToIdentifier();
209 int? wallSectionIndex =
null;
216 orderTargetPosition =
new OrderTarget(
new Vector2(x, y), hull, creatingFromExistingData:
true);
224 return new OrderMessageInfo(orderIdentifier, orderOption, optionIndex, targetCharacter,
225 orderTargetType, targetEntity, orderTargetPosition, wallSectionIndex, orderPriority, isNewOrder);
const ushort NullEntityID
readonly ushort ID
Unique, but non-persistent identifier. Stays the same if the entities are created in the exactly same...
static Entity FindEntityByID(ushort ID)
Find an entity based on the ID
override string Name
Note that this is not a LocalizedString instance, just the current name of the item as a string....
readonly Character TargetCharacter
OrderChatMessage(Order order, string text, Character targetCharacter, Entity sender, bool isNewOrder=true)
static void WriteOrder(IWriteMessage msg, Order order, Entity targetCharacter, bool isNewOrder)
static OrderMessageInfo ReadOrder(IReadMessage msg)
ISpatialEntity TargetEntity
int? WallSectionIndex
Used when the order targets a wall
OrderChatMessage(Order order, Character targetCharacter, Character sender, bool isNewOrder=true)
Same as calling OrderChatMessage.OrderChatMessage(Order, string, int, string, ISpatialEntity,...
static string NameFromEntityOrNull(Entity entity)
readonly Entity TargetEntity
ISpatialEntity??? TargetSpatialEntity
Note this property doesn't return the follow target of the Follow objective, as expected!
ref readonly ImmutableArray< Identifier > Options
readonly? int WallSectionIndex
readonly Identifier Option
readonly int ManualPriority
readonly OrderPrefab Prefab
readonly OrderTargetType TargetType
static readonly PrefabCollection< OrderPrefab > Prefabs
readonly ImmutableArray< Identifier > Options
readonly Identifier Identifier
Identifier ReadIdentifier()
void WriteBoolean(bool val)
void WriteUInt16(UInt16 val)
void WriteIdentifier(Identifier val)
void WriteSingle(Single val)
Order.OrderTargetType TargetType
Identifier OrderIdentifier
Character TargetCharacter
OrderTarget TargetPosition
OrderMessageInfo(Identifier orderIdentifier, Identifier orderOption, int? orderOptionIndex, Character targetCharacter, Order.OrderTargetType targetType, Entity targetEntity, OrderTarget targetPosition, int? wallSectionIndex, int orderPriority, bool isNewOrder)