Start work on pathfinding
This commit is contained in:
@@ -142,7 +142,6 @@ holdForm ycr crs cr = p
|
||||
cpos = cr ^. crPos . _xy
|
||||
ps = map (^. crPos . _xy) $ IM.elems crs
|
||||
cen = centroid ps
|
||||
--cen = (1 / fromIntegral (length ps)) *.* foldr1 (+.+) ps
|
||||
p
|
||||
| dist cen ypos < 20 = ypos
|
||||
| otherwise = ypos +.+ cpos -.- cen
|
||||
@@ -153,7 +152,6 @@ lineUp ycr crs cr = p
|
||||
ypos = ycr ^. crPos . _xy
|
||||
cpos = cr ^. crPos . _xy
|
||||
ps = map (^. crPos . _xy) $ IM.elems crs
|
||||
--cen = (1 / fromIntegral (length ps)) *.* foldr1 (+.+) ps
|
||||
cen = centroid ps
|
||||
p = (0.05 *.* ypos) +.+ (0.95 *.* errorClosestPointOnLine 500 cen ypos cpos)
|
||||
|
||||
@@ -165,7 +163,6 @@ spreadOut ycr crs cr = p
|
||||
cpos = cr ^. crPos . _xy
|
||||
ps = map (^. crPos . _xy) $ IM.elems crs
|
||||
cen = centroid ps
|
||||
-- cen = (1 / fromIntegral (length ps)) *.* foldr1 (+.+) ps
|
||||
p
|
||||
| dist cen ypos < 30 = ypos
|
||||
| otherwise = ypos +.+ (spreadFactor *.* cpos -.- cen)
|
||||
|
||||
@@ -43,11 +43,11 @@ updateCreature' cr =
|
||||
chasmTest cr . case _crType cr of
|
||||
Avatar{} ->
|
||||
(cWorld . lWorld . creatures . ix 0 . crType . avatarPulse %~ updatePulse)
|
||||
. crUpdate' yourControl cr
|
||||
. crUpdate yourControl cr
|
||||
LampCrit{} -> updateLampoid cr
|
||||
BarrelCrit bt -> updateBarreloid bt cr
|
||||
AvatarDead -> id
|
||||
_ -> crUpdate' updateHumanoid cr
|
||||
_ -> crUpdate updateHumanoid cr
|
||||
|
||||
{- | this seems to work, but I am not sure about the ordering:
|
||||
previously, the movement was updated before the ai in order to correctly set the oldpos.
|
||||
@@ -56,8 +56,8 @@ updateCreature' cr =
|
||||
at what point invSideEffects is applied wrt to when the creature moves
|
||||
may affect whether the shield moves correctly
|
||||
-}
|
||||
crUpdate' :: (Creature -> World -> World) -> Creature -> World -> World
|
||||
crUpdate' f cr =
|
||||
crUpdate :: (Creature -> World -> World) -> Creature -> World -> World
|
||||
crUpdate f cr =
|
||||
checkDeath cid
|
||||
. doDamage cid
|
||||
. invItemEffs cid
|
||||
|
||||
Reference in New Issue
Block a user