Compare commits

...
12 Commits
Author SHA1 Message Date
justin 29017e6b06 Move handle positions 2023-05-28 15:02:23 +01:00
justin 7fc36ab028 Improve weapon handle offsets 2023-05-28 13:59:58 +01:00
justin 4b35a683af Tweak muzzle flare 2023-05-28 11:14:05 +01:00
justin 10c9e2261f Held item rclick use, tweak reload on lclick 2023-05-28 10:17:32 +01:00
justin ec8317c14e Work on held item usage 2023-05-27 12:32:09 +01:00
justin 4cfb7d431a Explicitly store list of barrels for weapons 2023-05-20 17:48:51 +01:00
justin 03611c6b95 Move towards unifying weapon barrels 2023-05-20 15:29:46 +01:00
justin f2183e9954 Cleanup 2023-05-20 15:06:05 +01:00
justin 6c71e1d5bb Cleanup 2023-05-20 00:44:54 +01:00
justin 938809a3a1 Continue to work on targeting inventory items 2023-05-20 00:34:23 +01:00
justin 6053bb059b Move targeting strings, broke targeting usage 2023-05-20 00:02:50 +01:00
justin 2d3b76dfd4 Move towards positional item targeting 2023-05-19 23:03:52 +01:00
61 changed files with 418 additions and 445 deletions
+18
View File
@@ -19,6 +19,7 @@ import Dodge.Base.Arithmetic
import Dodge.Base.NewID import Dodge.Base.NewID
import Dodge.Base.Coordinate import Dodge.Base.Coordinate
import Dodge.Base.CardinalPoint import Dodge.Base.CardinalPoint
import Data.List (unfoldr)
--import Dodge.Zone --import Dodge.Zone
--import Dodge.Zone.Data --import Dodge.Zone.Data
import Dodge.Base.Window import Dodge.Base.Window
@@ -146,3 +147,20 @@ dbArg f x = f x x
-- TODO check whether this is simply the reader monad, flipped -- TODO check whether this is simply the reader monad, flipped
dbArgChain :: (a -> b -> b) -> (a -> b -> b) -> a -> b -> b dbArgChain :: (a -> b -> b) -> (a -> b -> b) -> a -> b -> b
dbArgChain f g x = f x . g x dbArgChain f g x = f x . g x
spreadAroundCenter :: Int -> Float -> [Float]
spreadAroundCenter i x = [x * fromIntegral j - x*fromIntegral (i-1)*0.5 | j <- [0 .. i - 1]]
spreadFromCenter :: Int -> Float -> [Float]
spreadFromCenter i x = [x * fromIntegral j | j <- js]
where
js = take i outwardIntegers
outwardIntegers :: [Int]
outwardIntegers = unfoldr f (0, False)
where
f (x,True) = Just (x, (x,False))
f (x,False) = Just (-x, (x+1,True))
spreadCenter :: Int -> Float -> [Float]
spreadCenter i x = [x * fromIntegral j - x*fromIntegral (i-1)*0.5 | j <- [0 .. i - 1]]
+1 -1
View File
@@ -11,7 +11,7 @@ drawBeam bd = case bd of
basicDrawBeam :: Beam -> Picture basicDrawBeam :: Beam -> Picture
basicDrawBeam bm = basicDrawBeam bm =
setLayer BloomNoZWrite $ setLayer BloomNoZWrite $
pictures fold
[ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 20 ps [ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 20 ps
, setDepth 19.5 . color (brightX 10 1 col) $ thickLine 3 ps , setDepth 19.5 . color (brightX 10 1 col) $ thickLine 3 ps
] ]
+3 -2
View File
@@ -3,6 +3,7 @@ module Dodge.Bullet (
useAmmoParams, useAmmoParams,
) where ) where
import Linear
import Dodge.Item.Weapon.Bullet import Dodge.Item.Weapon.Bullet
import System.Random import System.Random
import Data.Foldable import Data.Foldable
@@ -59,13 +60,13 @@ useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it cr w = useAmmoParams it cr w =
w & cWorld . lWorld . instantBullets w & cWorld . lWorld . instantBullets
.:~ ( _amBullet bultype .:~ ( _amBullet bultype
& buPos .~ sp & buPos .~ _crPos cr
& buTrajectory %~ settrajectory & buTrajectory %~ settrajectory
& buVel %~ (rotateV dir . (muzvel *.*)) & buVel %~ (rotateV dir . (muzvel *.*))
& buDrag *~ _rifling (_itParams it) & buDrag *~ _rifling (_itParams it)
) )
where where
sp = _crPos cr +.+ (muzlength + 10) *.* unitVectorAtAngle dir sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
dir = _crDir cr dir = _crDir cr
bultype = _laAmmoType $ _heldConsumption $ _itUse it bultype = _laAmmoType $ _heldConsumption $ _itUse it
muzvel = _muzVel $ _itParams it muzvel = _muzVel $ _itParams it
+2 -2
View File
@@ -17,7 +17,7 @@ moduleModification imt = case imt of
. (itUse . heldConsumption . laAmmoType . amBullet . buTimer .~ 3) . (itUse . heldConsumption . laAmmoType . amBullet . buTimer .~ 3)
BULPAY thepayload -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ thepayload BULPAY thepayload -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ thepayload
BULBODY thebody -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ thebody BULBODY thebody -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ thebody
TARGET t -> itUse . useTargeting ?~ t TARGET {} -> id -- itUse . useTargeting ?~ t
BULTRAJ BasicBulletTrajectoryType -> id BULTRAJ BasicBulletTrajectoryType -> id
BULTRAJ MagnetTrajectoryType -> BULTRAJ MagnetTrajectoryType ->
(itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0) (itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0)
@@ -38,7 +38,7 @@ moduleModification imt = case imt of
where where
makeDirectedTele it = makeDirectedTele it =
it it
& itUse . useTargeting ?~ TargetRBPress -- & itUse . useTargeting ?~ TargetRBPress
& itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
-- for the camera: the simplest option is to remove all zoom/offset -- for the camera: the simplest option is to remove all zoom/offset
& itUse . heldAim . aimZoom . izFac .~ 1 & itUse . heldAim . aimZoom . izFac .~ 1
+1
View File
@@ -259,6 +259,7 @@ stackedInventory =
, flatShield , flatShield
, spawnGun (lamp 5) , spawnGun (lamp 5)
, lasGun , lasGun
, lasWide 20
, flameThrower , flameThrower
, poisonSprayer , poisonSprayer
, launcher , launcher
+4 -11
View File
@@ -37,7 +37,7 @@ import qualified Data.Map as M
import Foreign.ForeignPtr import Foreign.ForeignPtr
import Control.Concurrent import Control.Concurrent
colouredEnemy col = pictures [color col $ circleSolid 10, circLine 10] colouredEnemy col = color col $ circleSolid 10, circLine 10
spawnerCrit :: Creature spawnerCrit :: Creature
spawnerCrit = defaultCreature spawnerCrit = defaultCreature
@@ -155,22 +155,15 @@ addArmour = over crInv insarmour
where i = newKey xs where i = newKey xs
equipOnTop :: (Creature -> Picture) -> Creature -> Picture equipOnTop :: (Creature -> Picture) -> Creature -> Picture
--equipOnTop f cr = onLayer CrLayer $ pictures $ fst (drawEquipment cr) ++ [f cr] ++ snd (drawEquipment cr) equipOnTop f cr = onLayer CrLayer (f cr) <> drawEquipment cr
equipOnTop f cr = pictures [onLayer CrLayer (f cr) , drawEquipment cr]
drawEquipment :: Creature -> Picture drawEquipment :: Creature -> Picture
drawEquipment cr = pictures $ map f $ IM.toList (_crInv cr) drawEquipment cr = foldMap f $ IM.toList (_crInv cr)
where f (i,it) = case it ^? itEquipPict of where f (i,it) = case it ^? itEquipPict of
Just g -> g cr i Just g -> g cr i
_ -> blank _ -> blank
--drawEquipment :: Creature -> ([Picture],[Picture]) frontArmouredPict = const $ fold [ color (greyN 0.8) $ circleSolid 20
--drawEquipment cr = (map fst p1, map fst p2)
-- where f (k,it) = join $ (it ^? itEquipPict) <*> (pure cr) <*> (pure k)
-- picts = sortBy (compare `on` snd) $ mapMaybe f $ IM.toList (_crInv cr)
-- (p1,p2) = partition (\ x -> snd x < 0) picts
frontArmouredPict = const $ pictures [ color (greyN 0.8) $ circleSolid 20
, color red $ circLine 20 , color red $ circLine 20
] ]
+20 -10
View File
@@ -1,5 +1,6 @@
module Dodge.Creature.HandPos where module Dodge.Creature.HandPos where
import Linear
import Control.Lens import Control.Lens
import Data.Maybe import Data.Maybe
import Dodge.Creature.Test import Dodge.Creature.Test
@@ -8,22 +9,31 @@ import Geometry
import ShapePicture import ShapePicture
-- the position of a weapon handle -- the position of a weapon handle
aimingWeaponHandlePos :: Creature -> Item -> Float aimingWeaponHandlePos :: Creature -> Item -> Point2
aimingWeaponHandlePos cr it = case it ^? itUse . heldAim . aimStance of aimingWeaponHandlePos _ it = case it ^? itUse . heldAim . aimStance of
Just TwoHandTwist -> -5 Just TwoHandUnder -> 0
Just OneHand -> 14 Just TwoHandOver -> V2 (-7) 0
Just TwoHandFlat -> 1.2 * _crRad cr Just OneHand -> V2 10 (-2)
Just TwoHandFlat -> V2 10 0
Nothing -> 0 Nothing -> 0
aimingWeaponZeroPos :: Creature -> Item -> Float aimingWeaponZeroPos :: Creature -> Item -> Point2
aimingWeaponZeroPos cr it = aimingWeaponZeroPos cr it =
aimingWeaponHandlePos cr it aimingWeaponHandlePos cr it
- fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos) - fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos)
aimingMuzzlePos :: Creature -> Item -> Float aimingMuzzlePos :: Creature -> Item -> [Point2]
aimingMuzzlePos cr it = aimingMuzzlePos cr it = fmap ((+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
aimingWeaponZeroPos cr it where
+ fromMaybe 0 (it ^? itUse . heldAim . aimMuzPos) zp = aimingWeaponZeroPos cr it
aimingMuzzleOff :: Creature -> Item -> [Point2]
aimingMuzzleOff cr it = fmap (rotateV (_crDir cr) . (+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
where
zp = aimingWeaponZeroPos cr it
aimingMuzzleLength :: Creature -> Item -> Float
aimingMuzzleLength cr it = head (aimingMuzzlePos cr it) ^. _x
translatePointToRightHand :: Creature -> Point3 -> Point3 translatePointToRightHand :: Creature -> Point3 -> Point3
translatePointToRightHand cr = translatePointToRightHand' cr . mirrorV3xz translatePointToRightHand cr = translatePointToRightHand' cr . mirrorV3xz
+4 -2
View File
@@ -5,8 +5,6 @@ module Dodge.Creature.Impulse.UseItem (
useItemHotkey, useItemHotkey,
) where ) where
import Dodge.Inventory.RBList
import Dodge.Hotkey
import Control.Lens import Control.Lens
import Control.Monad import Control.Monad
import Data.Foldable import Data.Foldable
@@ -15,7 +13,9 @@ import Dodge.Cuse
import Dodge.Data.World import Dodge.Data.World
import Dodge.Euse import Dodge.Euse
import Dodge.HeldUse import Dodge.HeldUse
import Dodge.Hotkey
import Dodge.Inventory import Dodge.Inventory
import Dodge.Item.Location
import Dodge.Luse import Dodge.Luse
import Dodge.Reloading import Dodge.Reloading
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
@@ -28,6 +28,7 @@ useItemRightClick cr' w = fromMaybe (f w) $ do
return $ return $
itemEffect cr it w itemEffect cr it w
& worldEventFlags . at InventoryChange ?~ () & worldEventFlags . at InventoryChange ?~ ()
& f
where where
f = cWorld . lWorld . creatures . ix (_crID cr') . crHammerPosition .~ HammerDown f = cWorld . lWorld . creatures . ix (_crID cr') . crHammerPosition .~ HammerDown
@@ -35,6 +36,7 @@ itemEffect :: Creature -> Item -> World -> World
itemEffect cr it w = case it ^. itUse of itemEffect cr it w = case it ^. itUse of
HeldUse{_heldUse = eff, _heldMods = usemods} -> HeldUse{_heldUse = eff, _heldMods = usemods} ->
foldl' (&) (useHeld eff) (useMod usemods) it cr w foldl' (&) (useHeld eff) (useMod usemods) it cr w
& pointerToItem it . itUse . heldHammer .~ HammerDown
LeftUse{} -> doequipmentchange LeftUse{} -> doequipmentchange
EquipUse{} -> doequipmentchange EquipUse{} -> doequipmentchange
-- ConsumeUse will cause problems if the item is not selected -- ConsumeUse will cause problems if the item is not selected
+7 -21
View File
@@ -3,6 +3,8 @@ module Dodge.Creature.State (
doDamage, doDamage,
) where ) where
import Dodge.Item.Display -- this should not really be imported... TODO move canAttachTargetingBelow
import Control.Applicative
import Data.Foldable import Data.Foldable
import Data.Maybe import Data.Maybe
import Dodge.Base import Dodge.Base
@@ -15,7 +17,7 @@ import Dodge.Creature.Test
import Dodge.Damage import Dodge.Damage
import Dodge.Data.World import Dodge.Data.World
import Dodge.EnergyBall import Dodge.EnergyBall
import Dodge.Equipment --import Dodge.Equipment
import Dodge.Euse import Dodge.Euse
import Dodge.Hammer import Dodge.Hammer
import Dodge.ItEffect import Dodge.ItEffect
@@ -271,14 +273,12 @@ updateAutoRecharge it = case it ^? itUse . leftConsumption of
crGetTargeting :: Creature -> Maybe TargetType crGetTargeting :: Creature -> Maybe TargetType
crGetTargeting cr = do crGetTargeting cr = do
itm <- find hastargeting $ helditem ++ IM.elems (getCrEquipment cr)
itm ^? itUse . useTargeting . _Just
where
hastargeting itm = isJust (itm ^? itUse . useTargeting . _Just)
helditem = fromMaybe [] $ do
i <- cr ^? crManipulation . manObject . inInventory . ispItem i <- cr ^? crManipulation . manObject . inInventory . ispItem
itm <- cr ^? crInv . ix i itm <- cr ^? crInv . ix i
return [itm] --(cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just)
itm ^? itType . iyModules . ix ModTarget . imtTargetType
<|> (guard (canAttachTargetingBelow itm)
>> cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just)
weaponReloadSounds :: Creature -> World -> World weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of
@@ -291,20 +291,6 @@ weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory .
w w
_ -> w _ -> w
where where
-- PassiveReload stype | Just (_laReloadTime am) == am ^? laTransfer . transferTime
-- -> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
-- PassiveReload _ -> w
-- ActiveClear | am ^? laTransfer . transferTime == Just 0 -> stopSoundFrom (CrReloadSound cid) w
-- ActiveClear | _laTransfer am == NoTransfer -> w
-- ActiveClear -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
-- ActivePartial{} | am ^? laTransfer . transferTime == Just 0 -> stopSoundFrom (CrReloadSound cid) w
-- ActivePartial{} | _laTransfer am == NoTransfer -> w
-- ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
-- Just ChargeableAmmo {} -> w
-- Just NoConsumption {} -> w
-- Just ItemItselfConsumable {} -> w
-- Nothing -> w
cid = _crID cr cid = _crID cr
updateMovement :: Creature -> Creature updateMovement :: Creature -> Creature
+3 -2
View File
@@ -103,7 +103,7 @@ twoFlat :: Creature -> Bool
twoFlat = crInAimStance TwoHandFlat twoFlat = crInAimStance TwoHandFlat
twists :: Creature -> Bool twists :: Creature -> Bool
twists = crInAimStance TwoHandTwist twists cr = crInAimStance TwoHandUnder cr || crInAimStance TwoHandOver cr
-- the use of crOldPos is because the damage position is calculated on the -- the use of crOldPos is because the damage position is calculated on the
-- previous frame -- previous frame
@@ -124,7 +124,8 @@ hasFrontArmour p cr = fromMaybe False $ do
frontarmdirection frontarmdirection
| crInAimStance OneHand cr = 0.5 | crInAimStance OneHand cr = 0.5
| crInAimStance TwoHandTwist cr = negate 1 | crInAimStance TwoHandUnder cr = negate 1
| crInAimStance TwoHandOver cr = negate 1
| otherwise = 0 | otherwise = 0
--crOnSeg :: Point2 -> Point2 -> Creature -> Bool --crOnSeg :: Point2 -> Point2 -> Creature -> Bool
+5 -1
View File
@@ -117,7 +117,11 @@ wasdWithAiming w speed cr
astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance
let currenttwistamount = cr ^. crTwist let currenttwistamount = cr ^. crTwist
case (astance, currenttwistamount) of case (astance, currenttwistamount) of
(TwoHandTwist, 0) -> (TwoHandUnder, 0) ->
return $
(crTwist .~ twistamount * pi)
. (crDir -~ twistamount * pi)
(TwoHandOver, 0) ->
return $ return $
(crTwist .~ twistamount * pi) (crTwist .~ twistamount * pi)
. (crDir -~ twistamount * pi) . (crDir -~ twistamount * pi)
+3 -2
View File
@@ -190,8 +190,8 @@ data ItemModuleType
| MAGNETMAG | MAGNETMAG
| BULPAY BulletSpawn | BULPAY BulletSpawn
| BULBODY BulletEffect | BULBODY BulletEffect
| BULTRAJ BulletTrajectoryType | BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
| TARGET TargetType | TARGET {_imtTargetType :: TargetType}
| INCENDLAS | INCENDLAS
| SPLITLAS | SPLITLAS
| STATICLAS | STATICLAS
@@ -224,6 +224,7 @@ data ModuleSlot
makeLenses ''ItemType makeLenses ''ItemType
makeLenses ''ItemBaseType makeLenses ''ItemBaseType
makeLenses ''HeldItemType makeLenses ''HeldItemType
makeLenses ''ItemModuleType
deriveJSON defaultOptions ''Stack deriveJSON defaultOptions ''Stack
deriveJSON defaultOptions ''CraftType deriveJSON defaultOptions ''CraftType
deriveJSON defaultOptions ''ConsumableItemType deriveJSON defaultOptions ''ConsumableItemType
+9 -22
View File
@@ -48,7 +48,6 @@ data ItemParams
{ _muzVel :: Float { _muzVel :: Float
, _rifling :: Float , _rifling :: Float
, _bore :: Float , _bore :: Float
, _gunBarrels :: GunBarrels
, _recoil :: Float , _recoil :: Float
, _torqueAfter :: Float , _torqueAfter :: Float
, _randomOffset :: Float , _randomOffset :: Float
@@ -76,17 +75,15 @@ data ShrinkGunStatus = FullSize | Shrunk
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
data GunBarrels --data GunBarrels
= MultiBarrel ---- = MultiBarrel
{ _brlSpread :: BarrelSpread ---- { _brlSpread :: BarrelSpread
, _brlNum :: Int ---- , _brlNum :: Int
, _brlInaccuracy :: Float ---- , _brlInaccuracy :: Float
} ---- }
| RotBarrel -- = BarrelList
{ _brlNum :: Int -- { _brlList :: [GunBarrel]
, _brlInaccuracy :: Float -- }
}
| SingleBarrel {_brlInaccuracy :: Float}
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Nozzle = Nozzle data Nozzle = Nozzle
@@ -99,19 +96,9 @@ data Nozzle = Nozzle
} }
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
data BarrelSpread
= AlignedBarrels
| SpreadBarrels {_spreadAngle :: Float}
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''BarrelSpread
makeLenses ''ItemParams makeLenses ''ItemParams
makeLenses ''Nozzle makeLenses ''Nozzle
makeLenses ''GunBarrels
deriveJSON defaultOptions ''ShrinkGunStatus deriveJSON defaultOptions ''ShrinkGunStatus
deriveJSON defaultOptions ''PreviousArcEffect deriveJSON defaultOptions ''PreviousArcEffect
deriveJSON defaultOptions ''Nozzle deriveJSON defaultOptions ''Nozzle
deriveJSON defaultOptions ''BarrelSpread
deriveJSON defaultOptions ''GunBarrels
deriveJSON defaultOptions ''ItemParams deriveJSON defaultOptions ''ItemParams
+16 -5
View File
@@ -14,6 +14,7 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Item.Targeting, module Dodge.Data.Item.Targeting,
) where ) where
import Linear
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -34,7 +35,7 @@ data ItemUse
, _heldAim :: AimParams , _heldAim :: AimParams
, _heldScroll :: HeldScroll , _heldScroll :: HeldScroll
, _heldConsumption :: HeldConsumption , _heldConsumption :: HeldConsumption
, _useTargeting :: Maybe TargetType -- , _useTargeting :: Maybe TargetType
} }
| LeftUse | LeftUse
{ _leftUse :: Luse { _leftUse :: Luse
@@ -49,7 +50,7 @@ data ItemUse
} }
| EquipUse | EquipUse
{ _equipEffect :: EquipEffect { _equipEffect :: EquipEffect
, _useTargeting :: Maybe TargetType , _equipTargeting :: Maybe TargetType
} }
| CraftUse | CraftUse
{_useAmount :: ItAmount} {_useAmount :: ItAmount}
@@ -71,13 +72,21 @@ data AimParams = AimParams
, _aimRange :: Float , _aimRange :: Float
, _aimZoom :: ItZoom , _aimZoom :: ItZoom
, _aimStance :: AimStance , _aimStance :: AimStance
, _aimHandlePos :: Float , _aimHandlePos :: V2 Float
, _aimMuzPos :: Float , _aimMuzzles :: [Muzzle]
} }
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Muzzle = Muzzle
{ _mzPos :: V2 Float
, _mzRot :: Float
, _mzInaccuracy :: Float
}
data AimStance data AimStance
= TwoHandTwist = TwoHandUnder
| TwoHandOver
| TwoHandFlat | TwoHandFlat
| OneHand | OneHand
-- | LeaveHolstered -- | LeaveHolstered
@@ -94,6 +103,8 @@ data ItZoom = ItZoom
makeLenses ''ItemUse makeLenses ''ItemUse
makeLenses ''AimParams makeLenses ''AimParams
makeLenses ''ItZoom makeLenses ''ItZoom
makeLenses ''Muzzle
deriveJSON defaultOptions ''Muzzle
deriveJSON defaultOptions ''AimStance deriveJSON defaultOptions ''AimStance
deriveJSON defaultOptions ''ItZoom deriveJSON defaultOptions ''ItZoom
deriveJSON defaultOptions ''AimParams deriveJSON defaultOptions ''AimParams
+2 -2
View File
@@ -22,13 +22,13 @@ addRoomLinkDecorations rms w =
%~ IM.insertWithNewKeys (map roomLinkDecorations rms) %~ IM.insertWithNewKeys (map roomLinkDecorations rms)
roomLinkDecorations :: Room -> Picture roomLinkDecorations :: Room -> Picture
roomLinkDecorations rm = pictures . map (linkDecoration . lnkPosDir) $ _rmLinks rm roomLinkDecorations rm = foldMap (linkDecoration . lnkPosDir) $ _rmLinks rm
linkDecoration :: (Point2, Float) -> Picture linkDecoration :: (Point2, Float) -> Picture
linkDecoration (p, a) = setLayer DebugLayer . color red $ line [p, p +.+ 20 *.* unitVectorAtAngle (a - pi / 2)] linkDecoration (p, a) = setLayer DebugLayer . color red $ line [p, p +.+ 20 *.* unitVectorAtAngle (a - pi / 2)]
roomPolyDecorations :: Room -> Picture roomPolyDecorations :: Room -> Picture
roomPolyDecorations rm = pictures . map polyWireFrame $ _rmPolys rm roomPolyDecorations rm = foldMap polyWireFrame $ _rmPolys rm
polyWireFrame :: [Point2] -> Picture polyWireFrame :: [Point2] -> Picture
polyWireFrame (x : xs) = setLayer DebugLayer . setDepth 50 . color green $ line $ (x : xs) ++ [x] polyWireFrame (x : xs) = setLayer DebugLayer . setDepth 50 . color green $ line $ (x : xs) ++ [x]
+3 -3
View File
@@ -33,13 +33,13 @@ import Dodge.Render.Label
import Dodge.WorldEvent.ThingsHit import Dodge.WorldEvent.ThingsHit
printPoint :: Point2 -> Picture printPoint :: Point2 -> Picture
printPoint p = color white $ uncurryV translate p $ pictures [circle 3, scale 0.05 0.05 $ text (show p)] printPoint p = color white $ uncurryV translate p $ fold [circle 3, scale 0.05 0.05 $ text (show p)]
printRotPoint :: Float -> Point2 -> Picture printRotPoint :: Float -> Point2 -> Picture
printRotPoint r p = printRotPoint r p =
color white color white
. uncurryV translate p . uncurryV translate p
$ pictures [circle 3, rotate (negate r) $ scale 0.1 0.1 $ text (show p)] $ fold [circle 3, rotate (negate r) $ scale 0.1 0.1 $ text (show p)]
outsideScreenPolygon :: Configuration -> Camera -> [Point2] outsideScreenPolygon :: Configuration -> Camera -> [Point2]
outsideScreenPolygon cfig w = [tr, tl, bl, br] outsideScreenPolygon cfig w = [tr, tl, bl, br]
@@ -150,7 +150,7 @@ debugDraw' cfig w bl = case bl of
Show_zone_near_point_cursor -> drawZoneNearPointCursor w Show_zone_near_point_cursor -> drawZoneNearPointCursor w
Inspect_wall -> drawInspectWalls w Inspect_wall -> drawInspectWalls w
Cr_awareness -> drawCreatureDisplayTexts w Cr_awareness -> drawCreatureDisplayTexts w
Show_sound -> pictures $ M.map (soundPic cfig w) $ _playingSounds w Show_sound -> fold $ M.map (soundPic cfig w) $ _playingSounds w
Cr_status -> drawCrInfo cfig w Cr_status -> drawCrInfo cfig w
Mouse_position -> drawMousePosition w Mouse_position -> drawMousePosition w
Walls_info -> drawWlIDs w Walls_info -> drawWlIDs w
+2 -2
View File
@@ -23,7 +23,7 @@ defaultLeftUse =
defaultEquipUse :: ItemUse defaultEquipUse :: ItemUse
defaultEquipUse = EquipUse defaultEquipUse = EquipUse
{ _equipEffect = defaultEquip { _equipEffect = defaultEquip
, _useTargeting = Nothing , _equipTargeting = Nothing
} }
defaultHeldUse :: ItemUse defaultHeldUse :: ItemUse
@@ -36,5 +36,5 @@ defaultHeldUse =
, _heldAim = defaultAimParams , _heldAim = defaultAimParams
, _heldScroll = HeldScrollDoNothing , _heldScroll = HeldScrollDoNothing
, _heldConsumption = defaultLoadable , _heldConsumption = defaultLoadable
, _useTargeting = Nothing -- , _useTargeting = Nothing
} }
+5 -2
View File
@@ -1,6 +1,7 @@
module Dodge.Default.Item.Use.AimParams where module Dodge.Default.Item.Use.AimParams where
import Dodge.Data.Item.Use import Dodge.Data.Item.Use
import Linear
defaultAimParams :: AimParams defaultAimParams :: AimParams
defaultAimParams = defaultAimParams =
@@ -10,6 +11,8 @@ defaultAimParams =
, _aimRange = 0 , _aimRange = 0
, _aimZoom = ItZoom 20 0.2 1 , _aimZoom = ItZoom 20 0.2 1
, _aimStance = OneHand , _aimStance = OneHand
, _aimHandlePos = 10 --, _aimHandlePos = 10
, _aimMuzPos = 20 , _aimHandlePos = V2 3 0
, _aimMuzzles = [Muzzle (V2 20 0) 0 0]
-- , _aimMuzPos = 20
} }
+1 -1
View File
@@ -22,7 +22,7 @@ drawStaticBall pt =
drawFlamelet :: EnergyBall -> Picture drawFlamelet :: EnergyBall -> Picture
drawFlamelet pt = drawFlamelet pt =
pictures fold
[ setLayer BloomLayer pic [ setLayer BloomLayer pic
, setLayer BloomNoZWrite piu , setLayer BloomNoZWrite piu
, setLayer BloomNoZWrite pi2 , setLayer BloomNoZWrite pi2
+1 -1
View File
@@ -8,7 +8,7 @@ drawFlame ::
Flame -> Flame ->
Picture Picture
drawFlame pt = drawFlame pt =
pictures fold
[ glow [ glow
, aPic BloomNoZWrite prot2 25 (V2 (scaleChange + 1) 2) $ V4 2 (-1) (-1) 0.5 , aPic BloomNoZWrite prot2 25 (V2 (scaleChange + 1) 2) $ V4 2 (-1) (-1) 0.5
, aPic BloomNoZWrite prot 22 (V2 (scaleChange + 0.5) 1) $ V4 1 0.5 0 2 , aPic BloomNoZWrite prot 22 (V2 (scaleChange + 0.5) 1) $ V4 1 0.5 0 2
+39 -41
View File
@@ -72,36 +72,37 @@ useMod hm = case hm of
] ]
CircleLaserMod -> CircleLaserMod ->
[ duplicateItem fLasCircle [ duplicateItem fLasCircle
, withItemUpdate' increasecycleLasCircle
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8 , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it)) , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItemUpdateFirst increasecycleLasCircle
, ammoCheckI , ammoCheckI
] ]
LasWideMod n -> LasWideMod n ->
[ withItem $ \it -> duplicateOffsetsV2 (xsLasWide it) [ useAmmoAmount 1
, withItemUpdate' (increasecycleLasWide n) , withItem $ \it -> duplicateNumBarrels (min
, crAtMuzPos (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
, useAmmoAmount 1 (it ^?! itParams . lasCycle `div` lasWideRate))
, withSoundForI tone440sawtoothquietS 2 , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it)) , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
, withItemUpdateFirst (increasecycleLasWide n)
, ammoCheckI , ammoCheckI
] ]
DualBeamMod -> DualBeamMod ->
[ useAmmoAmount 1 [ useAmmoAmount 1
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withMuzPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8 , withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
, withItem $ \it -> withMuzPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8 , withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, ammoCheckI , ammoCheckI
] ]
LasMod -> LasMod ->
[ crAtMuzPos [ useAmmoAmount 1
, useAmmoAmount 1 , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it)) , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, duplicateLoadedBarrels
, ammoCheckI , ammoCheckI
] ]
LauncherXMod i -> LauncherXMod i ->
@@ -130,7 +131,7 @@ useMod hm = case hm of
[ withMuzFlareI [ withMuzFlareI
, withSmoke 1 black 20 200 5 , withSmoke 1 black 20 200 5
, withRecoil , withRecoil
, applyInaccuracy , duplicateLoadedBarrels
, withTorqueAfter , withTorqueAfter
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart tap3S , withSoundStart tap3S
@@ -141,7 +142,6 @@ useMod hm = case hm of
VolleyGunMod -> VolleyGunMod ->
[ withRecoil [ withRecoil
, withMuzFlareI , withMuzFlareI
, applyInaccuracy
, duplicateLoadedBarrels , duplicateLoadedBarrels
, withTorqueAfter , withTorqueAfter
, useAllAmmo , useAllAmmo
@@ -155,7 +155,7 @@ useMod hm = case hm of
[ withMuzFlareI [ withMuzFlareI
, withSmoke 1 black 20 200 5 , withSmoke 1 black 20 200 5
, withRecoil , withRecoil
, applyInaccuracy , duplicateLoadedBarrels
, withTorqueAfter , withTorqueAfter
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart tap3S , withSoundStart tap3S
@@ -166,7 +166,7 @@ useMod hm = case hm of
[ withRecoil [ withRecoil
, withMuzFlareI , withMuzFlareI
, withThickSmokeI , withThickSmokeI
, applyInaccuracy , duplicateLoadedBarrels
, withTorqueAfter , withTorqueAfter
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart bangEchoS , withSoundStart bangEchoS
@@ -178,7 +178,7 @@ useMod hm = case hm of
[ withRecoil [ withRecoil
, withMuzFlareI , withMuzFlareI
, withThickSmokeI , withThickSmokeI
, applyInaccuracy , duplicateLoadedBarrels
, withTorqueAfter , withTorqueAfter
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart bangEchoS , withSoundStart bangEchoS
@@ -190,7 +190,7 @@ useMod hm = case hm of
[ withRecoil [ withRecoil
, withMuzFlareI , withMuzFlareI
, withThickSmokeI , withThickSmokeI
, applyInaccuracy , duplicateLoadedBarrels
, withTorqueAfter , withTorqueAfter
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart bangEchoS , withSoundStart bangEchoS
@@ -208,22 +208,21 @@ useMod hm = case hm of
reverse $ withPosDirWallCheck directedTelPos : useMod hm' reverse $ withPosDirWallCheck directedTelPos : useMod hm'
BangStickMod -> BangStickMod ->
[ withRecoil [ withRecoil
-- , applyInaccuracy
, spreadLoaded
, withTorqueAfter
, withMuzFlareI
, useAllAmmo , useAllAmmo
, withSoundItemChoiceStart bangStickSoundChoice , withSoundItemChoiceStart bangStickSoundChoice
, duplicateLoadedBarrels
, withTorqueAfter
, withMuzFlareI
, useTimeCheck , useTimeCheck
, ammoCheckI , ammoCheckI
, blCheck , blCheck
] ]
PistolMod -> PistolMod ->
[ withMuzFlareI [ withSidePushI 50
, withSidePushI 50
, withRecoil , withRecoil
, withMuzFlareI
, withTorqueAfter , withTorqueAfter
, applyInaccuracy , duplicateLoadedBarrels
, withSoundStart tap3S , withSoundStart tap3S
, useAmmoAmount 1 , useAmmoAmount 1
, useTimeCheck , useTimeCheck
@@ -235,7 +234,7 @@ useMod hm = case hm of
, withSidePushI 50 , withSidePushI 50
, withRecoil , withRecoil
, withTorqueAfter , withTorqueAfter
, applyInaccuracy , duplicateLoadedBarrels
, withSoundStart tap3S , withSoundStart tap3S
, useAmmoAmount 1 , useAmmoAmount 1
, useTimeCheck , useTimeCheck
@@ -246,7 +245,7 @@ useMod hm = case hm of
, withRecoil , withRecoil
, withSidePushI 50 , withSidePushI 50
, withTorqueAfter , withTorqueAfter
, applyInaccuracy , duplicateLoadedBarrels
, withSoundStart tap1S , withSoundStart tap1S
, useAmmoAmount 1 , useAmmoAmount 1
, useTimeCheck , useTimeCheck
@@ -255,7 +254,7 @@ useMod hm = case hm of
BurstRifleMod -> BurstRifleMod ->
[ withRecoil [ withRecoil
, withMuzFlareI , withMuzFlareI
, applyInaccuracy , duplicateLoadedBarrels
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart tap3S , withSoundStart tap3S
, repeatOnFrames [3, 6] BurstRifleRepeatMod , repeatOnFrames [3, 6] BurstRifleRepeatMod
@@ -268,7 +267,7 @@ useMod hm = case hm of
BurstRifleRepeatMod -> BurstRifleRepeatMod ->
[ withRecoil [ withRecoil
, withMuzFlareI , withMuzFlareI
, applyInaccuracy , duplicateLoadedBarrels
, useAmmoAmount 1 , useAmmoAmount 1
, withSoundStart tap3S , withSoundStart tap3S
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2) , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
@@ -295,7 +294,7 @@ useMod hm = case hm of
, withSidePushI 30 , withSidePushI 30
, withRecoil , withRecoil
, withTorqueAfter , withTorqueAfter
, applyInaccuracy , duplicateLoadedBarrels
, withSoundStart tap3S , withSoundStart tap3S
, useAmmoAmount 1 , useAmmoAmount 1
, useTimeCheck , useTimeCheck
@@ -306,7 +305,7 @@ useMod hm = case hm of
, withTorqueAfter , withTorqueAfter
-- , spreadLoaded -- , spreadLoaded
, withMuzFlareI , withMuzFlareI
, applyInaccuracy , duplicateLoadedBarrels
, useAmmoUpTo 1 , useAmmoUpTo 1
, withSoundStart tap3S , withSoundStart tap3S
, repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod , repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod
@@ -321,7 +320,7 @@ useMod hm = case hm of
[ withRecoil [ withRecoil
, withTorqueAfter , withTorqueAfter
, withMuzFlareI , withMuzFlareI
, applyInaccuracy , duplicateLoadedBarrels
, useAmmoUpTo 1 , useAmmoUpTo 1
, withSoundStart tap3S , withSoundStart tap3S
, ammoCheckI , ammoCheckI
@@ -330,9 +329,9 @@ useMod hm = case hm of
[ withRandomItemParams coneRandItemParams [ withRandomItemParams coneRandItemParams
, withRandomItemUpdate coneRandItemUpdate , withRandomItemUpdate coneRandItemUpdate
, withRandomOffset , withRandomOffset
, applyInaccuracy , duplicateLoadedBarrels
, withMuzFlareI
, duplicateLoaded , duplicateLoaded
, withMuzFlareI
, withRecoil , withRecoil
, withTorqueAfter , withTorqueAfter
, useAllAmmo , useAllAmmo
@@ -350,11 +349,7 @@ useMod hm = case hm of
fLasCircle it = [it & itParams . lasCycle +~ x | x <- [0, 50 .. 1999]] fLasCircle it = [it & itParams . lasCycle +~ x | x <- [0, 50 .. 1999]]
increasecycleLasWide n it = case _heldHammer (_itUse it) of increasecycleLasWide n it = case _heldHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1 HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * 5) . (+ 1)) _ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
xsLasWide it = [V2 ((0.2 * yoff x) ^ (2 :: Int)) (yoff x) | x <- [(0 :: Int) .. n' -1]]
where
yoff x = fromIntegral x - fromIntegral (n' -1) / 2
n' = _lasCycle (_itParams it)
thegapDualBeam = _dbGap . _itParams thegapDualBeam = _dbGap . _itParams
directedTelPos _ cr w = (p, a) directedTelPos _ cr w = (p, a)
where where
@@ -365,6 +360,9 @@ useMod hm = case hm of
cr & crDir %~ tweenAngles x (_crOldDir cr) cr & crDir %~ tweenAngles x (_crOldDir cr)
& crPos %~ alongSegBy x (_crOldPos cr) & crPos %~ alongSegBy x (_crOldPos cr)
lasWideRate :: Int
lasWideRate = 2
mcUseHeld :: HeldItemType -> Item -> Machine -> World -> World mcUseHeld :: HeldItemType -> Item -> Machine -> World -> World
mcUseHeld hit = case hit of mcUseHeld hit = case hit of
LASGUN -> mcShootLaser LASGUN -> mcShootLaser
@@ -512,7 +510,7 @@ shootTeslaArc it cr w =
where where
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
(w', ip) = makeTeslaArc (_itParams it) pos dir w (w', ip) = makeTeslaArc (_itParams it) pos dir w
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir pos = _crPos cr +.+ aimingMuzzleLength cr it *.* unitVectorAtAngle dir
dir = _crDir cr dir = _crDir cr
-- I believe because the targeting returns to nothing straight after you release -- I believe because the targeting returns to nothing straight after you release
+4 -5
View File
@@ -20,17 +20,16 @@ invSelectionItem cr i it =
, _siIsSelectable = True , _siIsSelectable = True
, _siColor = col , _siColor = col
, _siOffX = 0 , _siOffX = 0
, _siOffY = 0 , _siOffY = yoff
, _siPayload = () , _siPayload = ()
} }
where where
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i) anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i) anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
col = _itInvColor it col = _itInvColor it
pics = case _itCurseStatus it of (yoff,pics) = case _itCurseStatus it of
UndroppableIdentified -> itemDisplay cr it UndroppableIdentified -> itemDisplayOffset cr it
-- _ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it _ -> itemDisplayOffset cr it
_ -> itemDisplay cr it
hotkeyToString :: Hotkey -> String hotkeyToString :: Hotkey -> String
hotkeyToString x = case x of hotkeyToString x = case x of
+39 -2
View File
@@ -1,5 +1,7 @@
module Dodge.Item.Display ( module Dodge.Item.Display (
itemDisplay, --itemDisplay,
itemDisplayOffset,
canAttachTargetingBelow,
-- selectedItemDisplay, -- selectedItemDisplay,
itemString, itemString,
itemBaseName, itemBaseName,
@@ -16,6 +18,36 @@ import Dodge.Module
import LensHelp import LensHelp
import Padding import Padding
itemDisplayOffset :: Creature -> Item -> (Int,[String])
itemDisplayOffset cr itm = case itm ^. itType . iyBase of
EQUIP (TARGETINGHAT tt) | targetItemCanAttachAbove cr itm
-> (-1, leftPad 15 ' ' (targetingTypeString tt) :
(itemDisplay cr itm & ix 0 %~ (\s -> itemDisplayPad s (replicate (length (targetingTypeString tt)) '^') )))
EQUIP (TARGETINGHAT tt)
-> (0, itemDisplay cr itm & ix 0 %~ (\s -> itemDisplayPad s (targetingTypeString tt)))
_ -> (0, itemDisplay cr itm)
targetItemCanAttachAbove :: Creature -> Item -> Bool
targetItemCanAttachAbove cr itm = fromMaybe False $ do
i <- itm ^? itLocation . ipInvID
itm' <- cr ^? crInv . ix (i - 1)
return $ canAttachTargetingBelow itm'
canAttachTargetingBelow :: Item -> Bool
canAttachTargetingBelow itm =
isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
|| Just LAUNCHHOME == (itm ^? itType . iyModules . ix ModLauncherHoming)
targetingTypeString :: TargetType -> String
targetingTypeString tt = case tt of
TargetLaser -> "LASER"
TargetRBPress -> "POS"
TargetRBLine -> ""
TargetRBCreature -> "LIFEFORM"
TargetCursor -> "CURSOR"
itemDisplay :: Creature -> Item -> [String] itemDisplay :: Creature -> Item -> [String]
itemDisplay cr itm = --itemDisplayWithNumber (showConsumption cr it) it itemDisplay cr itm = --itemDisplayWithNumber (showConsumption cr it) it
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm) zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
@@ -52,9 +84,14 @@ itemBaseName it = case _iyBase $ _itType it of
Just i -> takeWhile (/= ' ') (show hit) ++ show i Just i -> takeWhile (/= ' ') (show hit) ++ show i
Nothing -> show hit Nothing -> show hit
LEFT lit -> show lit LEFT lit -> show lit
EQUIP eit -> show eit EQUIP eit -> showEquipItem eit
Consumable cit -> show cit Consumable cit -> show cit
showEquipItem :: EquipItemType -> String
showEquipItem eit = case eit of
TARGETINGHAT _ -> "TARG.HAT"
_ -> show eit
showAutoRechargeProgress :: LeftConsumption -> String showAutoRechargeProgress :: LeftConsumption -> String
showAutoRechargeProgress lc = case lc of showAutoRechargeProgress lc = case lc of
AutoRecharging{} AutoRecharging{}
+8 -15
View File
@@ -32,7 +32,7 @@ equipItemSPic et _ = case et of
FRONTARMOUR -> FRONTARMOUR ->
( mempty ( mempty
, setDepth 20 $ , setDepth 20 $
pictures fold
[ color yellow $ thickArc 0 (pi / 2) 10 5 [ color yellow $ thickArc 0 (pi / 2) 10 5
, color yellow $ thickArc (3 * pi / 2) (2 * pi) 10 5 , color yellow $ thickArc (3 * pi / 2) (2 * pi) 10 5
] ]
@@ -118,14 +118,10 @@ ammoPosition itm hit = case hit of
rhs = Q.axisAngle (V3 1 0 0) 0 rhs = Q.axisAngle (V3 1 0 0) 0
bangStickAmmoPos :: Int -> Item -> AmmoPosition bangStickAmmoPos :: Int -> Item -> AmmoPosition
bangStickAmmoPos i itm = bangStickAmmoPos _ itm =
Bullets Bullets
[(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a) | a <- map f [0 .. i - 1]] [(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a)
where | a <- map _mzRot (itm ^?! itUse . heldAim . aimMuzzles)]
f n =
barrelspread * fromIntegral n
- 0.5 * barrelspread * fromIntegral (_brlNum (_gunBarrels (_itParams itm)) -1)
barrelspread = itm ^?! itParams . gunBarrels . brlSpread . spreadAngle
volleygunAmmoPos :: Int -> AmmoPosition volleygunAmmoPos :: Int -> AmmoPosition
volleygunAmmoPos i = volleygunAmmoPos i =
@@ -212,12 +208,9 @@ modulesSPic it _ imt = case imt of
_ -> mempty _ -> mempty
baseStickShapeX :: Item -> Int -> Shape baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX it i = foldMap f [0 .. i -1] baseStickShapeX it _ = foldMap f (it ^?! itUse . heldAim . aimMuzzles)
where where
f j = rotateSH ang baseStickShape f brl = rotateSH (_mzRot brl) baseStickShape
where
ang = fromIntegral j * barrelspread - (fromIntegral i - 1) * barrelspread * 0.5
barrelspread = it ^?! itParams . gunBarrels . brlSpread . spreadAngle
baseStickShape :: Shape baseStickShape :: Shape
baseStickShape = colorSH green $ xCylinderST 3 10 baseStickShape = colorSH green $ xCylinderST 3 10
@@ -226,7 +219,7 @@ bangConeShape :: Float -> Shape
bangConeShape x = bangConeShape x =
colorSH cyan $ colorSH cyan $
xCylinderST 3 x xCylinderST 3 x
<> upperPrismPolyST 6 (reverse $ rectNSWE 4 (-4) x (10 + x)) <> upperPrismPolyST 6 ( rectNSWE 4 (-4) x (10 + x))
defSPic :: SPic defSPic :: SPic
defSPic = noPic $ colorSH green $ upperPrismPolyST 3 $ square 4 defSPic = noPic $ colorSH green $ upperPrismPolyST 3 $ square 4
@@ -498,7 +491,7 @@ detectorColor dt = case dt of
keyPic :: Picture keyPic :: Picture
keyPic = keyPic =
color green $ color green $
pictures fold
[ translate (-4) 0 $ thickCircle 4 2 [ translate (-4) 0 $ thickCircle 4 2
, thickLine 2 $ map toV2 [(0, 0), (8, 0), (8, -4)] , thickLine 2 $ map toV2 [(0, 0), (8, 0), (8, -4)]
, thickLine 2 $ map toV2 [(4, 0), (4, -4)] , thickLine 2 $ map toV2 [(4, 0), (4, -4)]
+1 -1
View File
@@ -111,7 +111,7 @@ targetingHat tt =
defaultEquipment defaultEquipment
& itUse . equipEffect . eeSite .~ GoesOnHead & itUse . equipEffect . eeSite .~ GoesOnHead
& itType . iyBase .~ EQUIP (TARGETINGHAT tt) & itType . iyBase .~ EQUIP (TARGETINGHAT tt)
& itUse . useTargeting ?~ tt & itUse . equipTargeting ?~ tt
headLamp :: Item headLamp :: Item
headLamp = headLamp =
+11 -11
View File
@@ -1,5 +1,6 @@
module Dodge.Item.Held.BatteryGuns where module Dodge.Item.Held.BatteryGuns where
import Dodge.Base
import Dodge.Data.Beam import Dodge.Data.Beam
import Dodge.Default.Item import Dodge.Default.Item
import Color import Color
@@ -30,8 +31,8 @@ teslaGun =
& itUse . heldMods .~ TeslaMod & itUse . heldMods .~ TeslaMod
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat & itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimHandlePos .~ 4 -- & itUse . heldAim . aimMuzPos .~ 4
& itUse . heldAim . aimMuzPos .~ 4 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0]
& itType . iyBase .~ HELD TESLAGUN & itType . iyBase .~ HELD TESLAGUN
lasGun :: Item lasGun :: Item
@@ -39,7 +40,7 @@ lasGun =
defaultAutoBatteryGun defaultAutoBatteryGun
& itUse . heldConsumption & itUse . heldConsumption
.~ ( defaultLoadable .~ ( defaultLoadable
& laSource . _InternalSource . iaMax .~ 200 & laSource . _InternalSource . iaMax .~ 200000
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60] & laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
) )
& itParams & itParams
@@ -61,9 +62,10 @@ lasGun =
& itUse . heldMods .~ LasMod & itUse . heldMods .~ LasMod
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30 -- & itUse . heldAim . aimMuzPos .~ 30
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
& itType . iyBase .~ HELD LASGUN & itType . iyBase .~ HELD LASGUN
lasGunTweak :: TweakParam lasGunTweak :: TweakParam
@@ -92,9 +94,7 @@ tractorGun =
& itUse . heldMods .~ AmmoCheckMod & itUse . heldMods .~ AmmoCheckMod
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
& itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD TRACTORGUN & itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam tractorGunTweak :: TweakParam
@@ -112,6 +112,7 @@ lasWide n =
& itParams . lasColor .~ yellow & itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2 & itParams . lasDamage .~ 2
& itUse . heldMods .~ LasWideMod n & itUse . heldMods .~ LasWideMod n
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 y) 0 0 | y <- spreadFromCenter n 1]
defaultBatteryGun :: Item defaultBatteryGun :: Item
defaultBatteryGun = defaultBatteryGun =
@@ -143,13 +144,12 @@ lasCircle =
& itUse . heldMods .~ CircleLaserMod & itUse . heldMods .~ CircleLaserMod
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist
dualBeam :: Item dualBeam :: Item
dualBeam = dualBeam =
lasGun lasGun
& itType . iyBase .~ HELD DUALBEAM & itType . iyBase .~ HELD DUALBEAM
& itUse . heldAim . aimMuzPos .~ 0 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
& itParams & itParams
.~ DualBeam .~ DualBeam
{ _phaseV = 1 { _phaseV = 1
+11 -28
View File
@@ -7,6 +7,7 @@ module Dodge.Item.Held.Cane (
miniGunX, miniGunX,
) where ) where
import Dodge.Base
import Dodge.Data.Item import Dodge.Data.Item
import Dodge.Default import Dodge.Default
import Dodge.Reloading.Action import Dodge.Reloading.Action
@@ -21,10 +22,6 @@ defaultBangCane =
{ _muzVel = 0.8 { _muzVel = 0.8
, _rifling = 0.9 , _rifling = 0.9
, _bore = 2 , _bore = 2
, _gunBarrels =
SingleBarrel
{ _brlInaccuracy = 0.01
}
, _recoil = 50 , _recoil = 50
, _torqueAfter = 0.1 , _torqueAfter = 0.1
, _randomOffset = 0 , _randomOffset = 0
@@ -34,8 +31,8 @@ defaultBangCane =
& itUse . heldDelay . rateMax .~ 6 & itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ BangCaneMod & itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand & itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 15 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01]
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1 & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1] & itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
@@ -48,41 +45,32 @@ volleyGun i =
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat & itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 15 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
& itParams & itParams
.~ BulletShooter .~ BulletShooter
{ _muzVel = 0.8 { _muzVel = 0.8
, _rifling = 0.9 , _rifling = 0.9
, _bore = 2 , _bore = 2
, _gunBarrels =
SingleBarrel
{ _brlInaccuracy = 0.01
}
, _recoil = 50 , _recoil = 50
, _torqueAfter = 0.1 , _torqueAfter = 0.1
, _randomOffset = 0 , _randomOffset = 0
} }
& itParams . gunBarrels
.~ MultiBarrel
{ _brlSpread = AlignedBarrels
, _brlNum = i
, _brlInaccuracy = 0.1
}
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i & itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
& itType . iyBase .~ HELD (VOLLEYGUN i) & itType . iyBase .~ HELD (VOLLEYGUN i)
rifle :: Item rifle :: Item
rifle = rifle =
defaultBangCane defaultBangCane
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itType . iyBase .~ HELD RIFLE & itType . iyBase .~ HELD RIFLE
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1 & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 5, loadPrime 5] & itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 25 0) 0 0.01]
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE & itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
repeater :: Item repeater :: Item
@@ -105,7 +93,7 @@ burstRifle :: Item
burstRifle = burstRifle =
repeater repeater
& itType . iyBase .~ HELD BURSTRIFLE & itType . iyBase .~ HELD BURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.05 & itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
& itUse . heldDelay . rateMax .~ 18 & itUse . heldDelay . rateMax .~ 18
& itUse . heldMods .~ BurstRifleMod & itUse . heldMods .~ BurstRifleMod
@@ -117,9 +105,9 @@ miniGunUse i =
& heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100} & heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100}
& heldAim . aimWeight .~ 6 & heldAim . aimWeight .~ 6
& heldAim . aimRange .~ 1 & heldAim . aimRange .~ 1
& heldAim . aimStance .~ TwoHandTwist & heldAim . aimStance .~ TwoHandUnder
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& heldAim . aimHandlePos .~ 5 -- & heldAim . aimHandlePos .~ 5
& heldConsumption & heldConsumption
.~ (defaultBulletLoadable & laSource .~ AboveSource) .~ (defaultBulletLoadable & laSource .~ AboveSource)
--(defaultBulletLoadable --(defaultBulletLoadable
@@ -133,17 +121,12 @@ miniGunX i =
autoRifle autoRifle
& itUse .~ miniGunUse i & itUse .~ miniGunUse i
& itUse . heldAim . aimTurnSpeed .~ 0.5 & itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 15 0) 0 0.05)
& itParams & itParams
.~ BulletShooter .~ BulletShooter
{ _muzVel = 1 { _muzVel = 1
, _rifling = 0.9 , _rifling = 0.9
, _bore = 2 , _bore = 2
, _gunBarrels =
MultiBarrel
{ _brlSpread = RotatingBarrels 0.01
, _brlNum = i
, _brlInaccuracy = 0
}
, _recoil = 10 , _recoil = 10
, _torqueAfter = 0 , _torqueAfter = 0
, _randomOffset = 10 , _randomOffset = 10
+11 -11
View File
@@ -1,10 +1,11 @@
module Dodge.Item.Held.Cone module Dodge.Item.Held.Cone where
where
import Dodge.Default.Item
import Dodge.Data.Item
import Dodge.Reloading.Action
import Control.Lens import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
import Dodge.Reloading.Action
import Geometry.Data import Geometry.Data
import Linear
bangCone :: Item bangCone :: Item
bangCone = bangCone =
@@ -14,7 +15,6 @@ bangCone =
{ _muzVel = 0.7 { _muzVel = 0.7
, _rifling = 0.8 , _rifling = 0.8
, _bore = 5 , _bore = 5
, _gunBarrels = SingleBarrel 0.5
, _recoil = 150 , _recoil = 150
, _torqueAfter = 0.1 , _torqueAfter = 0.1
, _randomOffset = 12 , _randomOffset = 12
@@ -24,8 +24,8 @@ bangCone =
& itDimension . dimCenter .~ V3 5 0 0 & itDimension . dimCenter .~ V3 5 0 0
& itUse . heldDelay . rateMax .~ 20 & itUse . heldDelay . rateMax .~ 20
& itUse . heldMods .~ BangConeMod & itUse . heldMods .~ BangConeMod
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 15 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5]
& itType . iyBase .~ HELD BANGCONE & itType . iyBase .~ HELD BANGCONE
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5 & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5] & itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
@@ -35,10 +35,10 @@ blunderbuss =
bangCone bangCone
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25 & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 30, loadPrime 5] & itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 30, loadPrime 5]
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30 & itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 30
& itType . iyBase .~ HELD BLUNDERBUSS & itType . iyBase .~ HELD BLUNDERBUSS
grapeCannon :: Int -> Item grapeCannon :: Int -> Item
+4 -3
View File
@@ -28,9 +28,10 @@ launcher =
& itUse . heldMods .~ LauncherMod & itUse . heldMods .~ LauncherMod
& itUse . heldAim . aimWeight .~ 8 & itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5 & itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandOver
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ V2 3 0
& itUse . heldAim . aimMuzPos .~ 20 -- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
& itUse . heldConsumption . laAmmoType & itUse . heldConsumption . laAmmoType
.~ ProjectileAmmo .~ ProjectileAmmo
{ _amPayload = ExplosionPayload { _amPayload = ExplosionPayload
+8 -8
View File
@@ -22,7 +22,6 @@ bangRod =
{ _muzVel = 0.8 { _muzVel = 0.8
, _rifling = 1 , _rifling = 1
, _bore = 2 , _bore = 2
, _gunBarrels = SingleBarrel 0.1
, _recoil = 50 , _recoil = 50
, _torqueAfter = 0.3 , _torqueAfter = 0.3
, _randomOffset = 0 , _randomOffset = 0
@@ -38,16 +37,16 @@ bangRod =
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ OneHand & itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 30 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1]
& itUse . heldConsumption . laAmmoType .~ hvBulletAmmo & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item elephantGun :: Item
elephantGun = elephantGun =
bangRod bangRod
& itType . iyBase .~ HELD ELEPHANTGUN & itType . iyBase .~ HELD ELEPHANTGUN
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itParams . gunBarrels .~ SingleBarrel 0.05 & itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
& itUse . heldMods .~ ElephantGunMod & itUse . heldMods .~ ElephantGunMod
& itParams . recoil .~ 50 & itParams . recoil .~ 50
& itParams . torqueAfter .~ 0.1 & itParams . torqueAfter .~ 0.1
@@ -68,11 +67,12 @@ sniperRifle :: Item
sniperRifle = sniperRifle =
elephantGun elephantGun
& itType . iyBase .~ HELD SNIPERRIFLE & itType . iyBase .~ HELD SNIPERRIFLE
& itParams . gunBarrels .~ SingleBarrel 0 & itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1} & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun & itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
& itScope .~ ZoomScope (V2 0 0) 1 0.5 False & itScope .~ ZoomScope (V2 0 0) 1 0.5 False
& itUse . useTargeting ?~ TargetLaser & itType . iyModules . at ModTarget ?~ TARGET TargetLaser
-- & itUse . useTargeting ?~ TargetLaser
machineGun :: Item machineGun :: Item
machineGun = machineGun =
@@ -82,7 +82,7 @@ machineGun =
& itUse . heldMods .~ MachineGunMod & itUse . heldMods .~ MachineGunMod
& itUse . heldAim . aimWeight .~ 8 & itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0} & itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 100 & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 100
+3 -3
View File
@@ -91,9 +91,9 @@ flameThrower =
& itUse . heldMods .~ FlameThrowerMod & itUse . heldMods .~ FlameThrowerMod
& itUse . heldAim . aimWeight .~ 5 & itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimHandlePos .~ 0 -- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzPos .~ 18 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
& itUse . heldConsumption & itUse . heldConsumption
.~ ( defaultLoadable .~ ( defaultLoadable
& laSource . _InternalSource . iaMax .~ 250 & laSource . _InternalSource . iaMax .~ 250
+6 -11
View File
@@ -8,6 +8,7 @@ module Dodge.Item.Held.Stick (
revolverX, revolverX,
) where ) where
import Dodge.Base
import Dodge.Data.Item import Dodge.Data.Item
import Dodge.Default.Item import Dodge.Default.Item
import Dodge.Reloading.Action import Dodge.Reloading.Action
@@ -22,12 +23,6 @@ bangStick i =
{ _muzVel = 0.8 { _muzVel = 0.8
, _rifling = 0.8 , _rifling = 0.8
, _bore = 2 , _bore = 2
, _gunBarrels =
MultiBarrel
{ _brlNum = i
, _brlSpread = SpreadBarrels baseStickSpread
, _brlInaccuracy = 0.01
}
, _recoil = 25 , _recoil = 25
, _torqueAfter = 0.18 + 0.02 * fromIntegral i , _torqueAfter = 0.18 + 0.02 * fromIntegral i
, _randomOffset = 0 , _randomOffset = 0
@@ -38,8 +33,7 @@ bangStick i =
& itDimension . dimCenter .~ V3 5 0 0 & itDimension . dimCenter .~ V3 5 0 0
& itUse . heldDelay . rateMax .~ 8 & itUse . heldDelay . rateMax .~ 8
& itUse . heldMods .~ BangStickMod & itUse . heldMods .~ BangStickMod
& itUse . heldAim . aimHandlePos .~ 5 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) a 0.01 | a <- spreadAroundCenter i baseStickSpread]
& itUse . heldAim . aimMuzPos .~ 10
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1] & itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
@@ -66,11 +60,11 @@ pistol =
) )
& itUse . heldDelay . rateMax .~ 6 & itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ PistolMod & itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) 0 0.05]
& itParams & itParams
%~ ( (muzVel .~ 0.8) %~ ( (muzVel .~ 0.8)
. (rifling .~ 0.8) . (rifling .~ 0.8)
. (bore .~ 2) . (bore .~ 2)
. (gunBarrels .~ SingleBarrel 0.05)
. (recoil .~ 10) . (recoil .~ 10)
. (torqueAfter .~ 0.2) . (torqueAfter .~ 0.2)
) )
@@ -97,8 +91,9 @@ smg =
autoPistol -- & some parameter affecting stability autoPistol -- & some parameter affecting stability
& itUse . heldMods .~ SmgMod --(ammoCheckI : smgAfterHamMods) & itUse . heldMods .~ SmgMod --(ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG & itType . iyBase .~ HELD SMG
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimHandlePos .~ 2 & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
-- & itUse . heldAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05 & itParams . torqueAfter .~ 0.05
revolverX :: Int -> Item revolverX :: Int -> Item
+9 -8
View File
@@ -1,10 +1,11 @@
module Dodge.Item.Held.Utility where module Dodge.Item.Held.Utility where
import Linear
import Dodge.Default.Item import Dodge.Default.Item
import Color import Color
import Control.Lens import Control.Lens
import Dodge.Data.Item import Dodge.Data.Item
import Geometry.Data --import Geometry.Data
flatShield :: Item flatShield :: Item
flatShield = flatShield =
@@ -13,8 +14,7 @@ flatShield =
& itUse . heldAim . aimWeight .~ 5 & itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimTurnSpeed .~ 0.5 & itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandFlat & itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimHandlePos .~ 0 -- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzPos .~ 0
& itInvSize .~ 3 & itInvSize .~ 3
& itType . iyBase .~ HELD FLATSHIELD & itType . iyBase .~ HELD FLATSHIELD
@@ -34,8 +34,8 @@ binoculars =
defaultHeldItem defaultHeldItem
& itScope .~ ZoomScope (V2 0 0) 1 0.5 False & itScope .~ ZoomScope (V2 0 0) 1 0.5 False
& itType . iyBase .~ HELD BINOCULARS & itType . iyBase .~ HELD BINOCULARS
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 10 -- & itUse . heldAim . aimMuzPos .~ 10
& itUse . heldAim . aimStance .~ TwoHandFlat & itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun & itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5, _izFac = 1} & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5, _izFac = 1}
@@ -46,13 +46,14 @@ torch =
defaultHeldItem defaultHeldItem
& itEffect . ieInv .~ EffectWhileHeld CreateHeldLight & itEffect . ieInv .~ EffectWhileHeld CreateHeldLight
& itType . iyBase .~ HELD TORCH & itType . iyBase .~ HELD TORCH
& itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzPos .~ 10 & itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 10
forceFieldGun :: Item forceFieldGun :: Item
forceFieldGun = forceFieldGun =
defaultWeapon defaultWeapon
& itUse . useTargeting ?~ TargetRBLine -- & itUse . useTargeting ?~ TargetRBLine
& itType . iyModules . at ModTarget ?~ TARGET TargetRBLine
& itParams .~ ParamMID Nothing & itParams .~ ParamMID Nothing
& itUse . heldUse .~ HeldForceField --useForceFieldGun & itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay & itUse . heldDelay .~ NoDelay
+3 -3
View File
@@ -14,13 +14,13 @@ turretItemOffset it tu mc =
transToHandle :: Item -> Point3 -> Point3 transToHandle :: Item -> Point3 -> Point3
transToHandle itm = fromMaybe id $ do transToHandle itm = fromMaybe id $ do
x <- itm ^? itUse . heldAim . aimHandlePos V2 x y <- itm ^? itUse . heldAim . aimHandlePos
return (-.-.- V3 x 0 0) return (-.-.- V3 x y 0)
heldItemOffset :: Item -> Creature -> Point3 -> Point3 heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr heldItemOffset itm cr
| isSelected && _posture (_crStance cr) == Aiming = | isSelected && _posture (_crStance cr) == Aiming =
(+.+.+ V3 (aimingWeaponZeroPos cr itm) 0 shoulderHeight) (+.+.+ aimingWeaponZeroPos cr itm `v2z` shoulderHeight)
| isSelected && isTwoHandFlat = | isSelected && isTwoHandFlat =
(+.+.+ V3 (_crRad cr) 0 handD) (+.+.+ V3 (_crRad cr) 0 handD)
. rotate3 (twoFlatHRot cr) . rotate3 (twoFlatHRot cr)
+2 -1
View File
@@ -231,7 +231,8 @@ heldPositionInfo = maybe undefined aimStanceInfo . (^? itUse . heldAim . aimStan
aimStanceInfo :: AimStance -> String aimStanceInfo :: AimStance -> String
aimStanceInfo as = case as of aimStanceInfo as = case as of
TwoHandTwist -> "It is held in two hands along its length." TwoHandUnder -> "It is held in two hands and tucked under the shoulder."
TwoHandOver -> "It is held in two hands and over the shoulder."
TwoHandFlat -> "It is held in two hands at its sides." TwoHandFlat -> "It is held in two hands at its sides."
OneHand -> "It is held in one hand." OneHand -> "It is held in one hand."
+9 -15
View File
@@ -22,8 +22,6 @@ import Picture
--import Control.Monad.State --import Control.Monad.State
--lasPulse :: Item --lasPulse :: Item
--lasPulse = lasGun --lasPulse = lasGun
-- & itType . iyBase .~ LASPULSE -- & itType . iyBase .~ LASPULSE
@@ -42,8 +40,6 @@ import Picture
-- & itParams . lasColor .~ frac it * orange -- & itParams . lasColor .~ frac it * orange
-- frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1)) -- frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
--lasWidePulse :: Item --lasWidePulse :: Item
--lasWidePulse = lasGun --lasWidePulse = lasGun
-- & itType . iyBase .~ LASGUNWIDEPULSE -- & itType . iyBase .~ LASGUNWIDEPULSE
@@ -109,7 +105,6 @@ import Picture
-- n' = 9 * n -- n' = 9 * n
-- xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ] -- xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
--lasSwing :: Item --lasSwing :: Item
--lasSwing = lasGun --lasSwing = lasGun
-- & itType . iyBase .~ LASGUNSWING -- & itType . iyBase .~ LASGUNSWING
@@ -129,16 +124,15 @@ import Picture
-- y = 15 * sin (pi * fromIntegral x' * 0.01) -- y = 15 * sin (pi * fromIntegral x' * 0.01)
-- x' = _lasCycle $ _itParams it -- x' = _lasCycle $ _itParams it
shootLaser :: Item -> Creature -> World -> World shootLaser :: Item -> Creature -> World -> World
shootLaser it cr = cWorld . lWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir shootLaser it cr =
where cWorld . lWorld . lasers
pos = _crPos cr .:~ lasRayAt
dir = _crDir cr (_lasColor $ _itParams it)
phasev = _phaseV . _itParams $ _crInv cr IM.! itRef (_lasDamage $ _itParams it)
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change (_phaseV $ _itParams it)
dam = _lasDamage $ _itParams it (_crPos cr)
(_crDir cr)
-- this has the feel of a left click item -- this has the feel of a left click item
circleLaser :: Item -> Creature -> World -> World circleLaser :: Item -> Creature -> World -> World
@@ -165,7 +159,7 @@ shootDualLaser it cr w =
itid = _itID it itid = _itID it
dir = _crDir cr dir = _crDir cr
pos = _crPos cr +.+ aimlength *.* unitVectorAtAngle dir pos = _crPos cr +.+ aimlength *.* unitVectorAtAngle dir
aimlength = aimingMuzzlePos cr it aimlength = aimingMuzzleLength cr it
gap = _dbGap . _itParams $ it gap = _dbGap . _itParams $ it
posl = pos +.+ (- gap) *.* vNormal (unitVectorAtAngle dir) posl = pos +.+ (- gap) *.* vNormal (unitVectorAtAngle dir)
posr = pos +.+ gap *.* vNormal (unitVectorAtAngle dir) posr = pos +.+ gap *.* vNormal (unitVectorAtAngle dir)
+1 -1
View File
@@ -15,7 +15,7 @@ droneLauncher =
& itUse . heldMods .~ AmmoUseCheckMod & itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldAim . aimWeight .~ 8 & itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5 & itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandTwist & itUse . heldAim . aimStance .~ TwoHandOver
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"} & itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 2 & itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 2
& itType . iyBase .~ HELD DRONELAUNCHER & itType . iyBase .~ HELD DRONELAUNCHER
+1 -3
View File
@@ -59,11 +59,9 @@ import Shape
grenadePic :: Int -> SPic grenadePic :: Int -> SPic
grenadePic time = grenadePic time =
( colorSH (dark $ dark green) $ upperPrismPolyHalf Small Typical 5 $ polyCirc 3 5 ( colorSH (dark $ dark green) $ upperPrismPolyHalf Small Typical 5 $ polyCirc 3 5
, pictures , color green $ arc (degToRad $ (179 * fromIntegral time / 50) - 180 )
[ color green $ arc (degToRad $ (179 * fromIntegral time / 50) - 180 )
(degToRad $ 180 - (179 * fromIntegral time / 50) ) (degToRad $ 180 - (179 * fromIntegral time / 50) )
5 5
]
) )
--grenadeDraw :: Float -> Prop -> SPic --grenadeDraw :: Float -> Prop -> SPic
+1 -1
View File
@@ -19,7 +19,7 @@ shootShatter it cr w =
Opaque {} -> True Opaque {} -> True
SeeThrough -> True SeeThrough -> True
_ -> False _ -> False
sp = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir sp = _crPos cr +.+ aimingMuzzleLength cr it *.* unitVectorAtAngle dir
dir = _crDir cr dir = _crDir cr
ep = sp +.+ 200 *.* unitVectorAtAngle dir ep = sp +.+ 200 *.* unitVectorAtAngle dir
+68 -105
View File
@@ -9,16 +9,15 @@ module Dodge.Item.Weapon.TriggerType (
useAmmoUpTo, useAmmoUpTo,
lockInvFor, lockInvFor,
withMuzFlareI, withMuzFlareI,
withMuzPos, withCrPos,
withMuzPosShift, withCrPosShift,
crAtMuzPos,
withOldDir, withOldDir,
trigDoAlso, trigDoAlso,
trigDoAlso', trigDoAlso',
withTempLight, withTempLight,
withItem, withItem,
withItemUpdate, withItemUpdate,
withItemUpdate', withItemUpdateFirst,
rateIncAB, rateIncAB,
torqueBefore, torqueBefore,
torqueBeforeAtLeast, torqueBeforeAtLeast,
@@ -44,30 +43,26 @@ module Dodge.Item.Weapon.TriggerType (
withSidePushAfterI, withSidePushAfterI,
withSidePushI, withSidePushI,
withWarmUp, withWarmUp,
spreadNumI,
spreadLoaded,
repeatOnFrames, repeatOnFrames,
sideEffectOnFrame, sideEffectOnFrame,
duplicateItem, duplicateItem,
duplicateLoadedBarrels, duplicateLoadedBarrels,
duplicateNumBarrels,
duplicateLoaded, duplicateLoaded,
duplicateOffsets,
duplicateOffsetsV2, duplicateOffsetsV2,
duplicateOffsetsFocus, duplicateOffsetsFocus,
hammerCheckL, hammerCheckL,
shootL, shootL,
useTimeCheck, useTimeCheck,
ammoCheckI, ammoCheckI,
applyInaccuracy,
modClock, modClock,
blCheck, blCheck,
) where ) where
import qualified SDL import Dodge.Creature.HandPos
import Data.Foldable import Data.Foldable
import Data.Maybe import Data.Maybe
import Dodge.Base import Dodge.Base
import Dodge.Creature.HandPos
import Dodge.Creature.Test import Dodge.Creature.Test
import Dodge.Data.World import Dodge.Data.World
import Dodge.Inventory.Lock import Dodge.Inventory.Lock
@@ -76,10 +71,11 @@ import Dodge.Reloading
import Dodge.SoundLogic import Dodge.SoundLogic
import Dodge.WorldEvent import Dodge.WorldEvent
import Geometry import Geometry
import qualified IntMapHelp as IM
import LensHelp import LensHelp
import RandomHelp import RandomHelp
import qualified SDL
import Sound.Data import Sound.Data
import qualified IntMapHelp as IM
type ChainEffect = type ChainEffect =
(Item -> Creature -> World -> World) -> (Item -> Creature -> World -> World) ->
@@ -137,13 +133,15 @@ withThickSmokeI eff item cr w =
-- fire. -- fire.
ammoCheckI :: ChainEffect ammoCheckI :: ChainEffect
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
Just (InternalSource ia) | _iaLoaded ia <= 0 || not (_iaPrimed ia) Just (InternalSource ia)
-> failsound w | _iaLoaded ia <= 0 || not (_iaPrimed ia) ->
Just AboveSource | fromMaybe True $ do failsound w
Just AboveSource
| fromMaybe True $ do
invid <- itm ^? itLocation . ipInvID invid <- itm ^? itLocation . ipInvID
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
return $ x <= 0 return $ x <= 0 ->
-> failsound w failsound w
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading _ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
where where
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
@@ -360,11 +358,12 @@ useAmmoAmount amAmount eff item cr =
useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
Just InternalSource{} Just InternalSource{} ->
-> inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
Just AboveSource Just AboveSource ->
-> inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
_ -> inv _ -> inv
-- . crInv . ix itRef . itUse . heldConsumption . laSource -- . crInv . ix itRef . itUse . heldConsumption . laSource
{- | {- |
@@ -380,7 +379,6 @@ useTimeCheck f item cr w = case item ^? itUse . heldDelay . rateTime of
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
-- | Applies a world effect after a hammer position check. -- | Applies a world effect after a hammer position check.
blCheck :: ChainEffect blCheck :: ChainEffect
blCheck f it cr w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of blCheck f it cr w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
@@ -432,8 +430,8 @@ withItem :: (Item -> ChainEffect) -> ChainEffect
withItem g f it = g it f it withItem g f it = g it f it
-- not ideal -- not ideal
withItemUpdate' :: (Item -> Item) -> ChainEffect withItemUpdateFirst :: (Item -> Item) -> ChainEffect
withItemUpdate' up f it cr = f (up it) cr . (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef %~ up) withItemUpdateFirst up f it cr = f (up it) cr . (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef %~ up)
where where
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
@@ -456,48 +454,32 @@ modClock n chainEff eff it cr w
| otherwise = eff it cr w | otherwise = eff it cr w
withMuzFlareI :: ChainEffect withMuzFlareI :: ChainEffect
withMuzFlareI f it cr w = withMuzFlareI f it cr =
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) flashPos makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
. muzFlareAt (V4 5 5 0 2) flarePos cdir -- . muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
$ f it cr w . muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
. f it cr
where where
flarePos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 0 0 20)
flashPos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 5 0 20)
-- muzzleOffset = V3 (_muzPos (_dimPortage (_itDimension it))) 0 0
cdir = _crDir cr cdir = _crDir cr
cpos = _crPos cr
muzzleOffset :: Creature -> Item -> Point3 --muzzleOffset :: Creature -> Item -> Point3
muzzleOffset cr it = V3 (holdOffset + 5 + _aimMuzPos dimPort - _aimHandlePos dimPort) 0 0 --muzzleOffset cr it = V3 (holdOffset + 5 + _aimMuzPos dimPort - _aimHandlePos dimPort) 0 0
-- where
-- dimPort = _heldAim $ _itUse it
-- holdOffset
-- | crInAimStance OneHand cr = 10
-- | otherwise = 0
withCrPos :: (Point3 -> World -> World) -> ChainEffect
withCrPos = withCrPosShift (V2 0 0)
withCrPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
withCrPosShift p g f it cr = g thepos . f it cr
where where
dimPort = _heldAim $ _itUse it thepos = (_crPos cr +.+ rotateV (_crDir cr) p) `v2z` 20
holdOffset
| crInAimStance OneHand cr = 10
| otherwise = 0
withMuzPos :: (Point3 -> World -> World) -> ChainEffect
withMuzPos = withMuzPosShift (V2 0 0)
withMuzPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
withMuzPosShift p g f it cr w =
g (pos `v2z` 20) $
f it cr w
where
pos =
_crPos cr
+.+ rotateV dir p
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
dir = _crDir cr
crAtMuzPos :: ChainEffect
crAtMuzPos f it cr = f it (cr & crPos +.+.~ (aimingMuzzlePos cr it *.* unitVectorAtAngle (_crDir cr)))
{- | Applies the effect to a randomly rotated creature,
- rotation amount given by inaccuracy in itParams
-}
applyInaccuracy :: ChainEffect
applyInaccuracy f it = withRandomDirI acc f it
where
acc = _brlInaccuracy . _gunBarrels $ _itParams it
-- | Applies the effect to a randomly rotated creature. -- | Applies the effect to a randomly rotated creature.
withRandomDirI :: withRandomDirI ::
@@ -612,27 +594,6 @@ withTorqueAfter feff item cr w
(rot, g) = randomR (- torque, torque) $ _randGen w (rot, g) = randomR (- torque, torque) $ _randGen w
torque = fromMaybe 0 $ item ^? itParams . torqueAfter torque = fromMaybe 0 $ item ^? itParams . torqueAfter
spreadNumI :: ChainEffect
spreadNumI eff item cr w = foldr f w dirs
where
dirs =
zipWith
(+)
[- spread, - spread + (2 * spread / fromIntegral numBul) .. spread]
(randomRs (0, spread / fromIntegral numBul) (_randGen w))
f dir = eff item (cr & crDir +~ dir)
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
numBul = _brlNum . _gunBarrels $ _itParams item
spreadLoaded :: ChainEffect
spreadLoaded eff item cr w = foldr f w dirs
where
cd = 0.5 * spread * fromIntegral (numBulLoaded -1)
dirs = subtract cd . (spread *) . fromIntegral <$> [0 .. numBulLoaded - 1]
f dir = eff item (cr & crDir +~ dir)
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
numBulLoaded = item ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
sideEffectOnFrame :: sideEffectOnFrame ::
Int -> Int ->
(Item -> Creature -> WdWd) -> (Item -> Creature -> WdWd) ->
@@ -668,16 +629,24 @@ duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
f _ = eff it cr f _ = eff it cr
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
duplicateLoadedBarrels :: ChainEffect duplicateNumBarrels :: Int -> ChainEffect
duplicateLoadedBarrels eff item cr w = foldr f w poss duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim . aimMuzzles)
where where
cp :: Float f brl w' =
cp = -0.5 * (fromIntegral numBar - 1) eff
poss :: [V2 Float] itm
poss = map (rotateV (_crDir cr) . V2 0 . (* 5) . (+ cp) . fromIntegral) [0 .. numBul - 1] ( cr & crPos +~ rotateV (_crDir cr) (_mzPos brl + aimingWeaponZeroPos cr itm)
f pos = eff item (cr & crPos %~ (+.+ pos)) & crDir +~ (_mzRot brl + a)
numBar = _brlNum . _gunBarrels $ _itParams item )
numBul = item ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded (w' & randGen .~ g)
where
inacc = _mzInaccuracy brl
(a,g) = randomR (-inacc,inacc) $ _randGen w'
duplicateLoadedBarrels :: ChainEffect
duplicateLoadedBarrels eff itm = duplicateNumBarrels numbul eff itm
where
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
duplicateOffsetsFocus :: [Float] -> ChainEffect duplicateOffsetsFocus :: [Float] -> ChainEffect
duplicateOffsetsFocus xs eff item cr w = foldr f w poss duplicateOffsetsFocus xs eff item cr w = foldr f w poss
@@ -689,13 +658,14 @@ duplicateOffsetsFocus xs eff item cr w = foldr f w poss
cr cr
& crPos %~ (+.+ pos) & crPos %~ (+.+ pos)
& crDir .~ thedir pos & crDir .~ thedir pos
thedir pos --thedir pos
| dist (mouseWorldPos (w ^. input) (w ^. wCam)) (_crPos cr) < aimingMuzzlePos cr item = -- | dist (mouseWorldPos (w ^. input) (w ^. wCam)) (_crPos cr) < aimingMuzzlePos cr item =
argV -- argV
( _crPos cr +.+ aimingMuzzlePos cr item *.* unitVectorAtAngle (_crDir cr) -- ( _crPos cr +.+ aimingMuzzlePos cr item *.* unitVectorAtAngle (_crDir cr)
-.- (_crPos cr +.+ pos) -- -.- (_crPos cr +.+ pos)
) -- )
| otherwise = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- (_crPos cr +.+ pos)) -- | otherwise = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- (_crPos cr +.+ pos))
thedir pos = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- (_crPos cr +.+ pos))
duplicateItem :: (Item -> [Item]) -> ChainEffect duplicateItem :: (Item -> [Item]) -> ChainEffect
duplicateItem fit eff itm cr w = foldr f w (fit itm) duplicateItem fit eff itm cr w = foldr f w (fit itm)
@@ -707,10 +677,3 @@ duplicateOffsetsV2 xs eff item cr w = foldr f w poss
where where
poss = map (rotateV (_crDir cr)) xs poss = map (rotateV (_crDir cr)) xs
f pos = eff item (cr & crPos +.+.~ pos) f pos = eff item (cr & crPos +.+.~ pos)
duplicateOffsets :: [Float] -> ChainEffect
duplicateOffsets xs eff item cr w = foldr f w poss
where
poss :: [V2 Float]
poss = map (rotateV (_crDir cr) . V2 0) xs
f pos = eff item (cr & crPos +.+.~ pos)
+1 -3
View File
@@ -6,9 +6,7 @@ import Picture
drawLaser :: Laser -> Picture drawLaser :: Laser -> Picture
drawLaser pt = drawLaser pt =
setLayer BloomNoZWrite $ setLayer BloomNoZWrite $
pictures setDepth 19.5 . color (brightX 10 1 col) $ thickLine 3 ps
[ setDepth 19.5 . color (brightX 10 1 col) $ thickLine 3 ps
]
where where
col = _lzColor pt col = _lzColor pt
ps = _lzPoints pt ps = _lzPoints pt
+1 -1
View File
@@ -11,7 +11,7 @@ drawLinearShockwave :: LinearShockwave -> Picture
drawLinearShockwave lw = drawLinearShockwave lw =
setLayer BloomLayer $ setLayer BloomLayer $
setDepth 20 $ setDepth 20 $
pictures $ fold $
theArc theArc
++ [ lineCol $ zip (reverse lps) $ map (`withAlpha` white) [0, 0.05 ..] ++ [ lineCol $ zip (reverse lps) $ map (`withAlpha` white) [0, 0.05 ..]
, lineCol $ zip (reverse rps) $ map (`withAlpha` white) [0, 0.05 ..] , lineCol $ zip (reverse rps) $ map (`withAlpha` white) [0, 0.05 ..]
+1 -1
View File
@@ -6,7 +6,7 @@ import Picture
drawTargetLaser :: Laser -> Picture drawTargetLaser :: Laser -> Picture
drawTargetLaser pt = drawTargetLaser pt =
setLayer BloomNoZWrite $ setLayer BloomNoZWrite $
pictures fold
[ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 5 (sp : ps) [ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 5 (sp : ps)
, setDepth 19.5 . color (brightX 5 1 col) $ thickLine 1 (sp : ps) , setDepth 19.5 . color (brightX 5 1 col) $ thickLine 1 (sp : ps)
] ]
+2 -2
View File
@@ -9,7 +9,7 @@ import Picture
wedgeOfThickness :: Float -> Point2 -> Point2 -> Picture wedgeOfThickness :: Float -> Point2 -> Point2 -> Picture
wedgeOfThickness t x y wedgeOfThickness t x y
| x == y = blank | x == y = blank
| otherwise = pictures | otherwise = fold
[uncurryV translate x $ circleSolid (0.5*t) [uncurryV translate x $ circleSolid (0.5*t)
,polygon [x +.+ n x y, x -.- n x y, y] ,polygon [x +.+ n x y, x -.- n x y, y]
] ]
@@ -17,7 +17,7 @@ wedgeOfThickness t x y
n a b = (t*0.5) *.* errorNormalizeV 4200 (vNormal (a -.- b)) n a b = (t*0.5) *.* errorNormalizeV 4200 (vNormal (a -.- b))
verticalPipe :: Float -> Color -> Point2 -> Float -> Float -> Picture verticalPipe :: Float -> Color -> Point2 -> Float -> Float -> Picture
verticalPipe w col (V2 xx xy) za zb = pictures $ map (poly3Col . f) ps verticalPipe w col (V2 xx xy) za zb = foldMap (poly3Col . f) ps
where where
x = V3 xx xy 0 x = V3 xx xy 0
xs = map ((\(V2 a b) -> x +.+.+ V3 a b za) . toV2) [(w,0),(0,w),(-w,0),(0,-w)] xs = map ((\(V2 a b) -> x +.+.+ V3 a b za) . toV2) [(w,0),(0,w),(-w,0),(0,-w)]
+1 -1
View File
@@ -65,7 +65,7 @@ fixedSizePicClampArrow ::
World -> World ->
Picture Picture
fixedSizePicClampArrow xbord ybord pic p cfig w = fixedSizePicClampArrow xbord ybord pic p cfig w =
pictures fold
[ setLayer DebugLayer . translate x y . scale theScale theScale $ pic [ setLayer DebugLayer . translate x y . scale theScale theScale $ pic
, setLayer DebugLayer . color white . setDepth 20 $ arrowPic , setLayer DebugLayer . color white . setDepth 20 $ arrowPic
] ]
+5 -6
View File
@@ -5,16 +5,15 @@ import Geometry
import Picture import Picture
drawRadarSweep :: RadarSweep -> Picture drawRadarSweep :: RadarSweep -> Picture
drawRadarSweep pt = setLayer DebugLayer $ pictures sweepPics drawRadarSweep pt = setLayer DebugLayer $ fold
where
col = rsObjectColor $ _rsObject pt
p = _rsPos pt
r = _rsRad pt
sweepPics =
[ colHelper 0.1 $ uncurryV translate p $ thickCircle r 15 [ colHelper 0.1 $ uncurryV translate p $ thickCircle r 15
, colHelper 0.06 $ uncurryV translate p $ thickCircle (r -5) 5 , colHelper 0.06 $ uncurryV translate p $ thickCircle (r -5) 5
, colHelper 0.03 $ uncurryV translate p $ thickCircle (r -10) 5 , colHelper 0.03 $ uncurryV translate p $ thickCircle (r -10) 5
] ]
where
col = rsObjectColor $ _rsObject pt
p = _rsPos pt
r = _rsRad pt
colHelper y = color (withAlpha (y * globalAlpha) col) colHelper y = color (withAlpha (y * globalAlpha) col)
globalAlpha globalAlpha
| x > 10 = 1 | x > 10 = 1
+1 -1
View File
@@ -13,7 +13,7 @@ import Picture
drawCarte :: Configuration -> World -> Picture drawCarte :: Configuration -> World -> Picture
drawCarte cfig w = drawCarte cfig w =
pictures $ fold $
toTopLeft cfig (renderListAt 0 0 locs) : toTopLeft cfig (renderListAt 0 0 locs) :
mapOverlay w mapOverlay w
++ [mainListCursor white iPos cfig] ++ [mainListCursor white iPos cfig]
+1 -1
View File
@@ -23,7 +23,7 @@ drawInputMenu ::
String -> String ->
Picture Picture
drawInputMenu cfig title footer = drawInputMenu cfig title footer =
pictures fold
[ darkenBackground cfig [ darkenBackground cfig
, drawTitle cfig title , drawTitle cfig title
, drawFooterText cfig red footer , drawFooterText cfig red footer
+3 -3
View File
@@ -3,12 +3,12 @@ module Dodge.Render.Outline
import Picture import Picture
hackOutline :: Color -> Float -> Picture -> Picture hackOutline :: Color -> Float -> Picture -> Picture
hackOutline col x pic = pictures hackOutline col x pic = foldMap
(map (color col) (color col)
[ translate x 0 pic [ translate x 0 pic
, translate (-x) 0 pic , translate (-x) 0 pic
, translate 0 x pic , translate 0 x pic
, translate 0 (-x) pic , translate 0 (-x) pic
] ]
) <> pic <> pic
+2 -2
View File
@@ -78,7 +78,7 @@ mouseCursorType u
- w ^. wCam . camRot - w ^. wCam . camRot
mousePlus :: Picture mousePlus :: Picture
mousePlus = pictures [line [V2 (-5) 0, V2 5 0], line [V2 0 (-5), V2 0 5]] mousePlus = fold [line [V2 (-5) 0, V2 5 0], line [V2 0 (-5), V2 0 5]]
drawPlus :: Float -> Picture drawPlus :: Float -> Picture
drawPlus x = pictures [line [V2 (- x) 0, V2 x 0], line [V2 0 (- x), V2 0 x]] drawPlus x = fold [line [V2 (- x) 0, V2 x 0], line [V2 0 (- x), V2 0 x]]
+18 -18
View File
@@ -80,7 +80,7 @@ drawCreature cr = case _crType cr of
Barreloid{} -> Barreloid{} ->
picAtCrPos1 picAtCrPos1
( setDepth 20 $ ( setDepth 20 $
pictures fold
[ color orange $ circleSolid 10 [ color orange $ circleSolid 10
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 8 , setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
, color (greyN 0.5) $ circleSolid 8 , color (greyN 0.5) $ circleSolid 8
@@ -119,25 +119,25 @@ cullPoint cfig w p
extraPics :: Configuration -> Universe -> Picture extraPics :: Configuration -> Universe -> Picture
extraPics cfig u = extraPics cfig u =
pictures (_decorations lw) fold (_decorations lw)
<> setLayer FixedCoordLayer (fixedCoordPictures u) <> setLayer FixedCoordLayer (fixedCoordPictures u)
<> concatMapPic drawTractorBeam (_tractorBeams lw) <> foldMap drawTractorBeam (_tractorBeams lw)
<> concatMapPic drawLinearShockwave (_linearShockwaves lw) <> foldMap drawLinearShockwave (_linearShockwaves lw)
<> concatMapPic drawShockwave (_shockwaves lw) <> foldMap drawShockwave (_shockwaves lw)
<> concatMapPic drawLaser (_lasersToDraw lw) <> foldMap drawLaser (_lasersToDraw lw)
<> concatMapPic drawTeslaArc (_teslaArcs lw) <> foldMap drawTeslaArc (_teslaArcs lw)
<> concatMapPic drawRadarSweep (_radarSweeps lw) <> foldMap drawRadarSweep (_radarSweeps lw)
<> concatMapPic drawFlame (_flames lw) <> foldMap drawFlame (_flames lw)
<> concatMapPic drawEnergyBall (_energyBalls lw) <> foldMap drawEnergyBall (_energyBalls lw)
<> concatMapPic drawSpark (_sparks lw) <> foldMap drawSpark (_sparks lw)
<> concatMapPic drawBul (_bullets lw) <> foldMap drawBul (_bullets lw)
<> concatMapPic drawBlip (_radarBlips lw) <> foldMap drawBlip (_radarBlips lw)
<> concatMapPic drawFlare (_flares lw) <> foldMap drawFlare (_flares lw)
<> concatMapPic (dbArg (drawBeam . _bmDraw)) (_positronBeams $ _beams lw) <> foldMap (dbArg (drawBeam . _bmDraw)) (_positronBeams $ _beams lw)
<> concatMapPic (dbArg (drawBeam . _bmDraw)) (_electronBeams $ _beams lw) <> foldMap (dbArg (drawBeam . _bmDraw)) (_electronBeams $ _beams lw)
<> concatMapPic (dbArg (drawLightSource . _lsPict)) (_lightSources lw) <> foldMap (dbArg (drawLightSource . _lsPict)) (_lightSources lw)
<> testPic cfig w <> testPic cfig w
<> concatMapPic ppDraw (_pressPlates lw) <> foldMap ppDraw (_pressPlates lw)
<> viewClipBounds cfig w <> viewClipBounds cfig w
<> debugDraw cfig w <> debugDraw cfig w
<> foldMap (`_debugPic` u) (_uvDebug u) <> foldMap (`_debugPic` u) (_uvDebug u)
+1 -1
View File
@@ -42,7 +42,7 @@ highDiagonalMesh ::
Picture Picture
highDiagonalMesh pa pb w d = highDiagonalMesh pa pb w d =
setDepth 100 $ setDepth 100 $
pictures $ fold $
map (thickLine 2 . tflat2) (diagonalLinesRect pb pa w d (3 * pi / 4)) map (thickLine 2 . tflat2) (diagonalLinesRect pb pa w d (3 * pi / 4))
++ map (thickLine 2 . tflat2) (diagonalLinesRect pb pc (negate h) d (pi / 4)) ++ map (thickLine 2 . tflat2) (diagonalLinesRect pb pc (negate h) d (pi / 4))
where where
+1 -1
View File
@@ -130,7 +130,7 @@ selSecYint i j sss = do
return . (secpos +) return . (secpos +)
. subtract (ss ^. ssOffset) . subtract (ss ^. ssOffset)
. sum . sum
. fmap (_siHeight) . fmap _siHeight
. fst . fst
$ IM.split j (ss ^. ssItems) $ IM.split j (ss ^. ssItems)
where where
+2 -2
View File
@@ -47,7 +47,7 @@ targetDraw f cr _ _ = fromMaybe mempty $ do
activeTargetCursorPic :: Picture activeTargetCursorPic :: Picture
activeTargetCursorPic = activeTargetCursorPic =
pictures fold
[rotate a $ line [V2 15 0, V2 10 0] <> targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]] [rotate a $ line [V2 15 0, V2 10 0] <> targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]]
transMidLine :: Point2 -> Point2 -> Picture -> Picture transMidLine :: Point2 -> Point2 -> Picture -> Picture
@@ -73,4 +73,4 @@ targCorner = line [V2 (x - y) x, V2 x x, V2 x (x - y)]
y = 5 y = 5
targetCursorPic :: Picture targetCursorPic :: Picture
targetCursorPic = pictures [rotate a targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]] targetCursorPic = fold [rotate a targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]]
+1 -1
View File
@@ -7,7 +7,7 @@ import Picture
drawTeslaArc :: TeslaArc -> Picture drawTeslaArc :: TeslaArc -> Picture
drawTeslaArc pt = drawTeslaArc pt =
setLayer BloomNoZWrite $ setLayer BloomNoZWrite $
pictures fold
[ setDepth 20.5 $ color (brightX 2 1 $ _taColor pt) $ thickLine 3 ps [ setDepth 20.5 $ color (brightX 2 1 $ _taColor pt) $ thickLine 3 ps
, setDepth 20 $ color (V4 0 0 0 0.5) $ thickLine 10 ps , setDepth 20 $ color (V4 0 0 0 0.5) $ thickLine 10 ps
] ]
+8 -1
View File
@@ -1,6 +1,7 @@
{-# OPTIONS_GHC -Wno-unused-imports #-} {-# OPTIONS_GHC -Wno-unused-imports #-}
module Dodge.TestString where module Dodge.TestString where
import Dodge.Item.Display
import AesonHelp import AesonHelp
import Dodge.SmoothScroll import Dodge.SmoothScroll
import HelpNum import HelpNum
@@ -18,7 +19,13 @@ import Dodge.Data.Universe
--import qualified Data.Map.Strict as M --import qualified Data.Map.Strict as M
--import qualified IntMapHelp as IM --import qualified IntMapHelp as IM
testStringInit :: Universe -> [String] testStringInit :: Universe -> [String]
testStringInit _ = mempty testStringInit u = [fromMaybe "" $ do
cr <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0
i <- cr ^? crManipulation . manObject . inInventory . ispItem
fmap (show . canAttachTargetingBelow) (cr ^? crInv . ix i)
]
-- getPrettyShort (u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crHotkeys) -- getPrettyShort (u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crHotkeys)
-- <> ["---"] -- <> ["---"]
-- <> getPrettyShort ( u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crInvHotkeys) -- <> getPrettyShort ( u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crInvHotkeys)
+2 -1
View File
@@ -2,6 +2,7 @@ module Dodge.Update.Input.ScreenLayer (
updateUseInputOnScreen, updateUseInputOnScreen,
) where ) where
import Data.Char
import Control.Monad import Control.Monad
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Data.Maybe import Data.Maybe
@@ -30,7 +31,7 @@ doInputScreenInput s u =
checkEndStatus checkEndStatus
| ispressed ScancodeReturn = | ispressed ScancodeReturn =
(uvScreenLayers %~ tail) (uvScreenLayers %~ tail)
. applyTerminalString (words s) . applyTerminalString (words $ map toUpper s)
. (uvWorld . worldEventFlags . at InventoryChange ?~ ()) . (uvWorld . worldEventFlags . at InventoryChange ?~ ())
| ispressed ScancodeEscape = uvScreenLayers %~ tail | ispressed ScancodeEscape = uvScreenLayers %~ tail
| otherwise = id | otherwise = id
+6 -4
View File
@@ -16,16 +16,17 @@ module Dodge.WorldEvent.Flash (
import Dodge.Data.World import Dodge.Data.World
import Dodge.LightSource import Dodge.LightSource
--import Dodge.Default import Control.Monad
import Geometry import Geometry
import LensHelp import LensHelp
import Picture import Picture
import System.Random import System.Random
import Control.Monad.Trans.State.Strict
muzFlareAt :: Color -> Point3 -> Float -> World -> World muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w = muzFlareAt col tranv dir w =
w & cWorld . lWorld . flares w & randGen .~ g
& cWorld . lWorld . flares
.:~ MuzFlare .:~ MuzFlare
{ _flarePoly = { _flarePoly =
map map
@@ -39,7 +40,8 @@ muzFlareAt col tranv dir w =
, _flareTime = 2 , _flareTime = 2
} }
where where
(a : b : c : d : _) = randomRs (2, 20) (_randGen w) thestate = replicateM 4 $ state $ randomR (2,20)
((a : b : c : d : _), g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w)
flareCircleAt :: Color -> Float -> Point3 -> World -> World flareCircleAt :: Color -> Float -> Point3 -> World -> World
flareCircleAt col alphax tranv = flareCircleAt col alphax tranv =
+4 -18
View File
@@ -33,9 +33,6 @@ module Picture.Base (
drawText, drawText,
centerText, centerText,
stackText, stackText,
pictures,
concatMapPic,
appendPic,
tranRot, tranRot,
translate, translate,
translate3, translate3,
@@ -50,6 +47,7 @@ module Picture.Base (
mirrorxz, mirrorxz,
overPos, overPos,
picMap, picMap,
fold,
) where ) where
import Color import Color
@@ -156,18 +154,6 @@ rotate :: Float -> Picture -> Picture
{-# INLINE rotate #-} {-# INLINE rotate #-}
rotate = picMap . overPos . rotate3 rotate = picMap . overPos . rotate3
concatMapPic :: Foldable t => (a -> Picture) -> t a -> Picture
{-# INLINE concatMapPic #-}
concatMapPic = foldMap
appendPic :: Picture -> Picture -> Picture
{-# INLINE appendPic #-}
appendPic = (<>)
pictures :: Foldable t => t Picture -> Picture
{-# INLINEABLE pictures #-}
pictures = fold
makeArc :: Float -> Point2 -> [Point2] makeArc :: Float -> Point2 -> [Point2]
{-# INLINE makeArc #-} {-# INLINE makeArc #-}
makeArc rad (V2 a b) = map (`rotateV` V2 0 rad) angles makeArc rad (V2 a b) = map (`rotateV` V2 0 rad) angles
@@ -246,7 +232,7 @@ lineCol = thickLineCol 1
lineThick :: Float -> [Point2] -> Picture lineThick :: Float -> [Point2] -> Picture
{-# INLINE lineThick #-} {-# INLINE lineThick #-}
lineThick t = pictures . f lineThick t = fold . f
where where
f (x : y : ys) f (x : y : ys)
| x == y = f (x : ys) | x == y = f (x : ys)
@@ -256,7 +242,7 @@ lineThick t = pictures . f
thickLine :: Float -> [Point2] -> Picture thickLine :: Float -> [Point2] -> Picture
{-# INLINE thickLine #-} {-# INLINE thickLine #-}
thickLine t = pictures . f thickLine t = fold . f
where where
f (x : y : ys) f (x : y : ys)
| x == y = f (x : ys) | x == y = f (x : ys)
@@ -267,7 +253,7 @@ thickLine t = pictures . f
thickLineCol :: Float -> [(Point2, RGBA)] -> Picture thickLineCol :: Float -> [(Point2, RGBA)] -> Picture
{-# INLINE thickLineCol #-} {-# INLINE thickLineCol #-}
thickLineCol t = pictures . f thickLineCol t = fold . f
where where
f ((x, c) : (y, c') : ys) f ((x, c) : (y, c') : ys)
| x == y = f ((x, c) : ys) | x == y = f ((x, c) : ys)
+1 -1
View File
@@ -127,7 +127,7 @@ helpPoly3D = picFormat . map f . polyToTris
f (pos,col) = Verx pos col [] BottomLayer polyNum f (pos,col) = Verx pos col [] BottomLayer polyNum
polysToPic :: [Polyhedra] -> Picture polysToPic :: [Polyhedra] -> Picture
polysToPic = pictures . concatMap polyToPics polysToPic = fold . concatMap polyToPics
polyToEdges :: Polyhedra -> [(Point3,Point3,Point3,Point3)] polyToEdges :: Polyhedra -> [(Point3,Point3,Point3,Point3)]
polyToEdges = map denormalEdges . constructEdges . map (map fst) . _pyFaces polyToEdges = map denormalEdges . constructEdges . map (map fst) . _pyFaces
+3 -4
View File
@@ -35,7 +35,6 @@ module Shape (
overPosSH, overPosSH,
upperCylinder, upperCylinder,
upperRounded, upperRounded,
xCylinder',
) where ) where
import Color import Color
@@ -130,10 +129,10 @@ upperPrismPoly ::
upperPrismPoly size shad h ps = prismPoly size shad (map (addZ h) ps) (map (addZ 0) ps) upperPrismPoly size shad h ps = prismPoly size shad (map (addZ h) ps) (map (addZ 0) ps)
xCylinderST :: Float -> Float -> Shape xCylinderST :: Float -> Float -> Shape
xCylinderST = xCylinder' Small Typical xCylinderST = xCylinder Small Typical
xCylinder' :: Size -> Importance -> Float -> Float -> Shape xCylinder :: Size -> Importance -> Float -> Float -> Shape
xCylinder' size shad r x = xCylinder size shad r x =
translateSHz r . rotateSHq (V3 0 1 0) (pi / 2) . upperCylinder size shad x $ translateSHz r . rotateSHq (V3 0 1 0) (pi / 2) . upperCylinder size shad x $
[ V2 r r [ V2 r r
, V2 (- r / 2) (r / 2) , V2 (- r / 2) (r / 2)