Remove hvAuto, replace with machineGun

This commit is contained in:
2022-06-07 23:50:28 +01:00
parent c31f398fab
commit d91a53f76c
7 changed files with 44 additions and 95 deletions
+10 -1
View File
@@ -203,6 +203,16 @@ inventoryX c = case c of
, autoDetector WALLDETECTOR
, effectGun "GIBBER" addCrGibs
]
'E' ->
[ makeTypeCraftNum 3 PIPE
, makeTypeCraftNum 5 HARDWARE
, makeTypeCraftNum 1 TIN
, makeTypeCraftNum 1 SPRING
, makeTypeCraftNum 1 PLANK
, makeTypeCraftNum 1 PLATE
, makeTypeCraftNum 1 DRUM
, makeTypeCraftNum 1 MOTOR
]
_ -> []
testInventory :: IM.IntMap Item
@@ -253,7 +263,6 @@ stackedInventory = IM.fromList $ zip [0..]
,longGun
,autoGun
,ltAutoGun
,hvAutoGun
,pistol
,teslaGun
,blinkGun
-1
View File
@@ -10,4 +10,3 @@ inTermFocus w = fromMaybe False $ do
hasfocus <- w ^? terminals . ix tmid . tmInput . tiFocus
connectionstatus <- w ^? terminals . ix tmid . tmStatus
return $ hasfocus && connectionstatus == TerminalReady
+22 -2
View File
@@ -8,6 +8,7 @@ module Dodge.Item.Weapon.BulletGun.Rod
) where
import Dodge.Data
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Particle.HitEffect
import Dodge.Particle.Damage
--import Dodge.ChainEffect
@@ -32,7 +33,7 @@ import Shape
--import Sound.Data
import LensHelp
--import Data.Maybe
import Data.Maybe
--import qualified Data.Sequence as Seq
--import Control.Lens
--import Control.Monad.State
@@ -76,7 +77,6 @@ bangRod = defaultGun
{ _laType = basicBullet
, _laMax = 1
, _laReloadTime = 20
, _laReloadType = ActiveClear
}
}
& itUse . useAim . aimWeight .~ 8
@@ -139,3 +139,23 @@ machineGun :: Item
machineGun = bangRod
& itName .~ "MACHINEGUN"
& itType .~ MACHINEGUN
& itUse .~ (ruseAmmoParamsRate 25 NoHammer
[ ammoCheckI
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, withSoundStart bangEchoS
, withThinSmokeI
, withMuzFlareI
]
& useAim . aimWeight .~ 8
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
)
& itConsumption . laMax .~ 100
& itConsumption . laReloadTime .~ 75
& itInvSize .~ 3
& itParams. torqueAfter .~ 0.2 -- not sure if this is necessary?
& itInvDisplay .~ \it -> head (basicItemDisplay it) :
["*FIRERATE:" ++ fromMaybe "" (maybeRateStatus it)
]
-33
View File
@@ -6,7 +6,6 @@ module Dodge.Item.Weapon.BulletGuns
, biggestBlunderbuss
, grenadeLauncher
, ltAutoGun
, hvAutoGun
, autogunSpread
, autoGun
, autoGunPic
@@ -23,7 +22,6 @@ import Dodge.Item.Weapon.ZoomScope
import Dodge.Data
--import Dodge.ChainEffect
import Dodge.Default.Weapon
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Default
import Dodge.Item.Attachment
--import Dodge.Item.Weapon.InventoryDisplay
@@ -39,7 +37,6 @@ import Shape
--import Sound.Data
import LensHelp
import Data.Maybe
import qualified Data.Sequence as Seq
--import Control.Lens
import Control.Monad.State
@@ -212,36 +209,6 @@ biggestBlunderbuss = biggerBlunderbuss
grenadeLauncher :: Int -> Item
grenadeLauncher _ = bangCone
hvAutoGun :: Item
hvAutoGun = defaultAutoGun
{ _itName = "AUTO-HV"
, _itType = HVAUTOGUN
, _itConsumption = defaultAmmo
{ _laType = hvBullet
, _laMax = 100
, _laLoaded = 100
, _laReloadTime = 200
}
, _itUse = ruseAmmoParamsRate 25 NoHammer
[ ammoCheckI
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, withSoundStart bangEchoS
, withThinSmokeI
, withMuzFlareI
]
& useAim . aimWeight .~ 8
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
-- , _itFloorPict = hvAutoGunPic
, _itInvSize = 3
, _itInvDisplay = \it -> head (basicItemDisplay it) :
["* FIRERATE: *"
,"* " ++ fromMaybe " " (maybeRateStatus it) ++ " *"
]
}
& itParams. torqueAfter .~ 0.2
ltAutoGun :: Item
ltAutoGun = defaultAutoGun
{ _itName = "AUTO-LT"
+1 -1
View File
@@ -49,7 +49,7 @@ maybeModeStatus it = case it ^? itAttachment of
maybeRateStatus :: Item -> Maybe String
maybeRateStatus it = case it ^? itUse . useDelay . rateMaxMax of
Nothing -> Nothing
_ -> Just $ ' ' : " " ++ leftPad 4 ' ' (show (_rateMax . _useDelay $ _itUse it))
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _useDelay $ _itUse it))
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . useDelay . warmMax of
-22
View File
@@ -4,7 +4,6 @@ module Dodge.Placement.Instance.Terminal
, putTerminal'
, putTerminal''
, simpleTermMessage
, topFlushStrings
, terminalColor
, terminalSPic
) where
@@ -128,24 +127,3 @@ accessTerminal mtmid w = case mtmid of
simpleTermMessage :: [String] -> Terminal
simpleTermMessage strs = defaultTerminal & tmFutureLines .~ map makeTermLine strs
--simpleTermMessage ss = const $ TerminalParams
-- {_termDisplayedLines = []
-- ,_termFutureLines = TerminalLineEffect 0 termsound
-- : map totermline (topFlushStrings ss ++ ss)
-- ,_termMaxLines = 7
-- ,_termTitle = "TERMINAL"
-- ,_termSel = Nothing
-- ,_termMaxSel = Nothing
-- }
-- where
-- totermline s = TerminalLineDisplay 0 (const (s,white))
-- termsound subinv w' = soundStart TerminalSound tpos computerBeepingS Nothing w'
-- where
-- tpos = fromMaybe 0 $ w' ^? buttons . ix (_termID subinv) . btPos
topFlushStrings :: [String] -> [String]
topFlushStrings = topFlush . maximum . map length
topFlush :: Int -> [String]
topFlush twidth = [replicate i ' ' ++ "*" | i <- [0, max 1 $ twidth `div` 5 .. twidth]]
+11 -35
View File
@@ -28,8 +28,7 @@ disconnectTerminal tm w = w
& terminals . ix (_tmID tm) . tmStatus .~ TerminalOff
& exitTerminalSubInv
& terminals . ix (_tmID tm) . tmFutureLines .~
[ TerminalLineTerminalEffect 0 (tmDisplayedLines .~ [])
]
[ TerminalLineTerminalEffect 0 (tmDisplayedLines .~ []) ]
exitTerminalSubInv :: World -> World
exitTerminalSubInv w = case w ^? hud . hudElement . subInventory . termID of
@@ -41,16 +40,12 @@ damageCodeCommand = TerminalCommand
{ _tcString = "DAMAGECODE"
, _tcAlias = ["DCODE","DC"]
, _tcHelp = "DISPLAYS THE SHAPE AND COLOR ASSOCIATED WITH A GIVEN DAMAGE TYPE."
, _tcEffect = \_ w -> OneArgument "A DAMAGE TYPE" $ getDamageCoding w
-- , _tcArgumentType = Just "A DAMAGE TYPE"
-- , _tcArguments = \_ -> map (map toUpper . show) . M.keys . _sensorCoding . _genParams
-- , _tcEffect = f
, _tcEffect = \_ -> OneArgument "A DAMAGE TYPE" . getDamageCoding
}
getDamageCoding :: World -> M.Map String [TerminalLine]
getDamageCoding = decodedtmap . _sensorCoding . _genParams
decodedtmap :: M.Map DamageType (PaletteColor,DecorationShape)
-> M.Map String [TerminalLine]
decodedtmap :: M.Map DamageType (PaletteColor,DecorationShape) -> M.Map String [TerminalLine]
decodedtmap = M.mapKeys show . M.map ((:[]) . makeTermLine . show)
sensorCommand :: TerminalCommand
@@ -58,33 +53,19 @@ sensorCommand = TerminalCommand
{ _tcString = "SENSOR"
, _tcAlias = ["SEN"]
, _tcHelp = "ACCESS INFORMATION CONCERNING THE CONNECTED SENSOR."
, _tcEffect = \tm w -> OneArgument "A SENSOR PARAMETER" (sensorInfoMap tm w)
, _tcEffect = \tm -> OneArgument "A SENSOR PARAMETER" . sensorInfoMap tm
}
sensorInfoMap :: Terminal -> World -> M.Map String [TerminalLine]
sensorInfoMap tm w = M.fromList
[("REQUIREMENT", getSensor _proxRequirement tm w)
,("DISTANCE", getSensor _proxDist tm w)
,("CURRENTSTATUS", getSensor _proxStatus tm w)
,("PASTSTATUS", getSensor _sensToggle tm w)
[("REQUIREMENT", getSensor _proxRequirement tm w)
,("DISTANCE", getSensor _proxDist tm w)
,("CURRENTSTATUS", getSensor _proxStatus tm w)
,("PASTSTATUS", getSensor _sensToggle tm w)
]
getSensor :: Show a => (Sensor -> a) -> Terminal -> World -> [TerminalLine]
getSensor f tm w = maybe [] (makeTermPara . map toUpper . show . f)
(w ^? machines . ix (_tmMachineID tm) . mcSensor)
effectArgMessage :: (String -> Terminal -> World -> Maybe [String])
-> [String] -> Terminal -> World -> Either String [TerminalLine]
effectArgMessage f args tm w = maybe (Left "") Right $ do
arg <- safeHead args
strs <- f arg tm w
return $ map makeTermLine strs
sensf :: String -> Terminal -> World -> Maybe [String]
sensf arg tm w = case arg of
-- "REQUIREMENT","DISTANCE","CURRENTSTATUS","PASTSTATUS"]
"BOOL" -> Just [show $ w ^? machines . ix (_tmMachineID tm) . mcSensor . sensToggle]
_ -> Nothing
toggleCommand :: TerminalCommand
toggleCommand = TerminalCommand
{ _tcString = "TOGGLE"
@@ -105,9 +86,6 @@ helpCommand = TerminalCommand
, _tcEffect = \tm -> OneArgument "AN AVAILABLE COMMAND" . getCommandsHelp tm
}
getCommandsHelp :: Terminal -> World -> M.Map String [TerminalLine]
--getCommandsHelp tm w = fromMaybe mempty $ do
-- tcs <- getCommands tm w
-- return $ foldr f mempty tcs
getCommandsHelp tm w = foldr f mempty $ getCommands tm
where
f tc = M.insert (_tcString tc)
@@ -126,8 +104,7 @@ getCommands tm = _tmScrollCommands tm ++ _tmWriteCommands tm
infoClearInput :: Terminal -> [TerminalLine] -> World -> World
infoClearInput tm tls = terminals . ix (_tmID tm) %~
( (tmInput .~ TerminalInput T.empty True (0,0))
. (tmFutureLines ++.~ tls
)
. (tmFutureLines ++.~ tls)
)
argumentHelp :: TerminalCommand -> Terminal -> World -> (String,Maybe [String])
@@ -171,7 +148,7 @@ commandsCommand = TerminalCommand
, _tcEffect = \tm _ -> NoArguments
( makeTermLine "AVAILABLE COMMANDS:"
: makeColorTermPara commandColor (unwords (map _tcString $ getCommands tm))
)
)
}
commandColor :: Color
@@ -202,7 +179,7 @@ terminalReturnEffect :: Terminal -> World -> World
terminalReturnEffect tm w = guardDisconnected tm w $ fromMaybe w $ do
s <- fmap T.unpack $ w ^? terminals . ix (_tmID tm) . tmInput . tiText
return $ runTerminalString s tm $ w
& terminals . ix (_tmID tm) . tmFutureLines .~ [makeTermLine ('>':s)]
& terminals . ix (_tmID tm) . tmFutureLines .~ [makeTermLine ('>':s)]
commandFutureLines :: String -> Terminal -> World -> [TerminalLine]
commandFutureLines s tm w = fromMaybe [errline "^ INVALID COMMAND"] $ do
@@ -266,4 +243,3 @@ connectionBlurb1 =
,TerminalLineDisplay 10 (const ("...",white))
,TerminalLineDisplay 10 (const ("CONNECTED",white))
,TerminalLineTerminalEffect 0 (tmStatus .~ TerminalReady)]