Preserve declared Eve control payloads

This commit is contained in:
Meta Vens 2026-08-19 05:30:30 +02:00
commit 7f9b5f63ed
3 changed files with 30 additions and 6 deletions

View file

@ -1400,8 +1400,8 @@ export function createInventoryDropIntent(
const targetIndex = numberProp(target.targetIndex, -1);
const targetKind = firstString(target.targetKind, "");
const payload: Record<string, unknown> = {};
copyInventoryPayloadProps(source, payload);
copyInventoryPayloadProps(target, payload);
copyPayloadProps(source, payload);
copyPayloadProps(target, payload);
Object.assign(payload, {
sourceKind,
originEntityKey: firstString(source.sourceEntityKey, source.entityKey, ""),
@ -1490,7 +1490,7 @@ function parseInventoryCells(value: unknown): InventoryPlacementCell[] {
});
}
function copyInventoryPayloadProps(source: Record<string, unknown>, payload: Record<string, unknown>): void {
function copyPayloadProps(source: Record<string, unknown>, payload: Record<string, unknown>): void {
for (const [key, value] of Object.entries(source)) {
if (key.startsWith("payload.") && key.length > "payload.".length)
payload[key.slice("payload.".length)] = value;
@ -1870,6 +1870,8 @@ export function createEveCommandIntent(
const worldInteraction = resolveAdvertisedWorldInteraction(options, surfaceId);
const commandBoundary = firstString(worldInteraction.commandBoundary, props.commandBoundary, action.commandBoundary, action.target);
const receiptSchema = firstString(worldInteraction.receiptSchema, props.receiptSchema, action.receiptSchema);
const declaredPayload: Record<string, unknown> = {};
copyPayloadProps(props, declaredPayload);
const intent: EveCommandIntent = {
type: "surface-command",
schema: "gamecult.eve.command_invocation.v1",
@ -1877,6 +1879,7 @@ export function createEveCommandIntent(
surfaceId,
command: commandId || stringProp(action.type, "invoke"),
payload: {
...declaredPayload,
...action,
transport: props.transport ?? null,
},