Add terminal GODON command

This commit is contained in:
2021-12-09 17:12:32 +00:00
parent 4324d298d4
commit 1a053421ef
7 changed files with 34 additions and 18 deletions
+10 -2
View File
@@ -17,9 +17,9 @@ import Shape
import Dodge.Base
import Dodge.Base.Collide
import LensHelp
import qualified IntMapHelp as IM
import Data.List
import qualified Data.IntMap.Strict as IM
putLasTurret :: Float -> Placement
putLasTurret rotSpeed = sps0 $ PutMachine blue (reverse $ square wdth) defaultMachine
@@ -34,6 +34,7 @@ lasTurret = Turret
{ _tuWeapon = autoRifle
, _tuTurnSpeed = 0.1
, _tuFireTime = 0
, _tuMCrID = Nothing
}
updateTurret :: Float -> Machine -> World -> World
@@ -42,8 +43,15 @@ updateTurret rotSpeed mc w
& deleteWallIDs (_mcWallIDs mc)
& makeExplosionAt mcpos
& copyItemToFloor mcpos lasGun
| otherwise = w & doDamage & maybeFire & elecDamBranch
| otherwise = w
& initHomonculus
& doDamage
& maybeFire
& elecDamBranch
where
initHomonculus w' = case w' ^? machines . ix mcid . mcType . tuMCrID . _Just of
Nothing -> w' & machines . ix mcid . mcType . tuMCrID ?~ IM.newKey (_creatures w')
_ -> w'
doDamage = machines . ix mcid %~
( (mcDamage .~ [Electrical (min 2500 $ max 0 (elecDam - 10)) 0 0 0])
. (mcHP -~ dam)