Add limit to forcefield size
This commit is contained in:
@@ -19,6 +19,7 @@ import ShapePicture
|
||||
import Data.Maybe
|
||||
--import qualified Data.Map.Strict as M
|
||||
import Control.Lens
|
||||
--import Control.Monad
|
||||
|
||||
rewindGun :: Item
|
||||
rewindGun = defaultGun
|
||||
@@ -156,7 +157,9 @@ forceFieldGun = defaultGun
|
||||
useForceFieldGun :: Item -> Creature -> World -> World
|
||||
useForceFieldGun itm cr w = fromMaybe w $ do
|
||||
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
|
||||
& walls %~ IM.insertWith (\_ x -> x) i forceField {_wlID = i}
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust (_itInvPos itm)) . itParams . paramMID ?~ i
|
||||
|
||||
Reference in New Issue
Block a user