Skip to content

Add deferred resource commands - #357

Merged
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:resource-commands
Aug 17, 2026
Merged

Add deferred resource commands#357
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:resource-commands

Conversation

@waynemwashuma

@waynemwashuma waynemwashuma commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Objective

Introduces a command-based API for deferred resource operations for adding, removing, and aliasing resources.

Solution

Resource changes are now represented as commands and queued through the world's existing CommandQueue. The operations are applied when the command execution system processes the queue.

Changes Made

The following changes were introduced:

  • Added AddResourceCommand to add a resource.
  • Added RemoveResourceCommand to remove a resource.
  • Added SetResourceAliasCommand to assign a resource alias.
  • Added ResourceCommands as a higher-level API for queuing the three operations.

Why This Approach

This solution was chosen because:

  • Resource mutations can be deferred and executed through the existing command queue.
  • Resource operations follow the same command-based workflow used elsewhere in the core.
  • The implementation avoids directly mutating the world when the resource operation is requested.

Showcase

Before

Resource mutations had no dedicated command API for queuing resource additions, removals, or aliases.

After

Resource operations can be queued through ResourceCommands:

const commands = new ResourceCommands(world)

commands
  .add(resource)
  .remove(ResourceType)
  .setAlias(typeid(ResourceType), ResourceAlias)

The corresponding operations are then applied when the command queue is executed.

Migration Guide

No migration required.

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this Aug 17, 2026
@waynemwashuma waynemwashuma added the type:enhancement New feature or request label Aug 17, 2026
@waynemwashuma
waynemwashuma merged commit 8aaf611 into wimaengine:dev Aug 17, 2026
7 checks passed
@waynemwashuma
waynemwashuma deleted the resource-commands branch August 17, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:core type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant