Add key card item lock/key system

This commit is contained in:
2022-03-22 14:33:54 +00:00
parent 873abea79f
commit 774738f993
13 changed files with 74 additions and 73 deletions
+10 -3
View File
@@ -115,10 +115,11 @@ analyser starts sucs fails afters upf pslight psmc = extTrigLitPos pslight $ \tp
_ -> (fails,red)
updatebuttontext = plType . putButton . btText .~ "ANALYSER"
testYourHealth :: Int -> Machine -> World -> World
testYourHealth hp mc w = case (_sensCloseToggle sens
analyserTest :: (World -> Bool) -> Machine -> World -> World
analyserTest t mc w = case
(_sensCloseToggle sens
, _sensToggle sens
, _crHP ycr >= hp
, t w
, dist (_crPos ycr) (_mcPos mc) < 40) of
(_,True,_,_) -> w
(_,False,True,True) -> w
@@ -133,3 +134,9 @@ testYourHealth hp mc w = case (_sensCloseToggle sens
playsound sid = soundContinue (MachineAltSound (_mcID mc)) (_mcPos mc) sid Nothing
ycr = you w
sens = _mcSensor mc
testYouHave :: CombineType -> Machine -> World -> World
testYouHave ct = analyserTest (\w -> any (\itm -> _itType itm == ct) (_crInv (you w)))
testYourHealth :: Int -> Machine -> World -> World
testYourHealth hp = analyserTest (\w -> _crHP (you w) >= hp)