Separate out concrete part of world
This commit is contained in:
+10
-10
@@ -51,7 +51,7 @@ magShield = defaultEquipment
|
||||
& itUse . eqEq . eqSite .~ GoesOnWrist
|
||||
& itType . iyBase .~ EQUIP MAGSHIELD
|
||||
useMagShield :: Item -> Creature -> World -> World
|
||||
useMagShield it cr w = w & magnets . at mgid ?~ themagnet
|
||||
useMagShield it cr w = w & cWorld . magnets . at mgid ?~ themagnet
|
||||
where
|
||||
themagnet = Magnet
|
||||
{_mgID = mgid
|
||||
@@ -61,7 +61,7 @@ useMagShield it cr w = w & magnets . at mgid ?~ themagnet
|
||||
}
|
||||
mgid = case it ^? itAttachment . atMInt . _Just of
|
||||
Just mgid' -> mgid'
|
||||
Nothing -> IM.newKey $ _magnets w
|
||||
Nothing -> IM.newKey $ _magnets (_cWorld w)
|
||||
-- it = _crInv cr IM.! invid
|
||||
|
||||
flameShield :: Item
|
||||
@@ -89,15 +89,15 @@ wristArmour = defaultEquipment
|
||||
|
||||
onEquipWristShield :: Item -> Creature -> World -> World
|
||||
onEquipWristShield itm cr w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itUse . eqEq . eqParams .~ EquipID i
|
||||
& walls . at i ?~ forceField {_wlID = i}
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itUse . eqEq . eqParams .~ EquipID i
|
||||
& cWorld . walls . at i ?~ forceField {_wlID = i}
|
||||
& setWristShieldPos (itm & itUse . eqEq . eqParams .~ EquipID i) cr
|
||||
where
|
||||
i = IM.newKey (_walls w)
|
||||
i = IM.newKey (_walls (_cWorld w))
|
||||
|
||||
onRemoveWristShield :: Item -> Creature -> World -> World
|
||||
onRemoveWristShield itm cr w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itUse . eqEq . eqParams .~ NoEquipParams
|
||||
& cWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itPos itm)) . itUse . eqEq . eqParams .~ NoEquipParams
|
||||
& deleteWallID i
|
||||
where
|
||||
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
|
||||
@@ -168,7 +168,7 @@ shieldWall crid = defaultWall
|
||||
createShieldWall :: Item -> Creature -> World -> World
|
||||
createShieldWall it cr w = case _ieMID $ _itEffect it of
|
||||
Nothing -> let (wlid,w') = createWall ((shieldWall crid) {_wlLine = wlline,_wlID = wlid}) w
|
||||
in w' & creatures . ix crid . crInv . ix invid . itEffect . ieMID ?~ wlid
|
||||
in w' & cWorld . creatures . ix crid . crInv . ix invid . itEffect . ieMID ?~ wlid
|
||||
Just wid -> moveWallID wid wlline w
|
||||
where
|
||||
invid = fromJust $ _itID it
|
||||
@@ -185,7 +185,7 @@ removeShieldWall :: Item -> Creature -> World -> World
|
||||
removeShieldWall it cr w = case _ieMID $ _itEffect it of
|
||||
Nothing -> w
|
||||
Just wid -> w & deleteWallID wid
|
||||
& creatures . ix crid . crInv . ix invid . itEffect . ieMID .~ Nothing
|
||||
& cWorld . creatures . ix crid . crInv . ix invid . itEffect . ieMID .~ Nothing
|
||||
where
|
||||
crid = _crID cr
|
||||
invid = fromJust (_itID it)
|
||||
@@ -241,7 +241,7 @@ headLamp = defaultEquipment
|
||||
|
||||
|
||||
createHeadLamp :: Item -> Creature -> World -> World
|
||||
createHeadLamp _ cr = tempLightSources .:~ tlsTimeRadColPos 1 200 0.7
|
||||
createHeadLamp _ cr = cWorld . tempLightSources .:~ tlsTimeRadColPos 1 200 0.7
|
||||
((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
|
||||
|
||||
powerLegs :: Item
|
||||
@@ -268,4 +268,4 @@ wristInvisibility = defaultEquipment
|
||||
& itType . iyBase .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist)
|
||||
|
||||
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
|
||||
overCID f _ cr = creatures . ix (_crID cr) %~ f
|
||||
overCID f _ cr = cWorld . creatures . ix (_crID cr) %~ f
|
||||
|
||||
Reference in New Issue
Block a user