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