This commit is contained in:
2021-12-11 22:08:43 +00:00
parent 7116129a37
commit 6cd59d99bc
17 changed files with 115 additions and 170 deletions
+8 -15
View File
@@ -12,7 +12,7 @@ import Dodge.FloorItem
import Dodge.Wall.Delete
import Dodge.WorldEvent.Explosion
import Dodge.Item.Weapon.BatteryGuns
import Dodge.Item.Weapon.BulletGun.Cane
--import Dodge.Item.Weapon.BulletGun.Cane
--import Dodge.SoundLogic.LoadSound
--import Dodge.SoundLogic
--import Dodge.Item.Draw
@@ -37,7 +37,7 @@ putLasTurret rotSpeed = sps0 $ PutMachine blue (reverse $ square wdth) defaultMa
lasTurret :: MachineType
lasTurret = Turret
--{ _tuWeapon = lasGun
{ _tuWeapon = autoRifle
{ _tuWeapon = lasGun
, _tuTurnSpeed = 0.1
, _tuFireTime = 0
, _tuMCrID = Nothing
@@ -50,13 +50,17 @@ updateTurret rotSpeed mc w
& deleteWallIDs (_mcWallIDs mc)
& makeExplosionAt mcpos
& copyItemToFloor mcpos lasGun
& deleteHomonculus
| otherwise = w
& initHomonculus
& dodamage
& maybeFire
& elecDamBranch
where
initHomonculus w' = case w' ^? machines . ix mcid . mcType . tuMCrID . _Just of
deleteHomonculus = case _tuMCrID (_mcType mc) of
Nothing -> id
Just cid -> creatures . at cid .~ Nothing
initHomonculus w' = case w' ^? machines . ix mcid . mcType . tuMCrID . _Just of
Nothing -> w' & machines . ix mcid . mcType . tuMCrID ?~ cid
& creatures . at cid ?~ thecreature
where
@@ -73,7 +77,7 @@ updateTurret rotSpeed mc w
& crPict .~ (\cr _ _ -> drawCrEquipment cr)
-- & crPict .~ basicCrPict red
-- & crUpdate .~ (\cr -> crUpCrUp stepReloading cr . invSideEff cr)
& crUpdate .~ stateUpdate (\cr w'' -> followImpulses w'' cr)
& crUpdate .~ stateUpdateDamage clearDamage (flip followImpulses)
& crStance . posture .~ Aiming
Just cid -> w'
& creatures . ix cid . crPos .~ mcpos
@@ -85,22 +89,11 @@ updateTurret rotSpeed mc w
elecDamBranch
| elecDam < 10 = updateFiringStatus . doTurn
| otherwise = id
-- TODO make this use the same function as the lasgun
--it = _tuWeapon (_mcType mc)
maybeFire
| _tuFireTime (_mcType mc) > 0
-- massive hack
= fromMaybe id $ do
cid <- _tuMCrID (_mcType mc)
--return $ useItem cid
-- return id
return $ creatures . ix cid . crActionPlan . crImpulse .~ [UseItem]
-- cr <- w ^? creatures . ix cid
-- it <- cr ^? crInv . ix 0
-- return $ _rUse (_itUse it) it cr
-- = _rUse (_itUse it) it (defaultCreature {_crPos = mcpos,_crDir = mcdir})
-- = ( particles .:~ makeLaserAt 5 (mcpos + 15 *.* unitVectorAtAngle mcdir) mcdir )
-- . soundContinue (MachineSound mcid) mcpos tone440sawtoothquietS (Just 1)
| otherwise = id
mcid = _mcID mc
ypos = _crPos $ you w