Use a creature to "use" the weapon of a turret
This commit is contained in:
@@ -17,6 +17,7 @@ import Dodge.ShiftPoint
|
||||
--import Dodge.RandomHelp
|
||||
--import Dodge.Placements.Spot
|
||||
import Geometry
|
||||
--import Geometry.ConvexPoly
|
||||
import Shape
|
||||
import qualified IntMapHelp as IM
|
||||
import Color
|
||||
@@ -176,16 +177,17 @@ mvCr :: Point2 -> Float -> Creature -> Creature
|
||||
mvCr p rot cr = cr {_crPos = p,_crOldPos = p,_crDir = rot}
|
||||
|
||||
placeMachine :: Color -> [Point2] -> Machine -> Point2 -> Float -> GenWorld -> (Int,GenWorld)
|
||||
placeMachine color wallpoly mc p rot w = (mcid
|
||||
, w & gWorld . machines %~ addMc
|
||||
& gWorld . walls %~ placeMachineWalls color wallpoly mcid wlid
|
||||
placeMachine color wallpoly mc p rot gw = (mcid
|
||||
, gw & gWorld . machines %~ addMc
|
||||
& gWorld . walls %~ placeMachineWalls color wallpoly mcid wlid
|
||||
)
|
||||
where
|
||||
w' = _gWorld w
|
||||
w' = _gWorld gw
|
||||
mcid = IM.newKey $ _machines w'
|
||||
wlid = IM.newKey $ _walls w'
|
||||
wlids = IS.fromList [wlid .. wlid + length wallpoly - 1]
|
||||
addMc mcs = IM.insert mcid (mc {_mcPos = p,_mcDir = rot,_mcID = mcid, _mcWallIDs = wlids}) mcs
|
||||
--addMc = IM.insert mcid (mc {_mcPos = centroid wallpoly,_mcDir = rot,_mcID = mcid, _mcWallIDs = wlids})
|
||||
addMc = IM.insert mcid (mc {_mcPos = p,_mcDir = rot,_mcID = mcid, _mcWallIDs = wlids})
|
||||
|
||||
-- TODO correctly remove/shift pathfinding lines (removePathsCrossing)
|
||||
placeMachineWalls :: Color -> [Point2] -> Int -> Int -> IM.IntMap Wall -> IM.IntMap Wall
|
||||
|
||||
Reference in New Issue
Block a user