Start to implement lock and key system
This commit is contained in:
+23
-14
@@ -106,10 +106,6 @@ instance (Shiftable a) => Shiftable [a] where
|
||||
translateS p x = map (translateS p) x
|
||||
rotateS r x = map (rotateS r) x
|
||||
|
||||
instance Shiftable RoomLink where
|
||||
translateS q (RL p r) = RL (p +.+ q) r
|
||||
rotateS s (RL p r) = RL (rotateV s p) (r+s)
|
||||
|
||||
instance Shiftable PlacementSpot where
|
||||
translateS p' (PS p r x) = PS (p +.+ p') r x
|
||||
rotateS r' (PS p r x) = PS (rotateV r' p) (r + r') x
|
||||
@@ -133,16 +129,29 @@ addPane c (p0,p1) wls = IM.insert (newKey wls) (Wall { _wlLine = [p0,p1]
|
||||
|
||||
|
||||
placeBt bt p rot w = over buttons addBT w
|
||||
where addBT bts = IM.insert (newKey bts) (bt {_btPos = p, _btRot = rot, _btID = newKey bts}) bts
|
||||
placeFlIt itm p rot w = over floorItems addFI w
|
||||
where addFI fis = IM.insert (newKey fis)
|
||||
(FlIt
|
||||
{_flItPos = p
|
||||
, _flItRot = rot
|
||||
, _flItID = newKey fis
|
||||
, _flIt = itm
|
||||
}
|
||||
) fis
|
||||
where
|
||||
addBT bts = IM.insert (newKey bts) (bt {_btPos = p, _btRot = rot, _btID = newKey bts}) bts
|
||||
|
||||
{-
|
||||
Creates a floor item at a given point.
|
||||
Assigns an id correctly.
|
||||
-}
|
||||
placeFlIt
|
||||
:: Item
|
||||
-> Point2 -- ^ Position
|
||||
-> Float -- ^ Rotation
|
||||
-> World
|
||||
-> World
|
||||
placeFlIt itm p rot = floorItems %~
|
||||
\ fis -> IM.insert (newKey fis)
|
||||
(FlIt
|
||||
{ _flItPos = p
|
||||
, _flItRot = rot
|
||||
, _flItID = newKey fis
|
||||
, _flIt = itm
|
||||
}
|
||||
) fis
|
||||
|
||||
placePressPlate pp p rot w = over pressPlates addPP w
|
||||
where addPP pps = IM.insert (newKey pps) (pp {_ppPos = p,_ppRot = rot}) pps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user