User:Flozi: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
Flozi (talk | contribs)
No edit summary
Line 5: Line 5:


== Template:Tag ==
== Template:Tag ==
<span class="type" style="color:#0099cc; font-family:courier, monospace;">bool</span> <span class="tagname" style="color:#105289; font-family:courier, monospace; font-weight:bold;">burnblow</span> &emsp; default: <span class="value" style="color:#ff6600;font-family:courier, monospace;">false</span> &emsp; lua: <code>selfExplode</code>
{{#css:
  span.value {
    color:#ff6600;
    font-family:courier, monospace;
  }
  span.type {
    color:#0099cc;  
    font-family:courier, monospace;
  }
  span.prefix {
  color:#105289;
    font-family:courier, monospace;
  } 
  span.name {
    color:#105289;  
    font-family:courier, monospace;  
    font-weight:bold;
  }
  span.var {
    font-family:courier, monospace;
  }
}}
<span class="type">bool</span> <span class="name">burnblow</span> &emsp; default: <span class="value">false</span> &emsp; lua: <span class="var">selfExplode</span>


:Does the weapon explode when it reaches its maximum range or continue on its path? The name is an OTAism.
:Does the weapon explode when it reaches its maximum range or continue on its path? The name is an OTAism.


<span class="type" style="color:#0099cc;font-family:courier, monospace;">float</span> <span class="tagname" style="color:#105289; font-family:courier, monospace; font-weight:bold;">range</span> &emsp; default: <span class="value" style="color:#ff6600;font-family:courier, monospace;">10.0 </span>
<span class="type">float</span> <span class="name">range</span> &emsp; default: <span class="value">10.0</span>


:The maximum range in elmos that the weapon can fire at.
:The maximum range in elmos that the weapon can fire at.


<span class="type" style="color:#0099cc;font-family:courier, monospace;">float</span> <span class="tagname" style="color:#105289; font-family:courier, monospace; font-weight:bold;">weaponVelocity</span> &emsp; default: <span class="value" style="color:#ff6600;font-family:courier, monospace;">0.0</span>
<span class="type">float</span> <span class="name">weaponVelocity</span> &emsp; default: <span class="value">0.0</span>


:The velocity in elmos per second of the weapon projectile. Since 99.0 maxVelocity is a synonym.
:The velocity in elmos per second of the weapon projectile. Since 99.0 maxVelocity is a synonym.
== Template:API -> CallIn ==
<span style="font-family:courier, monospace;"><span class="tagname" style="color:#105289;">addon.<span style="font-weight:bold;">AllowUnitCreation</span></span>(<span class="type" style="color:#0099cc;">int</span> unitDefID, <span class="type" style="color:#0099cc;">int</span> builderID, <span class="type" style="color:#0099cc;">int</span> builderTeam,
<span class="type" style="color:#0099cc;">int</span> x, <span class="type" style="color:#0099cc;">int</span> y, <span class="type" style="color:#0099cc;">int</span> z,
<span class="type" style="color:#0099cc;">int</span> facing)</span>
return: <span style="font-family:courier, monospace;"><span class="type" style="color:#0099cc;">bool</span> allow</span>
:Called just before unit is created, the boolean return value determines whether or not the creation is permitted.


== Template:API proposal ==
== Template:API proposal ==
Line 40: Line 51:
|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.
|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>
}}</pre>
<span class="prefix">Spring.</span><span class="name">UseTeamResource</span><span class="var">(<span class="type">number</span> teamID, <span class="type">string</span> "metal" {{pipe}} "energy", <span class="type">number</span> amount {{pipe}} { metal = <span class="type">number</span> amount, energy = <span class="type">number</span> amount } )</span>
-> <span class="type">nil</span> {{pipe}} <span class="type">bool</span> <span class="var">hadEnough</span>
:Deduct the specified amount from the team's metal or energy resource.


vs.
vs.
Line 55: Line 72:
|info = Called just before a unit is transferred to a different team, the boolean return value determines whether or not the transfer is permitted.
|info = Called just before a unit is transferred to a different team, the boolean return value determines whether or not the transfer is permitted.
}}</pre>
}}</pre>
<span class="prefix">addon.</span><span class="name">AllowUnitTransfer</span><span class="var">(<span class="type">number</span> unitID, <span class="type">number</span> unitDefID, <span class="type">number</span> oldTeam,
<span class="type">number</span> newTeam, <span class="type">bool</span> capture)</span>
return: <span class="type">bool</span> <span class="var">allow</span>
:Called just before a unit is transferred to a different team, the boolean return value determines whether or not the transfer is permitted.


= TODO: =
= TODO: =

Revision as of 18:25, 15 June 2016

My User Subpages

Scratchpad

Template:Tag

bool burnblow   default: false   lua: selfExplode

Does the weapon explode when it reaches its maximum range or continue on its path? The name is an OTAism.

float range   default: 10.0

The maximum range in elmos that the weapon can fire at.

float weaponVelocity   default: 0.0

The velocity in elmos per second of the weapon projectile. Since 99.0 maxVelocity is a synonym.

Template:API proposal

Note that the number of 'arg1' etc is fixed (i.e. 10) but can be omitted without issue. the 'type' template is just a way to make inserting different styles within the param list easier, Template:Pipe already exists and is required as it is a special char within mediawiki syntax, could use {{!}} as a shorter alternative to pipe.

{{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.

vs.

{{API <!-- Callin example -->
|prefix = addon <!-- May use gadget: instead? -->
|name = AllowUnitTransfer
|arg1 = {{type|number}} unitID
|arg2 = {{type|number}} unitDefID
|arg3 = {{type|number}} oldTeam
|arg4 = {{type|number}} newTeam
|arg5 = {{type|bool}} capture
|return = {{type|bool}} allow <!-- note that this is a different entry than output above -->
|info = Called just before a unit is transferred to a different team, the boolean return value determines whether or not the transfer is permitted.
}}


addon.AllowUnitTransfer(number unitID, number unitDefID, number oldTeam, number newTeam, bool capture)

return: bool allow

Called just before a unit is transferred to a different team, the boolean return value determines whether or not the transfer is permitted.

TODO:

Major

Minor

Undocumented Features

Template:LuaCallout Examples

{{{prefix}}}UseTeamResource ( {{{arg1}}}, {{{arg2}}}, {{{arg3}}}, {{{arg4}}}, {{{arg5}}}, {{{arg6}}}, {{{arg7}}}, {{{arg8}}}, {{{arg9}}} )
return: nil | bool hadEnough