In-game tools · function

removeComponentCommand

Remove a component, keeping its values so undo can put them back.

Explained in In-game tools.

function removeComponentCommand(world: InspectableWorld, entities: readonly number[], component: string): Command | null
import { removeComponentCommand } from '@driftengine/tools';

Parameters

ParameterTypeDescription
worldInspectableWorld
entitiesreadonly number[]
componentstring

In depth

The values are read before the removal and written after the restore. A remove that only remembers "it was there" gives back a component full of zeroes, which reads as undo having worked and is the worse failure: nothing looks broken.