mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
localize card links, add_link, remove_links
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
Function: add_link
|
||||
|
||||
--Usage--
|
||||
> add_link(input: card, selected_relation: "link type", linked_card: other_card, linked_relation: "link type")
|
||||
|
||||
Links the input card and the linked_card together. The link is reciprocal if possible.
|
||||
|
||||
(Adds the linked_card to the input card's links, and gives it the linked_relation. Adds the input card to the linked_card's links, and gives it the selected_relation.)
|
||||
|
||||
Returns the linked_card, or nil if the linked_card was not found.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:card]] or [[type:string]] One of the two cards we will link, or the uid of a card.
|
||||
| @selected_relation@ [[type:string]] The type of link we will give to the input card.
|
||||
| @linked_card@ [[type:card]] or [[type:string]] The other of the two cards we will link, or the uid of the other card.
|
||||
| @linked_relation@ [[type:string]] The type of link we will give to the linked card.
|
||||
| @set@ [[type:set]] The set in which to look for the other card. This can be omitted since 'set' is a predefined variable.
|
||||
@@ -1,13 +1,13 @@
|
||||
Function: get_cards_from_link
|
||||
|
||||
--Usage--
|
||||
> get_cards_from_link(card: card, input: "link type")
|
||||
> get_cards_from_link(input: card, linked_relation: "link type")
|
||||
|
||||
Inspects a given [[type:card]]'s links to find those of the given type, and returns an array containing the linked cards.
|
||||
Returns an empty array if no link of the given type, or no card was found.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] The type of link we want to find.
|
||||
| @card@ [[type:card]] The card whose links we'll inspect.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omited since 'set' is a predefined variable.
|
||||
| @input@ [[type:card]] The card whose links we'll inspect.
|
||||
| @linked_relation@ [[type:string]] The type of link we want to find.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omitted since 'set' is a predefined variable.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
Function: has_link
|
||||
|
||||
--Usage--
|
||||
> has_link(card: card, "link type")
|
||||
> has_link(input: card, linked_relation: "link type")
|
||||
|
||||
Inspects a given [[type:card]]'s links to find one of the given type.
|
||||
Returns true if such a link was found, false otherwise.
|
||||
|
||||
Note that this function does not check if the linked card exists in the set. For that, use get_card_from_link.
|
||||
Note that this function does not check if the linked card exists in the set. For that, use get_cards_from_link.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] The type of link we want to find.
|
||||
| @card@ [[type:card]] The card whose links we'll inspect.
|
||||
| @input@ [[type:card]] The card whose links we'll inspect.
|
||||
| @linked_relation@ [[type:string]] The type of link we want to find.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Function: remove_links
|
||||
|
||||
--Usage--
|
||||
> remove_links(input: card, linked_card: other card)
|
||||
> remove_links(input: card, linked_relation: "link type")
|
||||
|
||||
Breaks the link between the input card and the linked_card. If a linked_relation is given, breaks the link between the input card and all cards with the linked_relation.
|
||||
|
||||
Returns an array containing all the cards that were unlinked.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:card]] or [[type:string]] One of the two cards we will unlink, or the uid of a card.
|
||||
| @linked_card@ [[type:card]] or [[type:string]] The other of the two cards we will unlink, or the uid of the other card.
|
||||
| @linked_relation@ [[type:string]] The type of link we will break.
|
||||
| @set@ [[type:set]] The set in which to look for the other card. This can be omitted since 'set' is a predefined variable.
|
||||
Reference in New Issue
Block a user