Dataify impulse/action/strategy function fields

This commit is contained in:
2022-07-21 21:45:31 +01:00
parent 14f3c8bc52
commit 583027112d
7 changed files with 45 additions and 36 deletions
+16 -11
View File
@@ -10,6 +10,7 @@ circular imports are probably not a good idea.
{-# LANGUAGE DerivingStrategies #-}
module Dodge.Data
( module Dodge.Data
, module Dodge.Data.CreatureEffect
, module Dodge.Data.WorldEffect
, module Dodge.Data.Button
, module Dodge.Data.Item.Params
@@ -70,6 +71,7 @@ module Dodge.Data
, module Dodge.Data.RadarBlip
, module Dodge.Data.PathGraph
) where
import Dodge.Data.CreatureEffect
import Dodge.Data.WorldEffect
import Dodge.Data.Button
import Dodge.Data.Item.Params
@@ -668,6 +670,7 @@ data ActionPlan
,_apStrategy :: Strategy
,_apGoal :: [Goal]
}
data RandImpulse = RandImpulseList [Impulse]
data Impulse
= Move Point2
| MoveForward Float
@@ -687,18 +690,19 @@ data Impulse
| MakeSound SoundID
| ChangeStrategy Strategy
| AddGoal Goal
| ArbitraryImpulseFunction (World -> Creature -> Creature)
| ArbitraryImpulse (Creature -> World -> Impulse)
| ArbitraryImpulseEffect (Creature -> World -> World)
| ArbitraryImpulseFunction WdCrCr
| ArbitraryImpulse CrWdImp
| ArbitraryImpulseEffect CrWdWd
| ImpulseUseTargetCID
{_impulseUseTargetCID :: Int -> Impulse
{_impulseUseTargetCID :: IntImp
}
| ImpulseUseTarget
{_impulseUseTarget :: Creature -> Impulse
{_impulseUseTarget :: CrImp
}
| ImpulseUseAheadPos
{_impulseUseAheadPos :: Point2 -> Impulse
{_impulseUseAheadPos :: P2Imp
}
| ImpulseNothing
instance Show Impulse where
show imp = case imp of
Move p -> "Move "++shortPoint2 p
@@ -725,6 +729,7 @@ instance Show Impulse where
ImpulseUseTarget {} -> "ImpulseUseTarget"
ImpulseUseAheadPos {} -> "ImpulseUseAheadPos"
RandomImpulse {} -> "RandomImpulse"
ImpulseNothing -> "ImpulseNothing"
-- deriving (Eq,Ord,Show)
infixr 9 `WaitThen`
infixr 9 `DoActionThen`
@@ -760,26 +765,26 @@ data Action
,_waitThenAction :: Action
}
| DoActionWhile
{_doActionWhileCondition :: World -> Creature -> Bool
{_doActionWhileCondition :: WdCrBl
,_doActionWhileAction :: Action
}
| DoActionWhilePartial
{_doActionWhilePartial :: Action
,_doActionWhileCondition :: World -> Creature -> Bool
,_doActionWhileCondition :: WdCrBl
,_doActionWhileAction :: Action
}
| DoActionIf
{_doActionIfCondition :: World -> Creature -> Bool
{_doActionIfCondition :: WdCrBl
,_doActionIfAction :: Action
}
| DoActionIfElse
{_doActionIfElseIfAction :: Action
,_doActionIfElseCondition :: World -> Creature -> Bool
,_doActionIfElseCondition :: WdCrBl
,_doActionIfElseElseAction :: Action
}
| DoActionWhileInterrupt
{_doActionWhileThenDo :: Action
,_doActionWhileThenCondition :: World -> Creature -> Bool
,_doActionWhileThenCondition :: WdCrBl
,_doActionWhileThenThen :: Action
}
| DoActions