This commit is contained in:
2025-08-27 22:35:33 +01:00
parent 3c2369d979
commit 2a0e6d1e6e
3 changed files with 15 additions and 25 deletions
+3 -6
View File
@@ -28,16 +28,13 @@ applyTerminalString ss = case ss of
applyTerminalCommand :: String -> Universe -> Universe applyTerminalCommand :: String -> Universe -> Universe
applyTerminalCommand s = case s of applyTerminalCommand s = case s of
"NOCLIP" -> uvConfig . debug_booleans . at Noclip %~ toggleJust "NOCLIP" -> uvConfig . debug_booleans . at Noclip %~ toggleJust
'-': xs -> uvWorld %~ \w -> foldl' (flip createItemYou) w (inventoryX xs)
-- (uvWorld . cWorld . lWorld %~ initSpecificCrItemLocations 0)
-- . (uvWorld . cWorld . lWorld . creatures . ix 0 . crInv .~ IM.fromList (zip [0 ..] $ inventoryX x))
-- . (uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ 50)
-- ['I','S',x,y] -> uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ read [x,y]
"GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avatarMaterial .~ Crystal "GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avatarMaterial .~ Crystal
"GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avatarMaterial .~ Flesh "GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avatarMaterial .~ Flesh
x -> fromMaybe id $ do x -> fromMaybe (g x) $ do
(ibt, n) <- parseItem [x] (ibt, n) <- parseItem [x]
return $ uvWorld %~ flip (foldl' (&)) (replicate n ( createItemYou (itemFromBase ibt))) return $ uvWorld %~ flip (foldl' (&)) (replicate n ( createItemYou (itemFromBase ibt)))
where
g xs = uvWorld %~ \w -> foldl' (flip createItemYou) w (inventoryX xs)
applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe
applyTerminalCommandArguments command args u = case command of applyTerminalCommandArguments command args u = case command of
+10 -14
View File
@@ -641,8 +641,9 @@ loadMuzzle loc cr (b, w) mz = maybe (b, w) (True,) $ case mz ^. mzAmmoSlot of
| x <= availableammo -> x | x <= availableammo -> x
| otherwise -> 0 | otherwise -> 0
guard $ usedammo > 0 guard $ usedammo > 0
return $ useLoadedAmmo loc cr mz (Just (usedammo, mag)) $ return $
removeAmmoFromMag usedammo mid w useLoadedAmmo loc cr mz (Just (usedammo, mag)) $
removeAmmoFromMag usedammo mid w
makeMuzzleFlare :: Muzzle -> LocationDT OItem -> Creature -> World -> World makeMuzzleFlare :: Muzzle -> LocationDT OItem -> Creature -> World -> World
makeMuzzleFlare mz loc cr = case mz ^. mzFlareType of makeMuzzleFlare mz loc cr = case mz ^. mzFlareType of
@@ -720,7 +721,7 @@ useLoadedAmmo ::
World -> World ->
World World
useLoadedAmmo loc cr mz m w = useLoadedAmmo loc cr mz m w =
makeMuzzleFlare mz loc cr $ case _mzEffect mz of makeMuzzleFlare mz loc cr $ case _mzEffect mz of
MuzzleShootBullet -> shootBullets loc cr (mz, x, magtree) w MuzzleShootBullet -> shootBullets loc cr (mz, x, magtree) w
MuzzleLaser -> creatureShootLaser loc cr mz w MuzzleLaser -> creatureShootLaser loc cr mz w
MuzzlePulseLaser -> creatureShootPulseLaser loc cr mz w MuzzlePulseLaser -> creatureShootPulseLaser loc cr mz w
@@ -737,7 +738,7 @@ useLoadedAmmo loc cr mz m w =
mz mz
cr cr
w w
MuzzleNozzle{} -> useGasParams mid mz loc cr $ walkNozzle mz itm w MuzzleNozzle{} -> useGasParams mitid mz loc cr $ walkNozzle mz itm w
MuzzleShatter -> shootShatter itm cr w MuzzleShatter -> shootShatter itm cr w
MuzzleDetector -> MuzzleDetector ->
itemDetectorEffect itemDetectorEffect
@@ -753,7 +754,7 @@ useLoadedAmmo loc cr mz m w =
MuzzleScroller -> useTimeScrollGun itm cr w MuzzleScroller -> useTimeScrollGun itm cr w
where where
itmtree = loc ^. locDT itmtree = loc ^. locDT
mid = magtree ^? dtValue . _1 . itLocation . ilInvID mitid = magtree ^. dtValue . _1 . itID
itm = itmtree ^. dtValue . _1 itm = itmtree ^. dtValue . _1
(x, magtree) = fromJust m (x, magtree) = fromJust m
@@ -918,11 +919,7 @@ shootPulseBall p dir w =
removeAmmoFromMag :: Int -> Int -> World -> World removeAmmoFromMag :: Int -> Int -> World -> World
removeAmmoFromMag x magid = removeAmmoFromMag x magid =
cWorld . lWorld . items cWorld . lWorld . items . ix magid . itConsumables . _Just -~ x
. ix magid
. itConsumables
. _Just
-~ x
getBulletType :: DTree OItem -> Maybe Bullet getBulletType :: DTree OItem -> Maybe Bullet
getBulletType magtree = getBulletType magtree =
@@ -1113,13 +1110,13 @@ mcUseHeld hit = case hit of
_ -> mcShootAuto _ -> mcShootAuto
useGasParams :: useGasParams ::
Maybe (NewInt InvInt) -> NewInt ItmInt ->
Muzzle -> Muzzle ->
LocationDT OItem -> LocationDT OItem ->
Creature -> Creature ->
World -> World ->
World World
useGasParams mmagid mz loc cr w = useGasParams (NInt magitid) mz loc cr w =
w w
& createGas gastype pressure pos dir cr & createGas gastype pressure pos dir cr
& randGen .~ g' & randGen .~ g'
@@ -1127,9 +1124,8 @@ useGasParams mmagid mz loc cr w =
itm = loc ^. locDT . dtValue . _1 itm = loc ^. locDT . dtValue . _1
(pressure, g) = doGenFloat (_nzPressure $ _mzEffect mz) (_randGen w) (pressure, g) = doGenFloat (_nzPressure $ _mzEffect mz) (_randGen w)
gastype = fromMaybe (error "cannot find gas ammo") $ do gastype = fromMaybe (error "cannot find gas ammo") $ do
magid <- mmagid
hit <- itm ^? itType . ibtHeld hit <- itm ^? itType . ibtHeld
fueltype <- cr ^? crInv . ix magid >>= \k -> w ^? cWorld . lWorld . items . ix k >>= magAmmoParams >>= (^? ampCreateGas) fueltype <- w ^? cWorld . lWorld . items . ix magitid >>= magAmmoParams >>= (^? ampCreateGas)
gasType hit fueltype gasType hit fueltype
(V3 x y _, q) = (V3 x y _, q) =
locOrient loc cr locOrient loc cr
+2 -5
View File
@@ -620,10 +620,7 @@ updatePulseLaser pz = case pz ^. pzTimer of
5 -> (Endo f, [pz & pzTimer -~ 1]) 5 -> (Endo f, [pz & pzTimer -~ 1])
_ -> (Endo g, [pz & pzTimer -~ 1]) _ -> (Endo g, [pz & pzTimer -~ 1])
where where
f w = f w = dodam thHit w
dodam
thHit
w
& cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps) & cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps)
where where
(thHit, ps) = reflectPulseLaserAlong phasev sp xp w (thHit, ps) = reflectPulseLaserAlong phasev sp xp w
@@ -645,7 +642,7 @@ updatePulseLaser pz = case pz ^. pzTimer of
xp = sp +.+ 800 *.* unitVectorAtAngle dir xp = sp +.+ 800 *.* unitVectorAtAngle dir
g w = w & cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps) g w = w & cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps)
where where
(_, ps) = reflectLaserAlong phasev sp xp w (_, ps) = reflectPulseLaserAlong phasev sp xp w
randWallReflect :: RandomGen g => Float -> Wall -> State g Float randWallReflect :: RandomGen g => Float -> Wall -> State g Float
randWallReflect a wl = randPeaked a1 outa a2 randWallReflect a wl = randPeaked a1 outa a2