kts.DestroyCreature - destroy a creature, removing it from the map
kts.DestroyCreature(creature)
kts.DestroyCreature(creature, death_mode)
The given creature is destroyed and removed from the map.
If the creature was a knight, then any items they were carrying will be dropped at their current location.
Depending on the death_mode
, one of the following will happen:
death_mode
is "normal"
(or no death_mode
was given), the creature will leave behind a corpse, including blood. death_mode
is "poison"
, a corpse will be left behind but there will be no blood. death_mode
is "zombie"
, no corpse will be left behind. death_mode
is "pit"
, no corpse will be left behind, and also, any items will be dropped in the square behind the knight, instead of on the knight's square itself. This function does not return anything.
If the death_mode
is non-nil, but not one of the four predefined strings mentioned above, then an error is raised.
Also, if the creature
passed is non-nil, and not actually a Creature, then an error is raised. (If creature
is nil then there is no error and the function just does nothing.)
The reason that one of the death modes is called "zombie" is that this is the death mode that is used when a knight is turned into a zombie. In that case, we want to destroy the knight, without leaving any corpse behind, and spawn a zombie in its place. The death mode "zombie" will accomplish the first part of that.
The "pit" death mode is used when a knight falls down a pit. In this case we don't want the knight's items to be dropped on the pit square itself, as this would cause the items to be "floating" in mid air. Instead, the items are dropped one square behind the knight.