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 s = case s of
"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
"GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crType . avatarMaterial .~ Flesh
x -> fromMaybe id $ do
x -> fromMaybe (g x) $ do
(ibt, n) <- parseItem [x]
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 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
| otherwise -> 0
guard $ usedammo > 0
return $ useLoadedAmmo loc cr mz (Just (usedammo, mag)) $
removeAmmoFromMag usedammo mid w
return $
useLoadedAmmo loc cr mz (Just (usedammo, mag)) $
removeAmmoFromMag usedammo mid w
makeMuzzleFlare :: Muzzle -> LocationDT OItem -> Creature -> World -> World
makeMuzzleFlare mz loc cr = case mz ^. mzFlareType of
@@ -720,7 +721,7 @@ useLoadedAmmo ::
World ->
World
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
MuzzleLaser -> creatureShootLaser loc cr mz w
MuzzlePulseLaser -> creatureShootPulseLaser loc cr mz w
@@ -737,7 +738,7 @@ useLoadedAmmo loc cr mz m w =
mz
cr
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
MuzzleDetector ->
itemDetectorEffect
@@ -753,7 +754,7 @@ useLoadedAmmo loc cr mz m w =
MuzzleScroller -> useTimeScrollGun itm cr w
where
itmtree = loc ^. locDT
mid = magtree ^? dtValue . _1 . itLocation . ilInvID
mitid = magtree ^. dtValue . _1 . itID
itm = itmtree ^. dtValue . _1
(x, magtree) = fromJust m
@@ -918,11 +919,7 @@ shootPulseBall p dir w =
removeAmmoFromMag :: Int -> Int -> World -> World
removeAmmoFromMag x magid =
cWorld . lWorld . items
. ix magid
. itConsumables
. _Just
-~ x
cWorld . lWorld . items . ix magid . itConsumables . _Just -~ x
getBulletType :: DTree OItem -> Maybe Bullet
getBulletType magtree =
@@ -1113,13 +1110,13 @@ mcUseHeld hit = case hit of
_ -> mcShootAuto
useGasParams ::
Maybe (NewInt InvInt) ->
NewInt ItmInt ->
Muzzle ->
LocationDT OItem ->
Creature ->
World ->
World
useGasParams mmagid mz loc cr w =
useGasParams (NInt magitid) mz loc cr w =
w
& createGas gastype pressure pos dir cr
& randGen .~ g'
@@ -1127,9 +1124,8 @@ useGasParams mmagid mz loc cr w =
itm = loc ^. locDT . dtValue . _1
(pressure, g) = doGenFloat (_nzPressure $ _mzEffect mz) (_randGen w)
gastype = fromMaybe (error "cannot find gas ammo") $ do
magid <- mmagid
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
(V3 x y _, q) =
locOrient loc cr
+2 -5
View File
@@ -620,10 +620,7 @@ updatePulseLaser pz = case pz ^. pzTimer of
5 -> (Endo f, [pz & pzTimer -~ 1])
_ -> (Endo g, [pz & pzTimer -~ 1])
where
f w =
dodam
thHit
w
f w = dodam thHit w
& cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps)
where
(thHit, ps) = reflectPulseLaserAlong phasev sp xp w
@@ -645,7 +642,7 @@ updatePulseLaser pz = case pz ^. pzTimer of
xp = sp +.+ 800 *.* unitVectorAtAngle dir
g w = w & cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps)
where
(_, ps) = reflectLaserAlong phasev sp xp w
(_, ps) = reflectPulseLaserAlong phasev sp xp w
randWallReflect :: RandomGen g => Float -> Wall -> State g Float
randWallReflect a wl = randPeaked a1 outa a2