Make creature update an external function
This commit is contained in:
+5
-36
@@ -10,19 +10,12 @@ module Dodge.Creature
|
||||
, armourChaseCrit
|
||||
) where
|
||||
import Dodge.Creature.State.Data
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.Prop.Gib
|
||||
--import Dodge.Item.Weapon.Grenade
|
||||
import Dodge.Item.Equipment.Booster
|
||||
import Dodge.Item.Weapon.Utility
|
||||
import Dodge.Item.Weapon.Drone
|
||||
import Dodge.Item.Craftable
|
||||
--import Dodge.Creature.AlertLevel
|
||||
--import Dodge.Creature.SetTarget
|
||||
import Dodge.Creature.Volition
|
||||
import Dodge.Creature.Test
|
||||
--import Dodge.Creature.Impulse
|
||||
import Dodge.Creature.SentinelAI
|
||||
import Dodge.Creature.LauncherCrit
|
||||
import Dodge.Creature.PistolCrit
|
||||
import Dodge.Creature.LtAutoCrit
|
||||
@@ -36,9 +29,7 @@ import Dodge.Item.Weapon
|
||||
import Dodge.Item.Equipment
|
||||
import Dodge.Item.Consumable
|
||||
import Dodge.WorldEvent.Cloud
|
||||
import Dodge.Creature.YourControl
|
||||
import Dodge.Creature.Inanimate
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.ChooseTarget
|
||||
--import Dodge.Item
|
||||
@@ -65,20 +56,17 @@ spawnerCrit = defaultCreature
|
||||
|
||||
miniGunCrit :: Creature
|
||||
miniGunCrit = defaultCreature
|
||||
{ _crUpdate = defaultImpulsive [sentinelFireType (const shootTillEmpty)]
|
||||
-- , _crInv = IM.fromList [(0,autoRifle & itConsumption . ammoLoaded .~ 1000)]
|
||||
, _crInv = IM.fromList [(0,miniGunX 3)]
|
||||
-- , _crInv = IM.fromList [(0,autoRifle)]
|
||||
{ _crInv = IM.fromList [(0,miniGunX 3)]
|
||||
, _crRad = 10
|
||||
, _crState = defaultState
|
||||
, _crHP = 500
|
||||
, _crMvType = defaultAimMvType
|
||||
}
|
||||
& crType . skinUpper .~ light4 red
|
||||
& crType . humanoidAI .~ MiniGunAI
|
||||
longCrit :: Creature
|
||||
longCrit = defaultCreature
|
||||
{ _crUpdate = defaultImpulsive [sentinelFireType $ const shootTillEmpty]
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crActionPlan = ActionPlan
|
||||
{ _apImpulse = []
|
||||
, _apAction = []
|
||||
, _apStrategy = StrategyActions WatchAndWait [StartSentinelPost]
|
||||
@@ -88,34 +76,16 @@ longCrit = defaultCreature
|
||||
, _crRad = 10
|
||||
, _crHP = 150
|
||||
}
|
||||
& crType . humanoidAI .~ LongAI
|
||||
& crType . skinUpper .~ light4 red
|
||||
multGunCrit :: Creature
|
||||
multGunCrit = defaultCreature
|
||||
{ _crInv = IM.fromList [(0,volleyGun 4),(1,medkit 100)]
|
||||
, _crRad = 10
|
||||
, _crHP = 300
|
||||
, _crUpdate = defaultImpulsive [sentinelExtraWatchUpdate
|
||||
[ ( const $ not . crWeaponReady
|
||||
, \_ _ -> StrategyActions Reload reloadActions
|
||||
)
|
||||
, (const $ not . crSafeDistFromTarg 150
|
||||
, \_ cr -> StrategyActions Flee
|
||||
[const (not . crSafeDistFromTarg 150) `DoActionWhile` UseTarget (fleeFrom cr)
|
||||
`DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
||||
)
|
||||
, (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
[ drawwp `DoActionThen` shootFirstMiss `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait] ]
|
||||
)
|
||||
]
|
||||
]
|
||||
}
|
||||
& crType . skinUpper .~ light4 red
|
||||
where
|
||||
drawwp = DoActionIfElse NoAction (const crIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
reloadActions =
|
||||
[ holsterWeapon
|
||||
, WaitThen 1 $ DoActionWhileInterrupt NoAction (const crIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
& crType . humanoidAI .~ MultGunAI
|
||||
|
||||
addArmour :: Creature -> Creature
|
||||
addArmour = over crInv insarmour
|
||||
@@ -130,7 +100,6 @@ startCr = defaultCreature
|
||||
, _crDir = pi/2
|
||||
, _crMvDir = pi/2
|
||||
, _crID = 0
|
||||
, _crUpdate = stateUpdate yourControl
|
||||
, _crRad = 10
|
||||
, _crMass = 10
|
||||
, _crHP = 1000
|
||||
|
||||
Reference in New Issue
Block a user