commands.add(KickBombCommand::spawn_kick_bomb(Some(entity), transform, kick_bomb_meta_handle) may be used to spawn a kick bomb.
If entity is passed in it will initialize kick bomb components on this entity (mostly to support hydration from map elements), otherwise None will make it create an entity for you.
The handle is untyped handle (can use handle.untyped() to convert to this), it supports Handle<ElementMeta> or Handle<KickBombMeta> automatically.
This command adds a KickBombHandle containing Handle<KickBombMeta>, this should be used to get meta for entities. The kick bomb systems now use this instead of Handle<ElementMeta>.
Gameplay systems were also updated such that usages of components MapElementHydrated and DehydratedOutOfBounds (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 untyped Handle<KickBombMeta> or Handle<ElementMeta> to Handle<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.
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.