Template:API: Difference between revisions
From Spring
Jump to navigationJump to search
m test |
make name linkable |
||
| (22 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>{{prefix|{{{prefix}}}}}{{name|{{anchor|{{{name}}}}}[[#{{{name}}}|{{{name}}}]]}}{{var|1=({{{args}}})}}{{#if: {{{return|}}}|<br>return: {{var|1={{{return}}}}}|}}{{#if: {{{output|}}}|{{var|1=<br>-> {{{output}}}}}|}} | |||
< | |||
:{{{info}}} | |||
</includeonly><noinclude> | |||
<pre> | |||
{{API <!-- Callout example --> | |||
|prefix = Spring | |||
|name = UseTeamResource | |||
|arg1 = {{type|number}} teamID | |||
|arg2 = {{type|string}} "metal" {{pipe}} "energy" | |||
|arg3 = {{type|number}} amount {{pipe}} { metal = {{type|number}} amount, energy = {{type|number}} amount } | |||
|output = {{type|nil}} {{pipe}} {{type|bool}} hadEnough | |||
|info = Imposes a one-off usage of resources on the given team. The return value indicates whether or not the team had sufficient resources to meet the usage demand. | |||
}}</pre> | |||
{{prefix|Spring.}}{{name|UseTeamResource}}{{var|1=({{type|number}} teamID, {{type|string}} {{value|"metal"}} {{pipe}} {{value|"energy"}}, {{type|number}} amount {{pipe}} { metal = {{type|number}} amount, energy = {{type|number}} amount })}} | |||
{{var|-> {{type|nil}} {{pipe}} {{type|bool}} hadEnough}} | |||
:Deduct the specified amount from the team's metal or energy resource. | |||
Latest revision as of 19:43, 28 March 2020
{{API <!-- Callout example -->
|prefix = Spring
|name = UseTeamResource
|arg1 = {{type|number}} teamID
|arg2 = {{type|string}} "metal" {{pipe}} "energy"
|arg3 = {{type|number}} amount {{pipe}} { metal = {{type|number}} amount, energy = {{type|number}} amount }
|output = {{type|nil}} {{pipe}} {{type|bool}} hadEnough
|info = Imposes a one-off usage of resources on the given team. The return value indicates whether or not the team had sufficient resources to meet the usage demand.
}}
Spring.UseTeamResource(number teamID, string "metal" | "energy", number amount | { metal = number amount, energy = number amount })
-> nil | bool hadEnough
- Deduct the specified amount from the team's metal or energy resource.