Refactor, try to limit dependencies
This commit is contained in:
+109
-92
@@ -1,58 +1,61 @@
|
||||
module Dodge.Default.Creature where
|
||||
import Dodge.Data
|
||||
import Dodge.Data.FloatFunction
|
||||
import Geometry.Data
|
||||
import Picture
|
||||
|
||||
import qualified IntMapHelp as IM
|
||||
import qualified Data.Map.Strict as M
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.Map.Strict as M
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Data.FloatFunction
|
||||
import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
import Picture
|
||||
|
||||
defaultCreature :: Creature
|
||||
defaultCreature = Creature
|
||||
{ _crPos = V2 0 0
|
||||
, _crOldPos = V2 0 0
|
||||
, _crVel = V2 0 0
|
||||
, _crDir = 0
|
||||
, _crOldDir = 0
|
||||
, _crMvDir = 0
|
||||
, _crTwist = 0
|
||||
, _crID = 1
|
||||
, _crType = defaultCreatureSkin
|
||||
, _crRad = 10
|
||||
, _crMass = 10
|
||||
, _crHP = 100
|
||||
, _crMaxHP = 150
|
||||
, _crInv = IM.empty
|
||||
, _crInvSel = InvSel 0 NoInvSelAction
|
||||
, _crInvCapacity = 25
|
||||
, _crInvLock = False
|
||||
, _crInvEquipped = mempty
|
||||
, _crLeftInvSel = Nothing
|
||||
, _crState = defaultState
|
||||
, _crCorpse = MakeDefaultCorpse
|
||||
, _crMaterial = Flesh
|
||||
, _crPastDamage = 0
|
||||
, _crEquipment = M.empty
|
||||
, _crStance = Stance
|
||||
{_carriage=Walking 0 WasLeftForward
|
||||
,_posture=AtEase
|
||||
,_strideLength = yourDefaultStrideLength
|
||||
defaultCreature =
|
||||
Creature
|
||||
{ _crPos = V2 0 0
|
||||
, _crOldPos = V2 0 0
|
||||
, _crVel = V2 0 0
|
||||
, _crDir = 0
|
||||
, _crOldDir = 0
|
||||
, _crMvDir = 0
|
||||
, _crTwist = 0
|
||||
, _crID = 1
|
||||
, _crType = defaultCreatureSkin
|
||||
, _crRad = 10
|
||||
, _crMass = 10
|
||||
, _crHP = 100
|
||||
, _crMaxHP = 150
|
||||
, _crInv = IM.empty
|
||||
, _crInvSel = InvSel 0 NoInvSelAction
|
||||
, _crInvCapacity = 25
|
||||
, _crInvLock = False
|
||||
, _crInvEquipped = mempty
|
||||
, _crLeftInvSel = Nothing
|
||||
, _crState = defaultState
|
||||
, _crCorpse = MakeDefaultCorpse
|
||||
, _crMaterial = Flesh
|
||||
, _crPastDamage = 0
|
||||
, _crEquipment = M.empty
|
||||
, _crStance =
|
||||
Stance
|
||||
{ _carriage = Walking 0 WasLeftForward
|
||||
, _posture = AtEase
|
||||
, _strideLength = yourDefaultStrideLength
|
||||
}
|
||||
, _crVocalization = Mute
|
||||
, _crActionPlan = ActionPlan [] [] (StrategyActions WatchAndWait [StartSentinelPost]) [LiveLongAndProsper]
|
||||
, _crPerception = defaultPerceptionState
|
||||
, _crMemory = defaultCreatureMemory
|
||||
, _crMeleeCooldown = 0
|
||||
, _crFaction = NoFaction
|
||||
, _crIntention = defaultIntention
|
||||
, _crGroup = LoneWolf
|
||||
, _crMvType = defaultAimMvType
|
||||
, _crHammerPosition = HammerUp
|
||||
, _crName = "DEFAULTCRNAME"
|
||||
, _crStatistics = CreatureStatistics 10 10 10
|
||||
, _crCamouflage = FullyVisible
|
||||
}
|
||||
, _crVocalization = Mute
|
||||
, _crActionPlan = ActionPlan [] [] (StrategyActions WatchAndWait [StartSentinelPost]) [LiveLongAndProsper]
|
||||
, _crPerception = defaultPerceptionState
|
||||
, _crMemory = defaultCreatureMemory
|
||||
, _crMeleeCooldown = 0
|
||||
, _crFaction = NoFaction
|
||||
, _crIntention = defaultIntention
|
||||
, _crGroup = LoneWolf
|
||||
, _crMvType = defaultAimMvType
|
||||
, _crHammerPosition = HammerUp
|
||||
, _crName = "DEFAULTCRNAME"
|
||||
, _crStatistics = CreatureStatistics 10 10 10
|
||||
, _crCamouflage = FullyVisible
|
||||
}
|
||||
|
||||
defaultCreatureSkin :: CreatureType
|
||||
defaultCreatureSkin = Humanoid (greyN 0.9) (light4 green) (greyN 0.3) InanimateAI
|
||||
|
||||
@@ -60,53 +63,66 @@ defaultInanimate :: Creature
|
||||
defaultInanimate = defaultCreature & crActionPlan .~ Inanimate
|
||||
|
||||
defaultCreatureMemory :: Memory
|
||||
defaultCreatureMemory = Memory
|
||||
{ _soundsToInvestigate = []
|
||||
, _nodesSearched = []
|
||||
}
|
||||
defaultCreatureMemory =
|
||||
Memory
|
||||
{ _soundsToInvestigate = []
|
||||
, _nodesSearched = []
|
||||
}
|
||||
|
||||
defaultInvSize :: Int
|
||||
defaultInvSize = 20
|
||||
|
||||
defaultPerceptionState :: Perception
|
||||
defaultPerceptionState = Perception
|
||||
{ _cpVigilance = Lethargic
|
||||
, _cpAttention = AttentiveTo mempty
|
||||
, _cpAwareness = mempty
|
||||
, _cpVision = defaultVision
|
||||
, _cpAudition = defaultAudition
|
||||
}
|
||||
defaultPerceptionState =
|
||||
Perception
|
||||
{ _cpVigilance = Lethargic
|
||||
, _cpAttention = AttentiveTo mempty
|
||||
, _cpAwareness = mempty
|
||||
, _cpVision = defaultVision
|
||||
, _cpAudition = defaultAudition
|
||||
}
|
||||
|
||||
defaultVision :: Vision
|
||||
defaultVision = Eyes
|
||||
{ _viFOV = FloatFOV 0.5
|
||||
, _viDist = FloatLessCheck 500
|
||||
}
|
||||
defaultVision =
|
||||
Eyes
|
||||
{ _viFOV = FloatFOV 0.5
|
||||
, _viDist = FloatLessCheck 500
|
||||
}
|
||||
|
||||
defaultAudition :: Audition
|
||||
defaultAudition = Ears
|
||||
{ _auDist = FloatID
|
||||
}
|
||||
defaultAudition =
|
||||
Ears
|
||||
{ _auDist = FloatID
|
||||
}
|
||||
|
||||
defaultIntention :: Intention
|
||||
defaultIntention = Intention
|
||||
{ _targetCr = Nothing
|
||||
, _mvToPoint = Nothing
|
||||
, _viewPoint = Nothing
|
||||
}
|
||||
defaultIntention =
|
||||
Intention
|
||||
{ _targetCr = Nothing
|
||||
, _mvToPoint = Nothing
|
||||
, _viewPoint = Nothing
|
||||
}
|
||||
|
||||
defaultChaseMvType :: CrMvType
|
||||
defaultChaseMvType = CrMvType
|
||||
{ _mvSpeed = 2
|
||||
, _mvTurnRad = FloatAbsCheckGreaterLess (pi/4) 0.2 0.05--f
|
||||
, _mvTurnJit = 0.2
|
||||
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi/8) 0.2 0.01
|
||||
}
|
||||
defaultChaseMvType =
|
||||
CrMvType
|
||||
{ _mvSpeed = 2
|
||||
, _mvTurnRad = FloatAbsCheckGreaterLess (pi / 4) 0.2 0.05 --f
|
||||
, _mvTurnJit = 0.2
|
||||
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi / 8) 0.2 0.01
|
||||
}
|
||||
|
||||
defaultAimMvType :: CrMvType
|
||||
defaultAimMvType = CrMvType
|
||||
{ _mvSpeed = 3
|
||||
, _mvTurnRad = FloatConst 0.2
|
||||
, _mvTurnJit = 0.05
|
||||
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi/8) 0.2 0.01
|
||||
}
|
||||
defaultAimMvType =
|
||||
CrMvType
|
||||
{ _mvSpeed = 3
|
||||
, _mvTurnRad = FloatConst 0.2
|
||||
, _mvTurnJit = 0.05
|
||||
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi / 8) 0.2 0.01
|
||||
}
|
||||
|
||||
defaultAimingCrit :: Creature
|
||||
defaultAimingCrit = defaultCreature { _crMvType = defaultAimMvType }
|
||||
defaultAimingCrit = defaultCreature{_crMvType = defaultAimMvType}
|
||||
|
||||
yourDefaultSpeed :: Float
|
||||
yourDefaultSpeed = 3
|
||||
@@ -115,9 +131,10 @@ yourDefaultStrideLength :: Int
|
||||
yourDefaultStrideLength = 40
|
||||
|
||||
defaultState :: CreatureState
|
||||
defaultState = CrSt
|
||||
{ _csDamage = []
|
||||
-- , _crPastDamage = V.fromList $ replicate 20 []
|
||||
, _csSpState = GenCr
|
||||
, _csDropsOnDeath = DropAll
|
||||
}
|
||||
defaultState =
|
||||
CrSt
|
||||
{ _csDamage = []
|
||||
, -- , _crPastDamage = V.fromList $ replicate 20 []
|
||||
_csSpState = GenCr
|
||||
, _csDropsOnDeath = DropAll
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user