Preserve declared Eve control payloads
This commit is contained in:
parent
3ede0799ab
commit
7f9b5f63ed
3 changed files with 30 additions and 6 deletions
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue