Cleanup
This commit is contained in:
@@ -68,7 +68,7 @@ spawnerCrit = defaultCreature
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $
|
||||
sentinelFireType (const shootTillEmpty)
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
@@ -89,7 +89,7 @@ longCrit :: Creature
|
||||
longCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
-- , _crUpdate = stateUpdate sniperAI
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ sentinelFireType $ const shootTillEmpty
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ sentinelFireType $ const shootTillEmpty
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
@@ -109,7 +109,7 @@ multGunCrit = defaultCreature
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
, _crHP = 300
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ sentinelExtraWatchUpdate
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ sentinelExtraWatchUpdate
|
||||
[ ( not . crHasAmmo
|
||||
, \_ _ -> StrategyActions Reload reloadActions
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import Control.Lens
|
||||
|
||||
armourChaseCrit :: Creature
|
||||
armourChaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
{ _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[ Left $ watchUpdateStrat []
|
||||
, Right doStrategyActions
|
||||
, Left performActions
|
||||
|
||||
@@ -21,7 +21,7 @@ import qualified Data.IntMap.Strict as IM
|
||||
autoCrit :: Creature
|
||||
autoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI sentinelAI
|
||||
, _crUpdate = stateUpdate $ impulsiveAI sentinelAI
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
|
||||
@@ -33,7 +33,7 @@ smallChaseCrit = chaseCrit
|
||||
}
|
||||
chaseCrit :: Creature
|
||||
chaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
{ _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[ Right doStrategyActions
|
||||
, Left performActions
|
||||
, Right overrideMeleeCloseTarget
|
||||
|
||||
@@ -24,7 +24,7 @@ import Control.Lens
|
||||
launcherCrit :: Creature
|
||||
launcherCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[ Left performActions
|
||||
, Left $ watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
||||
|
||||
@@ -26,7 +26,7 @@ import Control.Lens
|
||||
ltAutoCrit :: Creature
|
||||
ltAutoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[ Left performActions
|
||||
, Left $ watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
|
||||
@@ -29,7 +29,7 @@ import Control.Monad.State
|
||||
pistolCrit :: Creature
|
||||
pistolCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[Left performActions
|
||||
,Left $ watchUpdateStrat
|
||||
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
||||
|
||||
@@ -33,7 +33,6 @@ tryMeleeAttack cr tcr
|
||||
| _crMeleeCooldown cr == 0
|
||||
&& dist (_crPos tcr) cpos < _crRad cr + _crRad tcr + 5
|
||||
&& abs (_crDir cr - argV (_crPos tcr -.- cpos)) < pi/4
|
||||
-- = cr & crActionPlan . crStrategy .~ StrategyActions MeleeStrike meleeActions
|
||||
= cr & crActionPlan . crImpulse .~ [Melee $ _crID tcr]
|
||||
| otherwise = cr
|
||||
where
|
||||
@@ -117,7 +116,8 @@ reloadOverride cr
|
||||
where
|
||||
reloadActions =
|
||||
[ holsterWeapon
|
||||
, WaitThen 1 $ DoActionWhileInterrupt NoAction crIsReloading (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
, 1 `WaitThen`
|
||||
DoActionWhileInterrupt NoAction crIsReloading (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
|
||||
overrideInternal :: (Creature -> Bool) -> (Creature -> Creature) -> Creature -> Creature
|
||||
|
||||
@@ -27,7 +27,7 @@ import Control.Lens
|
||||
spreadGunCrit :: Creature
|
||||
spreadGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
, _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[Left performActions
|
||||
,Left $ watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module Dodge.Creature.State
|
||||
( stateUpdate
|
||||
, stateUpdate'
|
||||
, stateUpdateDamage
|
||||
, stateUpdateDamage'
|
||||
, doDamage
|
||||
@@ -44,13 +43,9 @@ import qualified Data.Vector.Mutable as MV
|
||||
-- the creature before or after it has moved?
|
||||
-- currently invSideEffects are applied after the creature moves, to correctly
|
||||
-- update shield positions
|
||||
stateUpdate :: CRUpdate -> Creature -> World -> World
|
||||
stateUpdate f cr w = let (fw,mcr) = stateUpdateDamage doDamage f cr w
|
||||
in fw $ w & creatures . at (_crID cr) .~ mcr
|
||||
|
||||
stateUpdate' :: (Creature -> World -> (World -> World, Creature))
|
||||
stateUpdate :: (Creature -> World -> (World -> World, Creature))
|
||||
-> Creature -> World -> World
|
||||
stateUpdate' f cr w = let (fw,mcr) = stateUpdateDamage' doDamage f cr w
|
||||
stateUpdate f cr w = let (fw,mcr) = stateUpdateDamage' doDamage f cr w
|
||||
in fw $ w & creatures . at (_crID cr) .~ mcr
|
||||
|
||||
stateUpdateDamage :: (Creature -> Creature) -> CRUpdate -> CRUpdate
|
||||
|
||||
@@ -18,7 +18,7 @@ import Control.Lens
|
||||
|
||||
swarmCrit :: Creature
|
||||
swarmCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate' $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
{ _crUpdate = stateUpdate $ impulsiveAI $ chainCreatureUpdatesLR
|
||||
[ Left $ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||
, Right $ (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
, Left $ perceptionUpdate' [0]
|
||||
|
||||
@@ -16,10 +16,10 @@ import Data.Maybe
|
||||
yourControl
|
||||
:: Creature
|
||||
-> World
|
||||
-> (World -> World, Maybe Creature)
|
||||
-> (World -> World, Creature)
|
||||
yourControl cr w =
|
||||
( updateUsingInput
|
||||
, Just . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed 0 cr
|
||||
, mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed 0 cr
|
||||
)
|
||||
where
|
||||
speed = _mvSpeed $ _crMvType cr
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module Dodge.Debug.Terminal
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Creature
|
||||
import Dodge.Creature.YourControl
|
||||
import Dodge.Creature.State
|
||||
@@ -12,8 +11,9 @@ applyTerminalString :: String -> Universe -> Universe
|
||||
applyTerminalString "NOCLIP" w = w & config . debug_noclip %~ not
|
||||
applyTerminalString "LOADME" w = w & uvWorld . creatures . ix 0 . crInv .~ stackedInventory
|
||||
& uvWorld . creatures . ix 0 . crInvCapacity .~ 50
|
||||
applyTerminalString "GODON" u = u & uvWorld . creatures . ix 0 . crUpdate .~ toCrUpdate' (stateUpdateDamage clearDamage yourControl)
|
||||
applyTerminalString "GODOFF" u = u & uvWorld . creatures . ix 0 . crUpdate .~ stateUpdate yourControl
|
||||
--applyTerminalString "GODON" u = u
|
||||
-- & uvWorld . creatures . ix 0 . crUpdate .~ (stateUpdateDamage' clearDamage yourControl)
|
||||
--applyTerminalString "GODOFF" u = u & uvWorld . creatures . ix 0 . crUpdate .~ stateUpdate yourControl
|
||||
applyTerminalString "LOADTEST" w = w & uvWorld . creatures . ix 0 . crInv .~ testInventory
|
||||
& uvWorld . creatures . ix 0 . crInvCapacity .~ 50
|
||||
applyTerminalString "LM" w = applyTerminalString "LOADME" w
|
||||
|
||||
@@ -73,7 +73,7 @@ updateTurret rotSpeed mc w
|
||||
& crPict .~ (\cr _ _ -> drawCrEquipment cr)
|
||||
-- & crPict .~ basicCrPict red
|
||||
-- & crUpdate .~ (\cr -> crUpCrUp stepReloading cr . invSideEff cr)
|
||||
& crUpdate .~ stateUpdate' (\cr w'' -> followImpulses w'' cr)
|
||||
& crUpdate .~ stateUpdate (\cr w'' -> followImpulses w'' cr)
|
||||
& crStance . posture .~ Aiming
|
||||
Just cid -> w'
|
||||
& creatures . ix cid . crPos .~ mcpos
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
-- | stopgap module, making creature update simpler
|
||||
-- should probably end up removed after further refactoring
|
||||
module Dodge.RemoveCreatureEndo
|
||||
(
|
||||
toCrUpdate'
|
||||
)where
|
||||
import Dodge.Data
|
||||
import Control.Lens
|
||||
|
||||
toCrUpdate' :: (Creature -> World -> (World -> World, Maybe Creature))
|
||||
-> Creature
|
||||
-> World
|
||||
-> World
|
||||
toCrUpdate' f cr w = let (fw,mcr) = f cr w
|
||||
in fw $ w & creatures . at (_crID cr) .~ mcr
|
||||
Reference in New Issue
Block a user