fix(kick_bomb): Add spawn kickbomb command to allow spawning from gameplay code without interfering with map hydration #968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
commands.add(KickBombCommand::spawn_kick_bomb(Some(entity), transform, kick_bomb_meta_handle)
may be used to spawn a kick bomb.handle.untyped()
to convert to this), it supportsHandle<ElementMeta>
orHandle<KickBombMeta>
automatically.This command adds a
KickBombHandle
containingHandle<KickBombMeta>
, this should be used to get meta for entities. The kick bomb systems now use this instead ofHandle<ElementMeta>
.Gameplay systems were also updated such that usages of components
MapElementHydrated
andDehydratedOutOfBounds
(things specific to map spawned kickbombs) are optionally used, meaning these systems still run for gameplay spawned kickbombs missing these components.Under the hood,
try_cast_meta_handle
helper function was added to help convert an untypedHandle<KickBombMeta>
orHandle<ElementMeta>
toHandle<KickBombMeta>
. This function is generic and may be used for other gameplay items that we refactor to add spawn commands to separate item spawn logic from map spawning.I tested this and the map spawned kickbombs will still respawn after use, but the gameplay spawned ones do not.