Skip to content

Commit

Permalink
Fix missing namespaces on peripheral types
Browse files Browse the repository at this point in the history
  • Loading branch information
bananasov committed Aug 3, 2024
1 parent 04dca90 commit 04875ca
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions library/peripheral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ function peripheral.getNames() end
function peripheral.isPresent(name) end

---Get the type(s) of a peripheral
---@param peripheral string|ccTweaked.peripheral.computerSide|wrappedPeripheral The name/side or wrapped instance of a peripheral to get the type(s) of
---@return peripheralType ... The peripheral's types or `nil` if one is not present
---@param peripheral string|ccTweaked.peripheral.computerSide|ccTweaked.peripheral.wrappedPeripheral The name/side or wrapped instance of a peripheral to get the type(s) of
---@return ccTweaked.peripheral.peripheralType ... The peripheral's types or `nil` if one is not present
------
---[Official Documentation](https://tweaked.cc/module/peripheral.html#v:getType)
function peripheral.getType(peripheral) end

---Check that a peripheral has a given type
---@param peripheral string|ccTweaked.peripheral.computerSide|wrappedPeripheral The name/side or wrapped instance of a peripheral to check the type of
---@param peripheralType peripheralType The type to check
---@param peripheral string|ccTweaked.peripheral.computerSide|ccTweaked.peripheral.wrappedPeripheral The name/side or wrapped instance of a peripheral to check the type of
---@param peripheralType ccTweaked.peripheral.peripheralType The type to check
---@return boolean|nil hasType If the peripheral has the given type or `nil` if it is not present
------
---[Official Documentation](https://tweaked.cc/module/peripheral.html#v:hasType)
Expand All @@ -79,7 +79,7 @@ function peripheral.hasType(peripheral, peripheralType) end
function peripheral.getMethods(name) end

---Get the name of a wrapped peripheral
---@param peripheral wrappedPeripheral The peripheral to get the name of
---@param peripheral ccTweaked.peripheral.wrappedPeripheral The peripheral to get the name of
---@return string name The name of the peripheral
------
---[Official Documentation](https://tweaked.cc/module/peripheral.html#v:getName)
Expand All @@ -96,15 +96,15 @@ function peripheral.call(name, method, ...) end

---Get a table containing all methods available on a peripheral
---@param name string|ccTweaked.peripheral.computerSide The name of the peripheral to wrap
---@return wrappedPeripheral|nil wrappedPeripheral The table containing the peripheral's methods or `nil` if the peripheral does not exist
---@return ccTweaked.peripheral.wrappedPeripheral|nil wrappedPeripheral The table containing the peripheral's methods or `nil` if the peripheral does not exist
------
---[Official Documentation](https://tweaked.cc/module/peripheral.html#v:wrap)
function peripheral.wrap(name) end

---Find all peripherals of a given type and return them wrapped
---@param peripheralType peripheralType The type of peripheral to find
---@param filter? fun(name: string, wrapped: wrappedPeripheral): boolean A filter function that should return if the peripheral should be included in the result
---@return wrappedPeripheral[] wrappedPeripherals The wrapped peripherals that were found, if any
---@param peripheralType ccTweaked.peripheral.peripheralType The type of peripheral to find
---@param filter? fun(name: string, wrapped: ccTweaked.peripheral.wrappedPeripheral): boolean A filter function that should return if the peripheral should be included in the result
---@return ccTweaked.peripheral.wrappedPeripheral[] wrappedPeripherals The wrapped peripherals that were found, if any
---## Example
---```
---local monitors = { peripheral.find("monitor") }
Expand Down
2 changes: 1 addition & 1 deletion library/types/objects/peripheral/Inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Inventory.size() end
---
---The returned table is sparse, and so empty slots will be nil - it is
---recommended to loop over using pairs rather than ipairs.
---@return itemList list The list of items in this inventory
---@return ccTweaked.peripheral.itemList list The list of items in this inventory
---## Example
---```
---local chest = peripheral.find("minecraft:chest")
Expand Down
10 changes: 5 additions & 5 deletions library/types/objects/peripheral/Modem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ Modem = {}
---A channel must be open in order to receive messages on it
---
---Modem can have 128 channels open at one time
---@param channel channel The channel to open (0 - 65535)
---@param channel ccTweaked.peripheral.channel The channel to open (0 - 65535)
---@throws If the `channel` is out of range
---@throws If there are too many open channels
------
---[Official Documentation](https://tweaked.cc/peripheral/modem.html#v:open)
function Modem.open(channel) end

---Check if a channel is open or not
---@param channel channel The channel to check (0 - 65535)
---@param channel ccTweaked.peripheral.channel The channel to check (0 - 65535)
---@return boolean isOpen If the channel is open
---@throws If the `channel` is out of range
------
---[Official Documentation](https://tweaked.cc/peripheral/modem.html#v:isOpen)
function Modem.isOpen(channel) end

---Close an open channel so that it no longer receives messages
---@param channel channel The channel to close (0 - 65535)
---@param channel ccTweaked.peripheral.channel The channel to close (0 - 65535)
---@throws If the `channel` is out of range
------
---[Official Documentation](https://tweaked.cc/peripheral/modem.html#v:close)
Expand All @@ -54,8 +54,8 @@ function Modem.closeAll() end
---
---Modems listening on the specified channel will queue a `modem_message` event
---on any parent computers
---@param channel channel The channel to send the message on (does not need to be open)
---@param replyChannel channel The channel that responses should be sent on. This can be the same channel, but it must be opened on this computer in order to receive the replies
---@param channel ccTweaked.peripheral.channel The channel to send the message on (does not need to be open)
---@param replyChannel ccTweaked.peripheral.channel The channel that responses should be sent on. This can be the same channel, but it must be opened on this computer in order to receive the replies
---@param payload boolean|string|number|table The payload of the message to send
---@throws If the channel is out of range
---## Example
Expand Down
4 changes: 2 additions & 2 deletions library/types/objects/peripheral/WiredModem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ function WiredModem.isPresentRemote(name) end

---Get the type of a peripheral on this wired network
---@param name string The peripheral's name
---@return peripheralType|nil type The peripheral's type or `nil` if it is not present
---@return ccTweaked.peripheral.peripheralType|nil type The peripheral's type or `nil` if it is not present
------
---[Official Documentation](https://tweaked.cc/peripheral/modem.html#v:getTypeRemote)
function WiredModem.getTypeRemote(name) end

---Check that a peripheral is of a given type
---@param name string The peripheral's name
---@param type peripheralType The type to check
---@param type ccTweaked.peripheral.peripheralType The type to check
---@return boolean|nil isType If a peripheral has a given type or `nil` if it is not present
------
---[Official Documentation](https://tweaked.cc/peripheral/modem.html#v:hasTypeRemote)
Expand Down
14 changes: 7 additions & 7 deletions library/types/peripheral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
---| '"front"'
---| '"back"'

---@alias peripheralType
---@alias ccTweaked.peripheral.peripheralType
---| '"command"'
---| '"computer"'
---| '"drive"'
Expand All @@ -21,11 +21,11 @@
---| '"inventory"'
---| string

---@alias wrappedPeripheral ccTweaked.peripheral.Command|ccTweaked.peripheral.Computer|ccTweaked.peripheral.Drive|ccTweaked.peripheral.EnergyStorage|ccTweaked.peripheral.FluidStorage|ccTweaked.peripheral.Inventory|ccTweaked.peripheral.Modem|ccTweaked.peripheral.Monitor|ccTweaked.peripheral.Printer|ccTweaked.peripheral.Speaker|ccTweaked.peripheral.WiredModem
---@alias ccTweaked.peripheral.wrappedPeripheral ccTweaked.peripheral.Command|ccTweaked.peripheral.Computer|ccTweaked.peripheral.Drive|ccTweaked.peripheral.EnergyStorage|ccTweaked.peripheral.FluidStorage|ccTweaked.peripheral.Inventory|ccTweaked.peripheral.Modem|ccTweaked.peripheral.Monitor|ccTweaked.peripheral.Printer|ccTweaked.peripheral.Speaker|ccTweaked.peripheral.WiredModem

---@alias channel integer A channel to be used with a modem (0 - 65535)
---@alias ccTweaked.peripheral.channel integer A channel to be used with a modem (0 - 65535)

---@alias instrument
---@alias ccTweaked.peripheral.instrument
---| '"harp"'
---| '"basedrum"'
---| '"snare"'
Expand All @@ -43,7 +43,7 @@
---| '"banjo"'
---| '"pling"'

---@alias soundEffect
---@alias ccTweaked.peripheral.soundEffect
---| '"ambient.basalt_deltas.additions"'
---| '"ambient.basalt_deltas.loop"'
---| '"ambient.basalt_deltas.mood"'
Expand Down Expand Up @@ -1030,9 +1030,9 @@
---| '"weather.rain"'
---| '"weather.rain.above"'

---@alias itemList table<number, item>
---@alias ccTweaked.peripheral.itemList table<number, ccTweaked.peripheral.item>

---@class item
---@class ccTweaked.peripheral.item
---@field name string The item name
---@field count integer The number of this item present
---@field nbt string|nil This item's Named Binary Tag

0 comments on commit 04875ca

Please sign in to comment.