Reorganise weapons, start work on drones

This commit is contained in:
2021-11-22 00:37:27 +00:00
parent 1aa797ddef
commit 213f573011
19 changed files with 559 additions and 403 deletions
+41
View File
@@ -0,0 +1,41 @@
module Dodge.Item.Weapon.Spawn where
import Dodge.Data
import Dodge.Item.Weapon.TriggerType
--import Dodge.Item.Weapon.Remote
import Dodge.Default.Weapon
--import Dodge.Item.Weapon.Grenade
import Geometry
import qualified IntMapHelp as IM
import Data.Function
import Control.Lens
{- |
Creates a creature next to the creature using the item. -}
spawnGun :: Creature -> Item
spawnGun cr = defaultGun
{ _itName = "SPAWNER"
, _wpMaxAmmo = 1
, _wpLoadedAmmo = 1
, _wpReloadTime = 80
, _wpReloadState = 0
, _itUseRate = 100
, _itUse = \_ -> spawnCrNextTo cr
, _itUseModifiers =
[ ammoCheckI
, hammerCheckI
]
}
spawnCrNextTo
:: Creature -- ^ Creature to spawn
-> Creature -- ^ existing creature that will be spawned next to
-> World
-> World
spawnCrNextTo cr sCr w = w & creatures %~ IM.insert k newCr
where
k = IM.newKey $ _creatures w
newCr = cr
& crID .~ k
& crPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)
& crOldPos .~ _crPos sCr +.+ unitVectorAtAngle (_crDir sCr)