Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not require that peripheral IDs have colons #30

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/AvailablePeripheralBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function AvailablePeripheralBadge({ periphId }: AvailablePeripheralBadgeP
}}
onDragStart={ onDragStart }
>
{ periphId.split(":")[1] }
{ periphId.split(":")[1] || periphId }
</span>
);
}
2 changes: 1 addition & 1 deletion client/src/components/MissingPeripheralBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function MissingPeripheralBadge({ periphId }: MissingPeripheralBadgeProps
onMouseOver={ () => setHover(true) }
onMouseOut={ () => setHover(false) }
>
<span>{ hover ? "Remove" : periphId.split(":")[1] }</span>
<span>{ hover ? "Remove" : (periphId.split(":")[1] || periphId) }</span>
</div>
);
}
2 changes: 1 addition & 1 deletion client/src/components/PeripheralBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function PeripheralBadge({ periphId, machineId }: PeripheralBadgeProps) {
}}
onDragStart={ onDragStart }
>
{ periphId.split(":")[1] }
{ periphId.split(":")[1] || periphId }
</span>
);
}
6 changes: 3 additions & 3 deletions computercraft/sigils/factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ local function getPeripheralIds ()
-- add if the peripheral has an inventory and is connected via a modem
local periph = peripheral.wrap(periphId)

local isInventory = periph['pushItems'] and periph.size() >= 1
local isFluidTank = periph['tanks']
local isInventory = periph['pushItems'] ~= nil and periph.size() >= 1
local isFluidTank = periph['tanks'] ~= nil

if (isInventory or isFluidTank) and string.match(periphId, ':') then
if isInventory or isFluidTank then
table.insert(periphs, periphId)
end
end
Expand Down
Loading