Skip to content

Commit

Permalink
Set Indicator Panels' fixup values to that of their attached item
Browse files Browse the repository at this point in the history
This fixes #BEEmod/BEE2-items#3028, where the timer was moved to a different item.
  • Loading branch information
TeamSpen210 committed Jun 24, 2019
1 parent 70284ff commit 79856c0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,15 @@ def from_item(self, item: Item) -> None:

def collapse_item(item: Item) -> None:
"""Remove an item with a single input, transferring all IO."""
input_conn: Connection
try:
[input_conn] = item.inputs
input_item = input_conn.from_item
except ValueError:
raise ValueError('Too many inputs for "{}"!'.format(item.name))

LOGGER.debug('Merging "{}" into "{}"...', item.name, input_item.name)

input_conn.remove()

input_item.antlines |= item.antlines
Expand Down Expand Up @@ -1663,6 +1666,14 @@ def add_item_indicators(
# instance var, so give it a blank name.
pan.fixup[const.FixupVars.TOGGLE_OVERLAY] = '-'

# Overwrite the timer delay value, in case a sign changed ownership.
if item.timer is not None:
pan.fixup[const.FixupVars.TIM_DELAY] = item.timer
pan.fixup[const.FixupVars.TIM_ENABLED] = '1'
else:
pan.fixup[const.FixupVars.TIM_DELAY] = '99999999999'
pan.fixup[const.FixupVars.TIM_ENABLED] = '0'

for outputs, input_cmds in [
(item.timer_output_start(), pan_item.enable_cmd),
(item.timer_output_stop(), pan_item.disable_cmd)
Expand Down

0 comments on commit 79856c0

Please sign in to comment.