Fix no damage to walls bug

This commit is contained in:
2022-07-28 18:57:53 +01:00
parent ec4ff84c46
commit c8ad3e1294
19 changed files with 177 additions and 158 deletions
+21 -15
View File
@@ -19,20 +19,27 @@ damageSensor ::
PlacementSpot ->
Placement
damageSensor dt wdth mtrid ps = pContID ps (PutLS $ lsPosCol (V3 0 0 30) 0.1) $
\lsid -> Just $
spNoID ps $
PutUsingGenParams $
\gw ->
(,) gw $
PutMachine
(reverse $ square wdth)
( defaultMachine
& mcColor .~ yellow
& mcMounts . at ObTrigger .~ mtrid
& mcMounts . at ObLightSource ?~ lsid
& mcType . _McSensor .~ DamageSensor False 0 dt (_sensorCoding (_genParams (_cWorld gw)) M.! dt)
)
defaultSensorWall
\lsid -> psPtJpl ps $
PutUsingGenParams $
\gw ->
( gw
, PutMachine
(reverse $ square wdth)
( defaultMachine
& mcColor .~ yellow
& mcMounts . at ObTrigger .~ mtrid
& mcMounts . at ObLightSource ?~ lsid
& mcType .~ McSensor (DamageSensor False 0 dt (_sensorCoding (_genParams (_cWorld gw)) M.! dt) (damageTypeThreshold dt))
)
defaultSensorWall
)
damageTypeThreshold :: DamageType -> Int
damageTypeThreshold dt = case dt of
FLAMING -> 1000
LASERING -> 1000
ELECTRICAL -> 5
_ -> undefined
lightSensor ::
Float ->
@@ -40,4 +47,3 @@ lightSensor ::
PlacementSpot ->
Placement
lightSensor = damageSensor LASERING