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 | nullimport { removeComponentCommand } from '@driftengine/tools';Parameters
| Parameter | Type | Description |
|---|---|---|
world | InspectableWorld | |
entities | readonly number[] | |
component | string |
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.