Skip to content

Commit

Permalink
Add 'isBusy' indication on ship module button to support detecting if…
Browse files Browse the repository at this point in the history
… module is stopping (green/red) (PR #80)

Problem:
The core industrial booster modules, compressor, command burst for industrial ships when you stop the module it is still active until its cycle ends, however it glows red until it finishes.

Proposal:
My proposal would be to create an isBusy property in the module to detect even if it is active and we know that it is "stopping".
  • Loading branch information
focabr committed Mar 7, 2023
1 parent 5e6927b commit 50fc2cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -126,6 +126,7 @@ type alias ShipUIModuleButton =
, slotUINode : UITreeNodeWithDisplayRegion
, isActive : Maybe Bool
, isHiliteVisible : Bool
, isBusy : Bool
, rampRotationMilli : Maybe Int
}

Expand Down Expand Up @@ -1098,6 +1099,13 @@ parseShipUIModuleButton { slotNode, moduleButtonNode } =
|> List.filter (.uiNode >> getNameFromDictEntries >> (==) (Just "hilite"))
|> List.isEmpty
|> not
, isBusy =
slotNode
|> listDescendantsWithDisplayRegion
|> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "Sprite")
|> List.filter (.uiNode >> getNameFromDictEntries >> (==) (Just "busy"))
|> List.isEmpty
|> not
, rampRotationMilli = rampRotationMilli
}

Expand Down
Expand Up @@ -419,6 +419,7 @@ treeNodeChildrenFromShipUIModuleButton viewConfig shipUIModuleButton =
}
, shipUIModuleButton.isActive |> fieldFromMaybeBool "isActive"
, shipUIModuleButton.isHiliteVisible |> fieldFromBool "isHiliteVisible"
, shipUIModuleButton.isBusy |> fieldFromBool "isBusy"
, shipUIModuleButton.rampRotationMilli |> fieldFromMaybeInt "rampRotationMilli"
]

Expand Down

0 comments on commit 50fc2cb

Please sign in to comment.