Start ai cleanup
This commit is contained in:
+57
-73
@@ -220,14 +220,21 @@ data Creature = Creature
|
||||
, _crFaction :: Faction
|
||||
, _crGroup :: CrGroup
|
||||
, _crTarget :: Maybe Creature
|
||||
, _crMvTarget :: Maybe Point2
|
||||
, _crMvType :: CrMvType
|
||||
}
|
||||
data CrMvType
|
||||
= DefCrMvType
|
||||
= NoMvType
|
||||
| ChaseMvType
|
||||
{ _chaseSpeed :: Float
|
||||
, _chaseTurnRad :: Float -> Float
|
||||
, _chaseTurnJit :: Float
|
||||
{ _mvSpeed :: Float
|
||||
, _mvTurnRad :: Float -> Float
|
||||
, _mvTurnJit :: Float
|
||||
}
|
||||
| AimMvType
|
||||
{ _mvSpeed :: Float
|
||||
, _mvTurnRad :: Float -> Float
|
||||
, _mvTurnJit :: Float
|
||||
, _mvAimSpeed :: Float -> Float
|
||||
}
|
||||
data WorldState
|
||||
= DoorNumOpen Int
|
||||
@@ -559,18 +566,19 @@ data ActionPlan
|
||||
data Impulse
|
||||
= Move Point2
|
||||
| MoveForward Float
|
||||
| StepForward
|
||||
| Turn Float
|
||||
| RandomTurn Float
|
||||
| TurnToward Point2 Float
|
||||
| MvTurnToward Point2
|
||||
| MvForward
|
||||
| TurnTo Point2
|
||||
| UseItem
|
||||
| SwitchToItem Int
|
||||
| DropItem
|
||||
| PickupNearby Int
|
||||
| UseWorldObject Int
|
||||
| Bark -- placeholder for various communication types
|
||||
| UseIntrinsicAbility
|
||||
-- | PickupNearby Int
|
||||
-- | UseWorldObject Int
|
||||
-- | Bark -- placeholder for various communication types
|
||||
-- | UseIntrinsicAbility
|
||||
| Melee Int
|
||||
| ChangePosture Posture
|
||||
| MakeSound Int
|
||||
@@ -594,87 +602,66 @@ infixr 9 `DoActionWhile`
|
||||
infixr 9 `DoReplicate`
|
||||
infixr 9 `DoImpulsesAlongside`
|
||||
data Action
|
||||
= Attack
|
||||
{_attackTargetID :: Int}
|
||||
| AimAtCloseSlow
|
||||
{_targetID :: Int
|
||||
,_targetSeenAt :: Point2
|
||||
,_aimSpeed :: Float
|
||||
,_slowAimSpeed :: Float
|
||||
,_slowAimAngle :: Float
|
||||
}
|
||||
| MeleeAttack
|
||||
{_meleeAttackLastSeen :: Point2
|
||||
,_meleeAttackTargetID :: Int
|
||||
= AimAt
|
||||
{_targetID :: Int
|
||||
,_targetSeenAt :: Point2
|
||||
}
|
||||
| PathTo
|
||||
{_pathToPoint :: Point2
|
||||
}
|
||||
| HealSelf
|
||||
| DefendSelf
|
||||
| Protect
|
||||
{_protectCID :: Int
|
||||
}
|
||||
| SearchFor
|
||||
{_searchForCID :: Int
|
||||
}
|
||||
| Search
|
||||
| PickupItem
|
||||
{_pickupItemID :: Int
|
||||
{_pathToPoint :: Point2
|
||||
}
|
||||
-- | PickupItem
|
||||
-- {_pickupItemID :: Int
|
||||
-- }
|
||||
| ImpulsesList
|
||||
{_impulsesListList :: [[Impulse]]
|
||||
{_impulsesListList :: [[Impulse]]
|
||||
}
|
||||
| DoImpulses
|
||||
{_doImpulsesList :: [Impulse]
|
||||
{_doImpulsesList :: [Impulse]
|
||||
}
|
||||
| WaitThen
|
||||
{_waitThenTimer :: Int
|
||||
,_waitThenAction :: Action
|
||||
{_waitThenTimer :: Int
|
||||
,_waitThenAction :: Action
|
||||
}
|
||||
| DoActionWhile
|
||||
{_doActionWhileCondition :: (World, Creature) -> Bool
|
||||
,_doActionWhileAction :: Action
|
||||
{_doActionWhileCondition :: (World, Creature) -> Bool
|
||||
,_doActionWhileAction :: Action
|
||||
}
|
||||
| DoActionWhilePartial
|
||||
{_doActionWhilePartial :: Action
|
||||
,_doActionWhileCondition :: (World, Creature) -> Bool
|
||||
,_doActionWhileAction :: Action
|
||||
{_doActionWhilePartial :: Action
|
||||
,_doActionWhileCondition :: (World, Creature) -> Bool
|
||||
,_doActionWhileAction :: Action
|
||||
}
|
||||
| DoActionIf
|
||||
{_doActionIfCondition :: (World, Creature) -> Bool
|
||||
,_doActionIfAction :: Action
|
||||
{_doActionIfCondition :: (World, Creature) -> Bool
|
||||
,_doActionIfAction :: Action
|
||||
}
|
||||
| DoActionIfElse
|
||||
{_doActionIfElseIfAction :: Action
|
||||
,_doActionIfElseCondition :: (World, Creature) -> Bool
|
||||
,_doActionIfElseElseAction :: Action
|
||||
{_doActionIfElseIfAction :: Action
|
||||
,_doActionIfElseCondition :: (World, Creature) -> Bool
|
||||
,_doActionIfElseElseAction :: Action
|
||||
}
|
||||
| DoActionWhileInterrupt
|
||||
{_doActionWhileThenDo :: Action
|
||||
,_doActionWhileThenCondition :: (World, Creature) -> Bool
|
||||
,_doActionWhileThenThen :: Action
|
||||
{_doActionWhileThenDo :: Action
|
||||
,_doActionWhileThenCondition :: (World, Creature) -> Bool
|
||||
,_doActionWhileThenThen :: Action
|
||||
}
|
||||
| DoActions
|
||||
{_doActionsList :: [Action]
|
||||
}
|
||||
| DoActionOnce
|
||||
{_doActionOnceAction :: Action
|
||||
}
|
||||
| DoActionThen
|
||||
{_doActionThenFirst :: Action
|
||||
,_doActionThenSecond :: Action
|
||||
}
|
||||
| DoGuardActions
|
||||
{_doGuardActionsList :: [( (World, Creature) -> Bool, Action, Maybe Action)]
|
||||
{_doActionThenFirst :: Action
|
||||
,_doActionThenSecond :: Action
|
||||
}
|
||||
-- | DoGuardActions
|
||||
-- {_doGuardActionsList :: [( (World, Creature) -> Bool, Action, Maybe Action)]
|
||||
-- }
|
||||
| DoReplicate
|
||||
{_doReplicateTimes :: Int
|
||||
{_doReplicateTimes :: Int
|
||||
,_doReplicateAction :: Action
|
||||
}
|
||||
| DoReplicatePartial
|
||||
{_partialAction :: Action
|
||||
,_doReplicateTimes :: Int
|
||||
{_partialAction :: Action
|
||||
,_doReplicateTimes :: Int
|
||||
,_doReplicateAction :: Action
|
||||
}
|
||||
| LeadTarget
|
||||
@@ -685,24 +672,21 @@ data Action
|
||||
| UseTarget
|
||||
{_useTarget :: Maybe Creature -> Action
|
||||
}
|
||||
| UseTargetCID
|
||||
{_useTargetCID :: Int -> Action
|
||||
}
|
||||
| UseSelf
|
||||
{_useSelf :: Creature -> Action
|
||||
}
|
||||
| UseAheadPos
|
||||
{_useAheadPos :: Point2 -> Action
|
||||
}
|
||||
| UseMvTargetPos
|
||||
{_useMvTargetPos :: Maybe Point2 -> Action
|
||||
}
|
||||
| ArbitraryAction
|
||||
{ _arbitraryAction :: Creature -> World -> Action }
|
||||
| DoActionAlongside -- ^ Repeatedly perform a side action alongside a main action until the main action terminates
|
||||
{_sideAction :: Action
|
||||
,_mainAction :: Action
|
||||
}
|
||||
| DoImpulsesAlongside -- ^ Repeatedly perform impulses alongside a main action until the main action terminates
|
||||
{_sideImpulses :: [Impulse]
|
||||
,_mainAction :: Action
|
||||
| DoImpulsesAlongside
|
||||
-- ^ Repeatedly perform impulses alongside a main action until the main action terminates
|
||||
{_sideImpulses :: [Impulse]
|
||||
,_mainAction :: Action
|
||||
}
|
||||
deriving (Generic)
|
||||
-- deriving (Eq,Ord,Show)
|
||||
@@ -749,7 +733,7 @@ makeLenses ''ActionPlan
|
||||
makeLenses ''Impulse
|
||||
makeLenses ''Action
|
||||
makeLenses ''CrGroupParams
|
||||
|
||||
makeLenses ''CrMvType
|
||||
numColor :: Int -> Color
|
||||
numColor 0 = toV4 (1,0,0,1)
|
||||
numColor 1 = toV4 (0,1,0,1)
|
||||
|
||||
Reference in New Issue
Block a user