Method | Description |
---|---|
isShop() | Returns true if it's a store |
getAddress() | Gets the Table Cloth's address |
setAddress([address]) | Sets the Table Cloth's address |
getPriceTagItem() | Gets the pricetag item |
setPriceTagItem([name]) | Sets the pricetag item |
getPriceTagCount() | Gets the pricetag item count |
setPriceTagCount([count]) | Sets the pricetag item count |
getWares() | Gets the items being sold |
setWares([{[name = string], [count = number]}...]) | Sets the items being sold with their counts |
Important!
The Table Cloth is only available as a peripheral if it's a store or if there's items on it. It will remain a peripheral as long as there is a computer/modem/turtle attached to it, even if it is emptied.
isShop()
Checks if the Table Cloth is a shop or not.
Returns
boolean
, True if it's a shop.
getAddress()
Gets the Table Cloth's address.
Returns
string
With the address currently in use.
setAddress([address])
Sets the Table Cloth's address to the given variable.
If the address arg is nil, it'll unset the address.
Parameters
- address?:
string = nil
Addresses processed pruchases toaddress
. Unsets if address isnil
.
getPriceTagItem()
Gets the Item used for the Table Cloth's price tag.
Returns
table
Table of itemDetails.
setPriceTagItem([name])
Sets the Item used for the Table Cloth's price tag.
Parameters
- name?:_
string = nil
Sets the Item toname
. Unsets if name isnil
.
getPriceTagCount()
Gets the Table Cloth's Pricetag item count.
Returns
number
Number of items.
setPriceTagCount([count])
Sets the Table Cloth's Pricetag item count.
Parameters
- count?:_
count = 1
Sets the count tocount
.
getWares()
Gets the list of items requested on purchase.
Returns
table
Table of itemDetails.
setWares([{[name = string], [count = number]}]...)
Sets the Table Cloth's wares that get requested on purchase.
- Each argument represents an item to be requested and is a table of the item
name
, likecreate:wrench
orapple
and thecount
, between1
and256
. - nil argument or a table with an unspecified
name
equates to an empty slot. - Unspecified
count
equates to1
- If no items are provided, the tablecloth stops being a shop, and goes back to normal behaviour.
Parameters
- item:
table
Table ofname = string
andcount = number
.
Usage
tableCloth = peripheral.find("Create_TableCloth")
if tableCloth.isShop() then
tableCloth.setWares(
{ name = "minecraft:diamond"}, -- defaults to 1
{ name = "redstone", count = 30 }
)
tableCloth.setPriceTagItem("gold_ingot")
tableCloth.setPriceTagCount(2)
end