Add limit to forcefield size
This commit is contained in:
@@ -94,9 +94,10 @@ targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
|||||||
let p1 = worldPosToScreen w p
|
let p1 = worldPosToScreen w p
|
||||||
mwp = mouseWorldPos w
|
mwp = mouseWorldPos w
|
||||||
p2 = worldPosToScreen w mwp
|
p2 = worldPosToScreen w mwp
|
||||||
|
thecol = if dist p mwp > 100 then red else white
|
||||||
return $ winScale cfig
|
return $ winScale cfig
|
||||||
$ setLayer FixedCoordLayer
|
$ setLayer FixedCoordLayer
|
||||||
$ color white
|
$ color thecol
|
||||||
$ line [p1, p2]
|
$ line [p1, p2]
|
||||||
<> translate (20) (f p1 p2) (uncurryV translate (0.5 *.* (p1 +.+ p2)) . scale 0.1 0.1 $ text $ shortShow $ dist p mwp)
|
<> translate (20) (f p1 p2) (uncurryV translate (0.5 *.* (p1 +.+ p2)) . scale 0.1 0.1 $ text $ shortShow $ dist p mwp)
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import ShapePicture
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
--import qualified Data.Map.Strict as M
|
--import qualified Data.Map.Strict as M
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
--import Control.Monad
|
||||||
|
|
||||||
rewindGun :: Item
|
rewindGun :: Item
|
||||||
rewindGun = defaultGun
|
rewindGun = defaultGun
|
||||||
@@ -156,7 +157,9 @@ forceFieldGun = defaultGun
|
|||||||
useForceFieldGun :: Item -> Creature -> World -> World
|
useForceFieldGun :: Item -> Creature -> World -> World
|
||||||
useForceFieldGun itm cr w = fromMaybe w $ do
|
useForceFieldGun itm cr w = fromMaybe w $ do
|
||||||
a <- _tgPos $ _itTargeting itm
|
a <- _tgPos $ _itTargeting itm
|
||||||
let wlline = (a,mouseWorldPos w)
|
let mwp = mouseWorldPos w
|
||||||
|
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
|
||||||
|
wlline = (a,b)
|
||||||
return $ w
|
return $ w
|
||||||
& walls %~ IM.insertWith (\_ x -> x) i forceField {_wlID = i}
|
& walls %~ IM.insertWith (\_ x -> x) i forceField {_wlID = i}
|
||||||
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itParams . paramMID ?~ i
|
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itParams . paramMID ?~ i
|
||||||
|
|||||||
Reference in New Issue
Block a user