Start moving creature properties out of records
This commit is contained in:
File diff suppressed because one or more lines are too long
+35
-29
@@ -1,36 +1,42 @@
|
||||
module Dodge.Corpse.Make where
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Data.Corpse
|
||||
import Control.Lens
|
||||
import ShapePicture
|
||||
import Shape
|
||||
import Geometry
|
||||
module Dodge.Corpse.Make (makeCorpse) where
|
||||
|
||||
makeCorpse :: CreatureCorpse -> Creature -> Corpse
|
||||
makeCorpse cc = case cc of
|
||||
MakeDefaultCorpse -> makeDefaultCorpse
|
||||
import Dodge.Creature.Shape
|
||||
import Control.Lens
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Data.Corpse
|
||||
import Dodge.Data.Creature
|
||||
import Geometry
|
||||
import Shape
|
||||
import ShapePicture
|
||||
|
||||
makeCorpse :: Creature -> Corpse
|
||||
makeCorpse = makeDefaultCorpse
|
||||
|
||||
makeDefaultCorpse :: Creature -> Corpse
|
||||
makeDefaultCorpse cr = defaultCorpse
|
||||
& cpPos .~ _crPos cr
|
||||
& cpDir .~ _crDir cr
|
||||
& cpSPic .~ noPic (scaleSH (V3 crsize crsize crsize) $ mconcat
|
||||
[ colorSH (_skinHead cskin) $ deadScalp cr
|
||||
, colorSH (_skinUpper cskin) $ deadUpperBody cr
|
||||
, rotmdir $ colorSH (_skinLower cskin) $ deadFeet cr
|
||||
]
|
||||
)
|
||||
where
|
||||
cskin = _crType cr -- this should be fixed
|
||||
makeDefaultCorpse cr =
|
||||
defaultCorpse
|
||||
& cpPos .~ _crPos cr
|
||||
& cpDir .~ _crDir cr
|
||||
& cpSPic
|
||||
.~ noPic
|
||||
( scaleSH (V3 crsize crsize crsize) $
|
||||
mconcat
|
||||
[ colorSH (_skinHead cskin) $ deadScalp cr
|
||||
, colorSH (_skinUpper cskin) $ deadUpperBody cr
|
||||
, rotmdir $ colorSH (_skinLower cskin) $ deadFeet cr
|
||||
]
|
||||
)
|
||||
where
|
||||
cskin = crShape $ _crType cr -- this should be fixed
|
||||
crsize = 0.1 * _crRad cr
|
||||
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
|
||||
|
||||
defaultCorpse :: Corpse
|
||||
defaultCorpse = Corpse
|
||||
{ _cpID = 0
|
||||
, _cpPos = 0
|
||||
, _cpDir = 0
|
||||
, _cpSPic = mempty
|
||||
, _cpRes = NoResurrection
|
||||
}
|
||||
defaultCorpse =
|
||||
Corpse
|
||||
{ _cpID = 0
|
||||
, _cpPos = 0
|
||||
, _cpDir = 0
|
||||
, _cpSPic = mempty
|
||||
, _cpRes = NoResurrection
|
||||
}
|
||||
|
||||
+8
-11
@@ -58,28 +58,28 @@ spawnerCrit =
|
||||
defaultCreature
|
||||
& crHP .~ 300
|
||||
& crInv .~ IM.empty
|
||||
& crType . skinUpper .~ lightx4 blue
|
||||
-- & crType . skinUpper .~ lightx4 blue
|
||||
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit =
|
||||
defaultCreature
|
||||
& crInv .~ IM.fromList [(0, miniGunX 3)]
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
& crType . humanoidAI .~ MiniGunAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ MiniGunAI
|
||||
|
||||
longCrit :: Creature
|
||||
longCrit =
|
||||
defaultCreature
|
||||
& crInv .~ IM.fromList [(0, sniperRifle)]
|
||||
& crType . humanoidAI .~ LongAI
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ LongAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
|
||||
multGunCrit :: Creature
|
||||
multGunCrit =
|
||||
defaultCreature
|
||||
& crInv .~ IM.fromList [(0, volleyGun 4)]
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
& crType . humanoidAI .~ MultGunAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ MultGunAI
|
||||
|
||||
addArmour :: Creature -> Creature
|
||||
addArmour = over crInv insarmour
|
||||
@@ -100,12 +100,9 @@ startCr =
|
||||
& crHP .~ 10000
|
||||
& crMaxHP .~ 15000
|
||||
& crInv .~ startInventory
|
||||
& crCorpse .~ MakeDefaultCorpse
|
||||
& crFaction .~ PlayerFaction
|
||||
& crMvType .~ MvWalking yourDefaultSpeed
|
||||
& crType . skinUpper .~ lightx4 black
|
||||
& crType .~ Avatar
|
||||
(greyN 0.9) (lightx4 green) (greyN 0.3) (PulseStatus 55 0)
|
||||
& crType .~ Avatar (PulseStatus 55 0)
|
||||
|
||||
-- | Items you start with.
|
||||
startInvList :: [Item]
|
||||
|
||||
@@ -32,7 +32,7 @@ flockArmourChaseCrit =
|
||||
, _crGroup = ShieldGroup
|
||||
, _crMvType = defaultChaseMvType
|
||||
}
|
||||
& crType . humanoidAI .~ FlockArmourChaseAI
|
||||
-- & crType . humanoidAI .~ FlockArmourChaseAI
|
||||
|
||||
armourChaseCrit :: Creature
|
||||
armourChaseCrit =
|
||||
|
||||
@@ -3,11 +3,11 @@ module Dodge.Creature.AutoCrit (
|
||||
) where
|
||||
|
||||
import Dodge.Item.Held.Cane
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Default
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
--import Picture
|
||||
|
||||
autoCrit :: Creature
|
||||
autoCrit =
|
||||
@@ -17,5 +17,5 @@ autoCrit =
|
||||
, _crHP = 300
|
||||
, _crMvType = defaultAimMvType
|
||||
}
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
& crType . humanoidAI .~ AutoAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ AutoAI
|
||||
|
||||
@@ -18,7 +18,7 @@ smallChaseCrit =
|
||||
{ _crHP = 1
|
||||
, _crRad = 4
|
||||
, _crInv = mempty
|
||||
, _crCorpse = MakeDefaultCorpse
|
||||
-- , _crCorpse = MakeDefaultCorpse
|
||||
}
|
||||
|
||||
invisibleChaseCrit :: Creature
|
||||
@@ -39,7 +39,7 @@ chaseCrit =
|
||||
, _crVocalization = chaseCritVocalization
|
||||
, _crMvType = defaultChaseMvType
|
||||
}
|
||||
& crType . humanoidAI .~ ChaseAI
|
||||
-- & crType . humanoidAI .~ ChaseAI
|
||||
|
||||
chaseCritVocalization :: Vocalization
|
||||
chaseCritVocalization =
|
||||
|
||||
@@ -63,9 +63,7 @@ useItemLoc cr loc pt w
|
||||
ldt = loc ^. locLDT
|
||||
itm = ldt ^. ldtValue . _1
|
||||
|
||||
useLocation ::
|
||||
LocationLDT ItemLink ComposedItem ->
|
||||
LocationLDT ItemLink ComposedItem
|
||||
useLocation :: LocationLDT ItemLink ComposedItem -> LocationLDT ItemLink ComposedItem
|
||||
useLocation loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itType . ibtEquip = loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0 =
|
||||
|
||||
@@ -18,7 +18,7 @@ barrel :: Creature
|
||||
barrel =
|
||||
defaultInanimate
|
||||
{ _crHP = 500
|
||||
, _crType = Barreloid PlainBarrel
|
||||
, _crType = BarrelCrit PlainBarrel
|
||||
, _crState =
|
||||
defaultState
|
||||
{ _csSpState = Barrel []
|
||||
@@ -30,7 +30,7 @@ explosiveBarrel :: Creature
|
||||
explosiveBarrel =
|
||||
defaultInanimate
|
||||
{ _crHP = 400
|
||||
, _crType = Barreloid ExplosiveBarrel
|
||||
, _crType = BarrelCrit ExplosiveBarrel
|
||||
, _crState =
|
||||
defaultState
|
||||
{ _csSpState = Barrel []
|
||||
|
||||
@@ -14,7 +14,7 @@ colorLamp ::
|
||||
colorLamp col h =
|
||||
defaultInanimate
|
||||
{ _crHP = 100
|
||||
, _crType = Lampoid h col Nothing
|
||||
, _crType = LampCrit h col Nothing
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ module Dodge.Creature.LauncherCrit (
|
||||
) where
|
||||
|
||||
import Dodge.Item.Held.Launcher
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Default
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
--import Picture
|
||||
|
||||
launcherCrit :: Creature
|
||||
launcherCrit =
|
||||
@@ -17,5 +17,5 @@ launcherCrit =
|
||||
, _crState = defaultState
|
||||
, _crHP = 300
|
||||
}
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
& crType . humanoidAI .~ LauncherAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ LauncherAI
|
||||
|
||||
@@ -2,12 +2,12 @@ module Dodge.Creature.LtAutoCrit (
|
||||
ltAutoCrit,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Default
|
||||
import Dodge.Item.Held.Stick
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
--import Picture
|
||||
|
||||
ltAutoCrit :: Creature
|
||||
ltAutoCrit =
|
||||
@@ -16,5 +16,6 @@ ltAutoCrit =
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
}
|
||||
& crType . humanoidAI .~ LtAutoAI
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
-- & crType .~ LtAutoCrit
|
||||
-- & crType . humanoidAI .~ LtAutoAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -9,6 +9,7 @@ module Dodge.Creature.Picture (
|
||||
deadFeet,
|
||||
) where
|
||||
|
||||
import Dodge.Creature.Shape
|
||||
import Control.Lens
|
||||
import Dodge.Creature.HandPos (translateToLeftHand, translateToRightHand)
|
||||
import Dodge.Creature.Test
|
||||
@@ -44,7 +45,7 @@ basicCrShape cr
|
||||
, rotmdir $ colorSH (_skinLower cskin) $ feet cr
|
||||
]
|
||||
where
|
||||
cskin = _crType cr
|
||||
cskin = crShape $ _crType cr
|
||||
crsize = 0.1 * _crRad cr
|
||||
tr = uncurryV translateSHxy (_crPos cr)
|
||||
rotdir = rotateSH (_crDir cr)
|
||||
|
||||
@@ -2,12 +2,12 @@ module Dodge.Creature.PistolCrit (
|
||||
pistolCrit,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Default
|
||||
import Dodge.Item.Held.Stick
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
--import Picture
|
||||
|
||||
pistolCrit :: Creature
|
||||
pistolCrit =
|
||||
@@ -16,5 +16,5 @@ pistolCrit =
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
}
|
||||
& crType . humanoidAI .~ PistolAI
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ PistolAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -2,12 +2,12 @@ module Dodge.Creature.SpreadGunCrit (
|
||||
spreadGunCrit,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Default
|
||||
import Dodge.Item.Held.Stick
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
--import Picture
|
||||
|
||||
spreadGunCrit :: Creature
|
||||
spreadGunCrit =
|
||||
@@ -16,5 +16,5 @@ spreadGunCrit =
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
}
|
||||
& crType . humanoidAI .~ SpreadGunAI
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
-- & crType . humanoidAI .~ SpreadGunAI
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -100,8 +100,8 @@ checkDeath cr w
|
||||
where
|
||||
removecr
|
||||
| _crID cr == 0 =
|
||||
(cWorld . lWorld . creatures . ix (_crID cr) . crType .~ NonDrawnCreature)
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ 0)
|
||||
-- (cWorld . lWorld . creatures . ix (_crID cr) . crType .~ NonDrawnCreature)
|
||||
(cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ 0)
|
||||
-- hack to get around player creature being killed but left with more than 0 hp
|
||||
| otherwise = cWorld . lWorld . creatures . at (_crID cr) .~ Nothing
|
||||
|
||||
@@ -114,7 +114,7 @@ corpseOrGib cr = case cr ^? crState . csDamage . to maxDamageType . _Just . _1 o
|
||||
_ | _crPastDamage cr > 200 -> addCrGibs cr
|
||||
_ -> plNew (cWorld . lWorld . corpses) cpID thecorpse
|
||||
where
|
||||
thecorpse = makeDefaultCorpse cr
|
||||
thecorpse = makeCorpse cr
|
||||
|
||||
scorchSPic :: SPic -> SPic
|
||||
scorchSPic = _1 %~ overColSH (mixColors 0.9 0.1 black . normalizeColor)
|
||||
@@ -190,7 +190,7 @@ invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
|
||||
|
||||
doAnyEquipmentEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
||||
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
|
||||
Just _ -> useE loc cr
|
||||
Just _ -> equipBackgroundEffect loc cr
|
||||
_ -> id
|
||||
where
|
||||
itm = loc ^. locLDT . ldtValue . _1
|
||||
|
||||
@@ -13,12 +13,13 @@ swarmCrit =
|
||||
{ _crHP = 1
|
||||
, _crRad = 2
|
||||
, _crMass = 2
|
||||
, _crCorpse = MakeDefaultCorpse
|
||||
-- , _crCorpse = MakeDefaultCorpse
|
||||
, _crFaction = ColorFaction yellow
|
||||
, _crMeleeCooldown = 0
|
||||
}
|
||||
& crType . skinUpper .~ lightx4 yellow
|
||||
& crType . humanoidAI .~ SwarmAI
|
||||
& crType .~ SwarmCrit
|
||||
-- & crType . skinUpper .~ lightx4 yellow
|
||||
-- & crType . humanoidAI .~ SwarmAI
|
||||
|
||||
--swarmCritMoveFunc :: Creature -> Point2 -> Creature -> Point2
|
||||
--swarmCritMoveFunc tcr cenp cr
|
||||
|
||||
@@ -14,10 +14,10 @@ updateCreature :: Creature -> World -> World
|
||||
updateCreature cr = case _crType cr of
|
||||
Avatar{} -> (cWorld . lWorld . creatures . ix 0 . crType . avatarPulse %~ updatePulse)
|
||||
. crUpdate yourControl cr
|
||||
Lampoid{} -> updateLampoid cr
|
||||
Humanoid{} -> updateHumanoid cr
|
||||
Barreloid{} -> updateBarreloid cr
|
||||
NonDrawnCreature -> id
|
||||
LampCrit{} -> updateLampoid cr
|
||||
BarrelCrit{} -> updateBarreloid cr
|
||||
AvatarDead -> id
|
||||
_ -> updateHumanoid cr
|
||||
|
||||
updatePulse :: Pulse -> Pulse
|
||||
updatePulse PulseStatus {_pulseRate = pr, _pulseProgress = pp}
|
||||
|
||||
+13
-11
@@ -1,12 +1,12 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Bullet
|
||||
( module Dodge.Data.Bullet
|
||||
, module Dodge.Data.Damage
|
||||
)where
|
||||
module Dodge.Data.Bullet (
|
||||
module Dodge.Data.Bullet,
|
||||
module Dodge.Data.Damage,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -17,18 +17,20 @@ import Geometry.Data
|
||||
data Bullet = Bullet
|
||||
{ _buEffect :: BulletEffect
|
||||
, _buPayload :: BulletPayload
|
||||
-- , _buTrajectory :: BulletTrajectory
|
||||
, _buVel :: Point2
|
||||
, -- , _buTrajectory :: BulletTrajectory
|
||||
_buVel :: Point2
|
||||
, _buDrag :: Float
|
||||
, _buPos :: Point2
|
||||
, _buOldPos :: Point2
|
||||
, _buWidth :: Float
|
||||
-- , _buTimer :: Int
|
||||
, _buDamages :: [Damage]
|
||||
}
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
data EnergyBallType = IncBall | TeslaBall | ConcBall
|
||||
data EnergyBallType
|
||||
= IncBall
|
||||
| TeslaBall
|
||||
| ConcBall
|
||||
| FlashBall
|
||||
deriving (Show, Eq, Ord, Enum, Bounded, Read) --Generic, Flat)
|
||||
|
||||
@@ -38,8 +40,8 @@ data BulletEffect
|
||||
| PenetrateBullet
|
||||
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
|
||||
|
||||
data BulletPayload
|
||||
= BulBall {_spawnEBT :: EnergyBallType}
|
||||
data BulletPayload
|
||||
= BulBall {_spawnEBT :: EnergyBallType}
|
||||
| BulSpark
|
||||
| BulFlak
|
||||
| BulFrag
|
||||
|
||||
@@ -36,10 +36,8 @@ data Creature = Creature
|
||||
{ _crPos :: Point2
|
||||
, _crOldPos :: Point2
|
||||
, _crDir :: Float
|
||||
, _crOldDir :: Float
|
||||
, _crMvDir :: Float
|
||||
, _crMvAim :: Float
|
||||
-- , _crTwist :: Float
|
||||
, _crType :: CreatureType
|
||||
, _crID :: Int
|
||||
, _crRad :: Float
|
||||
@@ -52,7 +50,6 @@ data Creature = Creature
|
||||
, _crInvLock :: Bool
|
||||
, _crEquipment :: M.Map EquipSite Int
|
||||
, _crState :: CreatureState
|
||||
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
||||
, _crMaterial :: Material
|
||||
, _crPastDamage :: Int
|
||||
, _crStance :: Stance
|
||||
@@ -70,8 +67,6 @@ data Creature = Creature
|
||||
, _crDeathTimer :: Int
|
||||
}
|
||||
|
||||
data CreatureCorpse = MakeDefaultCorpse
|
||||
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data Intention = Intention
|
||||
@@ -88,7 +83,6 @@ makeLenses ''Intention
|
||||
concat
|
||||
<$> mapM
|
||||
(deriveJSON defaultOptions)
|
||||
[ ''CreatureCorpse
|
||||
, ''Creature
|
||||
[ ''Creature
|
||||
, ''Intention
|
||||
]
|
||||
|
||||
@@ -68,19 +68,26 @@ data Pulse = PulseStatus
|
||||
|
||||
data CreatureType
|
||||
= Avatar
|
||||
{ _skinHead :: Color
|
||||
, _skinUpper :: Color
|
||||
, _skinLower :: Color
|
||||
, _avatarPulse :: Pulse
|
||||
-- { _skinHead :: Color
|
||||
-- , _skinUpper :: Color
|
||||
-- , _skinLower :: Color
|
||||
{ _avatarPulse :: Pulse
|
||||
}
|
||||
| Humanoid
|
||||
| AvatarDead
|
||||
| ChaseCrit
|
||||
| SwarmCrit
|
||||
| AutoCrit
|
||||
| BarrelCrit{_barrelType :: BarrelType}
|
||||
| LampCrit {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
|
||||
|
||||
data CreatureShape
|
||||
= Humanoid
|
||||
{ _skinHead :: Color
|
||||
, _skinUpper :: Color
|
||||
, _skinLower :: Color
|
||||
, _humanoidAI :: HumanoidAI
|
||||
}
|
||||
| Barreloid {_barrelType :: BarrelType}
|
||||
| Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
|
||||
| Barreloid
|
||||
| NonDrawnCreature
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ data Item = Item
|
||||
, _itType :: ItemType
|
||||
, _itID :: NewInt ItmInt
|
||||
, _itLocation :: ItemLocation
|
||||
-- , _itEffect :: ItEffect
|
||||
, _itTargeting :: ItemTargeting
|
||||
, _itParams :: ItemParams
|
||||
, _itScroll :: ItemScroll
|
||||
|
||||
@@ -10,8 +10,10 @@ module Dodge.Data.Item.Use (
|
||||
module Dodge.Data.GenFloat,
|
||||
module Dodge.Data.Item.Scope,
|
||||
module Dodge.Data.Item.BulletMod,
|
||||
module Dodge.Data.Payload
|
||||
) where
|
||||
|
||||
import Dodge.Data.Payload
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
|
||||
@@ -1,26 +1,12 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.Use.Consumption.Ammo (
|
||||
module Dodge.Data.Item.Use.Consumption.Ammo,
|
||||
module Dodge.Data.Bullet,
|
||||
module Dodge.Data.Payload,
|
||||
-- module Dodge.Data.Payload,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Bullet
|
||||
import Dodge.Data.Payload
|
||||
|
||||
data ProjectileUpdate
|
||||
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
|
||||
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
|
||||
data ForceFieldType = DefaultForceField
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
@@ -30,11 +16,3 @@ data GasFuel = ChemFuel
|
||||
|
||||
data GasCreate = CreatePoisonGas | CreateFlame
|
||||
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
|
||||
|
||||
makeLenses ''ProjectileUpdate
|
||||
--makeLenses ''AmmoType
|
||||
deriveJSON defaultOptions ''GasFuel
|
||||
deriveJSON defaultOptions ''ProjectileUpdate
|
||||
deriveJSON defaultOptions ''GasCreate
|
||||
deriveJSON defaultOptions ''ForceFieldType
|
||||
--deriveJSON defaultOptions ''AmmoType
|
||||
|
||||
@@ -1,56 +1,59 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Projectile where
|
||||
|
||||
import Dodge.Data.Wall.Structure
|
||||
import Dodge.Data.Item.Location
|
||||
import NewInt
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||
import Dodge.Data.Item.Location
|
||||
import Dodge.Data.Wall.Structure
|
||||
import Geometry.Data
|
||||
import NewInt
|
||||
import Dodge.Data.Payload
|
||||
|
||||
data Projectile
|
||||
= Shell
|
||||
{ _pjPos :: Point2
|
||||
, _pjVel :: Point2
|
||||
, _pjDir :: Float
|
||||
, _pjSpin :: Float
|
||||
, _pjSpinFactor :: Float
|
||||
, _pjID :: Int
|
||||
, _pjPayload :: Payload
|
||||
, _pjTimer :: Int
|
||||
, _pjZ :: Float
|
||||
, _pjZVel :: Float
|
||||
, _pjUpdates :: [ProjectileUpdate]
|
||||
, _pjType :: ProjectileType
|
||||
, _pjDetonatorID :: Maybe (NewInt ItmInt)
|
||||
, _pjScreenID :: Maybe (NewInt ItmInt)
|
||||
}
|
||||
data Projectile = Shell
|
||||
{ _pjPos :: Point2
|
||||
, _pjVel :: Point2
|
||||
, _pjDir :: Float
|
||||
, _pjSpin :: Float
|
||||
, _pjSpinFactor :: Float
|
||||
, _pjID :: Int
|
||||
, _pjPayload :: Payload
|
||||
, _pjTimer :: Int
|
||||
, _pjZ :: Float
|
||||
, _pjZVel :: Float
|
||||
, _pjUpdates :: [ProjectileUpdate]
|
||||
, _pjType :: ProjectileType
|
||||
, _pjDetonatorID :: Maybe (NewInt ItmInt)
|
||||
, _pjScreenID :: Maybe (NewInt ItmInt)
|
||||
}
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data ProjectileUpdate
|
||||
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
|
||||
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
data ProjectileType
|
||||
= Grenade
|
||||
{ _gnHitEffect :: GrenadeHitEffect
|
||||
}
|
||||
| Rocket
|
||||
{_rkHoming :: RocketHoming
|
||||
,_rkSmoke :: Maybe RocketSmoke
|
||||
= Grenade { _gnHitEffect :: GrenadeHitEffect }
|
||||
| Rocket
|
||||
{ _rkHoming :: RocketHoming
|
||||
, _rkSmoke :: Maybe RocketSmoke
|
||||
}
|
||||
| RetiredProjectile
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data RocketHoming
|
||||
= NoHoming
|
||||
data RocketHoming
|
||||
= NoHoming
|
||||
| HomeUsingRemoteScreen {_phRemoteID :: NewInt ItmInt}
|
||||
| HomeUsingTargeting {_phTargetingID :: NewInt ItmInt}
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
data GrenadeHitEffect
|
||||
data GrenadeHitEffect
|
||||
= GBounce {_bounceTolerance :: Float}
|
||||
| GStick
|
||||
| GStuckCreature {_stuckCrID :: Int, _stuckCrOffset :: Point2, _stuckCrRot :: Float}
|
||||
@@ -58,14 +61,15 @@ data GrenadeHitEffect
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
data RocketSmoke
|
||||
= ReducedRocketSmoke
|
||||
= ReducedRocketSmoke
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
|
||||
makeLenses ''ProjectileUpdate
|
||||
makeLenses ''Projectile
|
||||
makeLenses ''ProjectileType
|
||||
makeLenses ''RocketHoming
|
||||
makeLenses ''GrenadeHitEffect
|
||||
deriveJSON defaultOptions ''ProjectileUpdate
|
||||
deriveJSON defaultOptions ''GrenadeHitEffect
|
||||
deriveJSON defaultOptions ''RocketHoming
|
||||
deriveJSON defaultOptions ''RocketSmoke
|
||||
|
||||
@@ -6,7 +6,7 @@ import Dodge.Data.Creature
|
||||
import Dodge.Data.FloatFunction
|
||||
import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
--import Picture
|
||||
--import MaybeHelp
|
||||
|
||||
defaultCreature :: Creature
|
||||
@@ -15,12 +15,11 @@ defaultCreature =
|
||||
{ _crPos = V2 0 0
|
||||
, _crOldPos = V2 0 0
|
||||
, _crDir = 0
|
||||
, _crOldDir = 0
|
||||
, _crMvDir = 0
|
||||
, _crMvAim = 0
|
||||
-- , _crTwist = 0
|
||||
, _crID = 1
|
||||
, _crType = defaultCreatureSkin
|
||||
, _crType = ChaseCrit
|
||||
, _crRad = 10
|
||||
, _crMass = 10
|
||||
, _crHP = 100
|
||||
@@ -30,7 +29,7 @@ defaultCreature =
|
||||
, _crInvCapacity = 25
|
||||
, _crInvLock = False
|
||||
, _crState = defaultState
|
||||
, _crCorpse = MakeDefaultCorpse
|
||||
-- , _crCorpse = MakeDefaultCorpse
|
||||
, _crMaterial = Flesh
|
||||
, _crPastDamage = 0
|
||||
-- , _crInvEquipped = mempty
|
||||
@@ -58,8 +57,8 @@ defaultCreature =
|
||||
, _crDeathTimer = 0
|
||||
}
|
||||
|
||||
defaultCreatureSkin :: CreatureType
|
||||
defaultCreatureSkin = Humanoid (greyN 0.9) (lightx4 green) (greyN 0.3) InanimateAI
|
||||
--defaultCreatureSkin :: CreatureType
|
||||
--defaultCreatureSkin = Humanoid (greyN 0.9) (lightx4 green) (greyN 0.3) InanimateAI
|
||||
|
||||
defaultInanimate :: Creature
|
||||
defaultInanimate = defaultCreature & crActionPlan .~ Inanimate
|
||||
|
||||
+4
-51
@@ -1,27 +1,19 @@
|
||||
module Dodge.Euse (
|
||||
createShieldWall,
|
||||
removeShieldWall,
|
||||
useE,
|
||||
equipBackgroundEffect,
|
||||
) where
|
||||
|
||||
import Color
|
||||
import Dodge.Creature.HandPos
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
import Dodge.Data.Equipment.Misc
|
||||
import Dodge.Data.World
|
||||
import Dodge.Default.Wall
|
||||
import Dodge.Item.HeldOffset
|
||||
import Dodge.Item.Location
|
||||
import Dodge.Wall.Create
|
||||
import Dodge.Wall.Delete
|
||||
import Dodge.Wall.Move
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
useE :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
||||
useE loc cr = case eo of
|
||||
equipBackgroundEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
||||
equipBackgroundEffect loc cr = case eo of
|
||||
EQUIP (MAGSHIELD mt) -> useMagShield mt itm cr
|
||||
EQUIP WRISTARMOUR -> setWristShieldPos itm cr
|
||||
EQUIP HEADLAMP -> createHeadLamp itm cr
|
||||
@@ -36,8 +28,7 @@ useMagShield mt _ cr w =
|
||||
w & cWorld . lWorld . magnets
|
||||
.:~ Magnet
|
||||
{ _mgPos = _crPos cr
|
||||
, --, _mgField = MagnetBuBuCurveAroundField 50 200
|
||||
_mgField = mt
|
||||
, _mgField = mt
|
||||
}
|
||||
|
||||
setWristShieldPos :: Item -> Creature -> World -> World
|
||||
@@ -54,19 +45,6 @@ setWristShieldPos itm cr w = w & moveWallIDUnsafe i wlline
|
||||
| otherwise = id
|
||||
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
|
||||
|
||||
shieldWall :: Int -> Wall
|
||||
shieldWall crid =
|
||||
defaultWall
|
||||
{ _wlColor = yellow
|
||||
, _wlOpacity = SeeAbove
|
||||
, _wlPathable = True
|
||||
, _wlWalkable = True
|
||||
, _wlFireThrough = True
|
||||
, _wlReflect = True
|
||||
, _wlRotateTo = False
|
||||
, _wlStructure = CreaturePart crid -- shieldWallDamage
|
||||
}
|
||||
|
||||
-- TODO the reflection should be controled by the particle
|
||||
--shieldWallDamage :: Damage -> Wall -> Int -> World -> World
|
||||
--shieldWallDamage dm _ crid w = case _dmType dm of
|
||||
@@ -74,31 +52,6 @@ shieldWall crid =
|
||||
-- _ | isMovementDam dm -> w & creatures . ix crid . crState . crDamage .:~ dm
|
||||
-- _ -> w
|
||||
|
||||
createShieldWall :: Item -> Creature -> World -> World
|
||||
createShieldWall it cr w = case it ^? itParams . flatShieldWlMIX . _Just of
|
||||
Nothing ->
|
||||
let (wlid, w') = createWall ((shieldWall crid){_wlLine = wlline, _wlID = wlid}) w
|
||||
in w' & pointerToItem it . itParams .~ FlatShieldParams (Just wlid)
|
||||
Just wid -> moveWallID wid wlline w
|
||||
where
|
||||
crid = _crID cr
|
||||
wlline = (a, b)
|
||||
crdirv = unitVectorAtAngle $ _crDir cr
|
||||
crpos = _crPos cr
|
||||
rad = _crRad cr + 2
|
||||
a = crpos +.+ rad *.* crdirv -.- 10 *.* therot crdirv
|
||||
b = crpos +.+ rad *.* crdirv +.+ 10 *.* therot crdirv
|
||||
therot
|
||||
| crIsAiming cr = vNormal
|
||||
| otherwise = rotateV (twoFlatHRot cr) . vNormal
|
||||
|
||||
removeShieldWall :: Item -> Creature -> World -> World
|
||||
removeShieldWall it _ w = case it ^? itParams . flatShieldWlMIX . _Just of
|
||||
Nothing -> w
|
||||
Just wid ->
|
||||
w & deleteWallID wid
|
||||
& pointerToItem it . itParams . flatShieldWlMIX .~ Nothing
|
||||
|
||||
createHeadLamp :: Item -> Creature -> World -> World
|
||||
createHeadLamp _ cr =
|
||||
cWorld . lWorld . lights
|
||||
|
||||
+145
-144
@@ -11,8 +11,8 @@ import RandomHelp
|
||||
|
||||
|
||||
updateHumanoid :: Creature -> World -> World
|
||||
updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
ChaseAI ->
|
||||
updateHumanoid cr = case cr ^?! crType of
|
||||
ChaseCrit ->
|
||||
humanoidAIList
|
||||
[ const doStrategyActions
|
||||
, performActions
|
||||
@@ -27,151 +27,152 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
, const (crVocalization . vcCoolDown %~ max 0 . subtract 1)
|
||||
]
|
||||
cr
|
||||
SpreadGunAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
, DoActionThen
|
||||
(DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementSpreadGun)
|
||||
(DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
)
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(\cr' -> cr' & crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
PistolAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \w cr' ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon, chooseMovementPistol cr' w]
|
||||
)
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
LtAutoAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[
|
||||
( crHasTargetLOS
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
, DoActionThen
|
||||
(DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementLtAuto)
|
||||
(DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
)
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
LauncherAI ->
|
||||
defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFireLauncher])
|
||||
, (const crAwayFromPost, const goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
, const $
|
||||
overrideInternal
|
||||
(\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
(crActionPlan . apStrategy .~ WatchAndWait)
|
||||
]
|
||||
cr
|
||||
SwarmAI ->
|
||||
defaultImpulsive
|
||||
[ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi / 4) 3.9)
|
||||
, const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
, perceptionUpdate [0]
|
||||
, const doStrategyActions
|
||||
, targetYouWhenCognizant
|
||||
]
|
||||
cr
|
||||
AutoAI -> defaultImpulsive [sentinelAI] cr
|
||||
FlockArmourChaseAI ->
|
||||
defaultImpulsive
|
||||
[ watchUpdateStrat []
|
||||
, const doStrategyActions
|
||||
, performActions
|
||||
, targetYouWhenCognizant
|
||||
, setTargetMv (\_ -> _targetCr . _crIntention)
|
||||
, flockACC
|
||||
, perceptionUpdate [0]
|
||||
, goToTarget
|
||||
, const overrideMeleeCloseTarget
|
||||
, const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
]
|
||||
cr
|
||||
MiniGunAI -> defaultImpulsive [sentinelFireType (const shootTillEmpty)] cr
|
||||
LongAI -> defaultImpulsive [sentinelFireType $ const shootTillEmpty] cr
|
||||
MultGunAI ->
|
||||
defaultImpulsive
|
||||
[ sentinelExtraWatchUpdate
|
||||
[
|
||||
-- ( const $ not . crWeaponReady
|
||||
-- , \_ _ -> StrategyActions Reload reloadActions
|
||||
_ -> id
|
||||
-- SpreadGunAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [
|
||||
-- ( crHasTargetLOS
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
-- , DoActionThen
|
||||
-- (DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementSpreadGun)
|
||||
-- (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
-- ]
|
||||
-- )
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (\cr' -> cr' & crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- PistolAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [
|
||||
-- ( crHasTargetLOS
|
||||
-- , \w cr' ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon, chooseMovementPistol cr' w]
|
||||
-- )
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- LtAutoAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [
|
||||
-- ( crHasTargetLOS
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [ DoActionIf (WdCrNegate $ WdCrBlfromCrBl CrIsAiming) drawWeapon
|
||||
-- , DoActionThen
|
||||
-- (DoActionWhile WdCrLOSTarget $ ArbitraryAction ChooseMovementLtAuto)
|
||||
-- (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
-- ]
|
||||
-- )
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- LauncherAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ performActions
|
||||
-- , watchUpdateStrat
|
||||
-- [ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFireLauncher])
|
||||
-- , (const crAwayFromPost, const goToPostStrat)
|
||||
-- ]
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , const $
|
||||
-- overrideInternal
|
||||
-- (\cr' -> crHasTarget cr' && crStratConMatches (GetTo (V2 0 0)) cr')
|
||||
-- (crActionPlan . apStrategy .~ WatchAndWait)
|
||||
-- ]
|
||||
-- cr
|
||||
-- SwarmAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi / 4) 3.9)
|
||||
-- , const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
-- , perceptionUpdate [0]
|
||||
-- , const doStrategyActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- ]
|
||||
-- cr
|
||||
-- AutoAI -> defaultImpulsive [sentinelAI] cr
|
||||
-- FlockArmourChaseAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ watchUpdateStrat []
|
||||
-- , const doStrategyActions
|
||||
-- , performActions
|
||||
-- , targetYouWhenCognizant
|
||||
-- , setTargetMv (\_ -> _targetCr . _crIntention)
|
||||
-- , flockACC
|
||||
-- , perceptionUpdate [0]
|
||||
-- , goToTarget
|
||||
-- , const overrideMeleeCloseTarget
|
||||
-- , const (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
-- ]
|
||||
-- cr
|
||||
-- MiniGunAI -> defaultImpulsive [sentinelFireType (const shootTillEmpty)] cr
|
||||
-- LongAI -> defaultImpulsive [sentinelFireType $ const shootTillEmpty] cr
|
||||
-- MultGunAI ->
|
||||
-- defaultImpulsive
|
||||
-- [ sentinelExtraWatchUpdate
|
||||
-- [
|
||||
---- ( const $ not . crWeaponReady
|
||||
---- , \_ _ -> StrategyActions Reload reloadActions
|
||||
---- )
|
||||
---- ,
|
||||
-- ( const $ not . crSafeDistFromTarg 150
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- Flee
|
||||
-- [ WdCrNegate (WdCrSafeDistFromTarget 150) `DoActionWhile` UseSelf CrFleeFromTarget -- (fleeFrom cr')
|
||||
-- `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
|
||||
-- ]
|
||||
-- )
|
||||
-- ,
|
||||
( const $ not . crSafeDistFromTarg 150
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
Flee
|
||||
[ WdCrNegate (WdCrSafeDistFromTarget 150) `DoActionWhile` UseSelf CrFleeFromTarget -- (fleeFrom cr')
|
||||
`DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
|
||||
]
|
||||
)
|
||||
,
|
||||
( crHasTargetLOS
|
||||
, \_ _ ->
|
||||
StrategyActions
|
||||
(ShootAt 0)
|
||||
[drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]]
|
||||
)
|
||||
]
|
||||
]
|
||||
cr
|
||||
InanimateAI -> id
|
||||
-- ( crHasTargetLOS
|
||||
-- , \_ _ ->
|
||||
-- StrategyActions
|
||||
-- (ShootAt 0)
|
||||
-- [drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]]
|
||||
-- )
|
||||
-- ]
|
||||
-- ]
|
||||
-- cr
|
||||
-- InanimateAI -> id
|
||||
where
|
||||
drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
-- drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
-- reloadActions =
|
||||
-- [ holsterWeapon
|
||||
-- --, WaitThen 1 $ DoActionWhileInterrupt NoAction (WdCrBlfromCrBl CrIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
|
||||
@@ -91,7 +91,6 @@ copier x =
|
||||
& itType .~ COPIER x
|
||||
& itUse .~ UseValue (Left 0)
|
||||
& itScroll .~ ItemScrollInt 0
|
||||
-- & itEffect . ieInv .~ ItemCopierUpdate
|
||||
|
||||
nulgate :: Item
|
||||
nulgate =
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Prop.Gib (
|
||||
addCrGibs,
|
||||
) where
|
||||
|
||||
import Dodge.Creature.Shape
|
||||
import Color
|
||||
import Control.Monad
|
||||
import Data.Foldable
|
||||
@@ -42,7 +43,7 @@ addCrGibs cr = case damageDirection $ _csDamage $ _crState cr of
|
||||
. addGibsAtDir d 13 20 (_skinUpper skin) cpos
|
||||
. addGibAtDir d 25 (_skinHead skin) cpos
|
||||
where
|
||||
skin = _crType cr -- this should be cleaned up
|
||||
skin = crShape $ _crType cr -- this should be cleaned up
|
||||
cpos = _crPos cr
|
||||
|
||||
addGibsAt :: Float -> Float -> Color -> Point2 -> World -> World
|
||||
|
||||
@@ -38,9 +38,7 @@ worldSPic cfig u =
|
||||
|
||||
drawCreature :: Creature -> SPic
|
||||
drawCreature cr = case _crType cr of
|
||||
Avatar {} -> basicCrPict cr
|
||||
Humanoid{} -> basicCrPict cr
|
||||
Barreloid{} ->
|
||||
BarrelCrit{} ->
|
||||
picAtCrPos1
|
||||
( setDepth 20 $
|
||||
fold
|
||||
@@ -50,8 +48,9 @@ drawCreature cr = case _crType cr of
|
||||
]
|
||||
)
|
||||
cr
|
||||
Lampoid{_lampHeight = h} -> uncurryV translateSPxy (_crPos cr) $ lampCrSPic h
|
||||
NonDrawnCreature -> mempty
|
||||
LampCrit{_lampHeight = h} -> uncurryV translateSPxy (_crPos cr) $ lampCrSPic h
|
||||
_ -> basicCrPict cr
|
||||
-- NonDrawnCreature -> mempty
|
||||
|
||||
lampCrSPic :: Float -> SPic
|
||||
lampCrSPic h =
|
||||
|
||||
@@ -466,7 +466,6 @@ setOldPos :: Creature -> Creature
|
||||
setOldPos cr =
|
||||
cr
|
||||
& crOldPos .~ _crPos cr
|
||||
& crOldDir .~ _crDir cr
|
||||
|
||||
-- hack
|
||||
--updateRandGen :: World -> World
|
||||
|
||||
Reference in New Issue
Block a user