Stop door z fighting when opened

This commit is contained in:
2021-11-27 00:28:59 +00:00
parent e231b851d9
commit 774808663a
4 changed files with 58 additions and 18 deletions
+45 -4
View File
@@ -213,10 +213,7 @@ data Creature = Creature
, _crMvDir :: Float
, _crID :: Int
, _crPict :: Creature -> World -> SPic
, _crUpdate
:: Creature
-> World
-> (Endo World, Maybe Creature)
, _crUpdate :: Creature -> World -> (Endo World, Maybe Creature)
, _crRad :: Float
, _crMass :: Float
, _crHP :: Int
@@ -292,6 +289,50 @@ data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float,
data ItemPos
= InInv { _itCrId :: Int , _itInvId :: Int }
| OnFloor { _itFlID :: Int }
data Item' = Item'
{ _iName :: String
, _iIdentity :: ItemIdentity
, _iType :: ItemType
, _iID :: Int
, _itPos :: ItemPos
}
data ItemType = TargetItem
{ _tiMaxAmmo :: Int
, _tiLoadedAmmo :: Int
, _tiAmmo :: Ammo
, _tiReloadTime :: Int
, _tiReloadState :: Int
, _tiReloadType :: ReloadType
, _tiMaxWarmUp :: Int
, _tiCurWarmUp :: Int
, _tiMaxCoolDown :: Int
, _tiCurCoolDown :: Int
, _tiUseRate :: Int
, _tiUseTime :: Int
, _tiUse :: Item -> Creature -> World -> World
, _tiUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
, _tiSpread :: Float
, _tiRange :: Float
, _tiHammer :: HammerPosition
, _tiDraw :: Item -> SPic
, _tiAimingSpeed :: Float
, _tiAimingRange :: Float
, _tiZoom :: ItZoom
, _tiAimZoom :: ItZoom
, _tiEquipDraw :: Creature -> Int -> SPic
, _tiScroll :: Float -> Creature -> Item -> Item
, _tiAttachment :: ItAttachment
, _tiEffect :: ItEffect
, _tiInvDisplay :: Item -> String
, _tiInvColor :: Color
, _tiTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
, _tiWorldTrigger :: Maybe (Int -> World -> Bool)
, _tiAimStance :: AimStance
, _tiNumBarrels :: Int
, _tiDimension :: ItemDimension
, _tiCurseStatus :: CurseStatus
}
data Item
= Weapon
{ _itName :: String
+8 -9
View File
@@ -1,19 +1,19 @@
module Dodge.Item.Weapon.Utility where
import Dodge.Data
import Dodge.Base
--import Dodge.Base
import Dodge.Default
import Dodge.Picture.Layer
import Dodge.Creature.Action
import Dodge.Item.Weapon.TriggerType
import Dodge.Default.Weapon
import Sound.Data
--import Sound.Data
import Geometry
import Picture
import qualified IntMapHelp as IM
import Shape
import ShapePicture
import qualified Data.Map.Strict as M
--import qualified Data.Map.Strict as M
import Control.Lens
rewindGun :: Item
@@ -27,24 +27,23 @@ rewindGun = defaultGun
, _itLeftClickUse = Just $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
}
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
rewindEffect iteff cr invid w = w & rewindWorlds %~ (take 100 . (w' : ))
rewindEffect _ cr invid w = w & rewindWorlds %~ (take 250 . (w' : ))
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w)
where
w' = w & rewindWorlds .~ []
& rewinding .~ True
useRewindGun :: Item -> Creature -> World -> World
useRewindGun it cr w = case _rewindWorlds w of
(w':[]) -> rewindusing w' []
(_:w':ws) -> rewindusing w' ws
_ -> w
useRewindGun _ _ w = case _rewindWorlds w of
[w'] -> rewindusing w' []
(_:w':ws) -> rewindusing w' ws
_ -> w
where
rewindusing w' ws = w'
-- & creatures . ix (_crID cr) .~ cr
& upbuts
& rewindWorlds .~ ws
& lClickHammer .~ HammerUp
& worldEvents %~ (. (worldEvents %~ (.(rewinding .~ False)))) -- fucking nesting
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
shrinkGun :: Item
+1 -1
View File
@@ -112,7 +112,7 @@ placeSlideDoor isPathable col cond a b speed gw = (drid, gw & gWorld .~ (addWall
}
pairs = rectanglePairs 9 a b
shiftedPairs = map (bimap shiftLeft shiftLeft) pairs
shiftLeft = (+.+ (a -.- b))
shiftLeft = (+.+ (a -.- b +.+ (normalizeV (b -.- a))) )
wlids = take 4 [IM.newKey $ _walls w ..]
-- old code that may help with pathing
--import Dodge.LevelGen.Pathing
+4 -4
View File
@@ -67,10 +67,10 @@ room2 = lasCenSensEdge
startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
startRoom i = join $ uncurry takeOneWeighted $ unzip
[ (,) (0.5::Float) $ chainUses <$> sequence [minigunFakeout,weaponRoom]
, (,) 1 $ rezBoxesWp
, (,) 1 $ rezBoxesThenWeaponRoom
, (,) 1 $ rezBoxThenWeaponRoom
, (,) 1 $ rezBoxesWpCrit
, (,) 1 rezBoxesWp
, (,) 1 rezBoxesThenWeaponRoom
, (,) 1 rezBoxThenWeaponRoom
, (,) 1 rezBoxesWpCrit
, (,) 1 $ runPastStart i
]