mirror of
https://github.com/swarm-game/swarm.git
synced 2024-09-11 14:46:33 +03:00
simplify infinite entity grabbing logic (#1737)
Refactoring towards #1598
This commit is contained in:
parent
9320a985e4
commit
d1a41de8ad
@ -1688,13 +1688,11 @@ execConst runChildProg c vs s k = do
|
||||
(omni || e `hasProperty` Pickable)
|
||||
`holdsOrFail` ["The", e ^. entityName, "here can't be", verbed <> "."]
|
||||
|
||||
-- Remove the entity from the world.
|
||||
updateEntityAt loc (const Nothing)
|
||||
flagRedraw
|
||||
|
||||
-- Immediately regenerate entities with 'infinite' property.
|
||||
when (e `hasProperty` Infinite) $
|
||||
updateEntityAt loc (const (Just e))
|
||||
-- Entities with 'infinite' property are not removed
|
||||
unless (e `hasProperty` Infinite) $ do
|
||||
-- Remove the entity from the world.
|
||||
updateEntityAt loc (const Nothing)
|
||||
flagRedraw
|
||||
|
||||
-- Possibly regrow the entity, if it is growable and the 'harvest'
|
||||
-- command was used.
|
||||
|
Loading…
Reference in New Issue
Block a user