Start refactor storing items in single intmap, done turrets

More checks required
This commit is contained in:
2025-08-24 11:53:21 +01:00
parent 7336177edf
commit c38d03165f
22 changed files with 642 additions and 269 deletions
+5 -3
View File
@@ -20,9 +20,11 @@ destroyMachine mc =
. destroyMcType (mc ^. mcType) mc
destroyMcType :: MachineType -> Machine -> World -> World
destroyMcType mt mc = case mt of
McTurret tu -> copyItemToFloor (_mcPos mc) (_tuWeapon tu)
_ -> id
destroyMcType mt mc w = case mt of
McTurret tu -> fromMaybe w $ do
itm <- w ^? cWorld . lWorld . items . ix (tu ^. tuWeapon)
return $ copyItemToFloor (_mcPos mc) itm w
_ -> w
mcKillTerm :: Machine -> World -> World
mcKillTerm mc w = fromMaybe w $ do