mirror of
https://github.com/minetest/minetest_docs.git
synced 2024-07-07 08:35:16 +02:00
Rework standard template
This commit is contained in:
parent
f0d413a2a7
commit
584f2b522a
Binary file not shown.
Before Width: | Height: | Size: 316 KiB |
@ -1,48 +1,109 @@
|
|||||||
= Pomegranates
|
= `Vehicle`
|
||||||
include::../include/config.adoc[]
|
include::../include/config.adoc[]
|
||||||
:description: A sample template for using AsciiDoc.
|
:description: The standard style template for documentation.
|
||||||
:keywords: sample
|
:keywords: standard, template
|
||||||
|
|
||||||
This is a sample template of how a good AsciiDoc can be structured.
|
This is the standard template of how a good AsciiDoc should be structured.
|
||||||
This pragraph describes the purpose of the document.
|
This pragraph describes the purpose of the document.
|
||||||
In this sample, an imaginary API
|
In this example, an imaginary API for a vehicle will be documented.
|
||||||
for producing pomegranates will be documented.
|
|
||||||
|
|
||||||
So without further ado, here is what we should see when we are done.
|
== `Vehicle` Properties
|
||||||
|
|
||||||
[#img-pomegranate]
|
=== `make: string`
|
||||||
.The Expected Result
|
The make of the vehicle.
|
||||||
image::pomegranate.png[Pomegranate]
|
|
||||||
|
|
||||||
== Pomegranate API Methods
|
=== `model: string`
|
||||||
|
The model of the vehicle.
|
||||||
|
|
||||||
=== `plant_tree(pos, name)`
|
=== `year: number`
|
||||||
* `pos`: `vector`
|
The year of the vehicle.
|
||||||
* `name`: `string`
|
|
||||||
|
|
||||||
Plants a tree of type `name` at `pos`
|
=== `trim: string`
|
||||||
if `name` is a registered pomegranate tree.
|
The trim of the vehicle.
|
||||||
|
|
||||||
.Planting A Tree
|
=== `color: ColorSpec`
|
||||||
|
The color of the vehicle.
|
||||||
|
|
||||||
|
== `Vehicle` Methods
|
||||||
|
|
||||||
|
=== `vehicle.new(pos: vector, properties: table) -> Vehicle`
|
||||||
|
* `pos`: The position at which the vehicle will be spanwed.
|
||||||
|
* `properties`: A `table` of Vehicle properties (link).
|
||||||
|
|
||||||
|
Creates a new instance of a `Vehicle` at the given position and returns the new object.
|
||||||
|
|
||||||
|
.Creating a Vehicle
|
||||||
====
|
====
|
||||||
|
|
||||||
[source,lua]
|
[source,lua]
|
||||||
----
|
----
|
||||||
plant_tree(vector.new(35, 42, 36), "regular")
|
local minivan = vehicle.new(vector.new(35, 2, 36), {
|
||||||
|
make = "Toyota",
|
||||||
|
model = "Previa",
|
||||||
|
year = 1992,
|
||||||
|
trim = "LE",
|
||||||
|
color = "white",
|
||||||
|
})
|
||||||
----
|
----
|
||||||
|
|
||||||
====
|
====
|
||||||
|
|
||||||
=== `grow_tree(pos)`
|
=== `set_properties(properties: table)`
|
||||||
* `pos`: `vector`
|
* `properties`: A `table` of Vehicle properties (link).
|
||||||
|
|
||||||
Grows the tree at `pos` if the node at `pos` is a valid pomegranate tree.
|
Sets the properties of the vehicle.
|
||||||
|
|
||||||
=== `spray_tree(pos, pesticide)`
|
=== `get_properties() -> table`
|
||||||
* `pos`: `vector`
|
|
||||||
* `pesticide`: `string`
|
|
||||||
|
|
||||||
Sprays tree at `pos` with `pesticide` if it is a registered chemical.
|
Returns a `table` of Vehicle properties (link).
|
||||||
|
|
||||||
== Source
|
=== `set_pos(pos: vector)`
|
||||||
You can contribute to the documentation at {url-docs-repo}[our GitHub repository]!
|
* `pos`: Where to place the vehicle.
|
||||||
|
|
||||||
|
=== `get_pos() -> vector`
|
||||||
|
|
||||||
|
Returns the position of the vehicle.
|
||||||
|
|
||||||
|
=== `set_gear(gear: number) -> boolean`
|
||||||
|
* `gear`: The gear to shift to. Should be one of
|
||||||
|
** `-1`: Reverse
|
||||||
|
** `0`: Park
|
||||||
|
** `1` - `3`: First - third gear
|
||||||
|
|
||||||
|
Returns `true` upon success, `false` otherwise.
|
||||||
|
|
||||||
|
=== `get_gear() -> number`
|
||||||
|
|
||||||
|
Returns the current gear of the vehicle as a number. See `set_gear` for expected values (link).
|
||||||
|
|
||||||
|
== Global `Vehicle` Functions
|
||||||
|
|
||||||
|
=== `gear_to_name(gear: number) -> string`
|
||||||
|
* `gear`: The gear number to convert.
|
||||||
|
|
||||||
|
Returns the name of the given gear. Expected return values:
|
||||||
|
|
||||||
|
* `-1`: `reverse`
|
||||||
|
* `0`: `park`
|
||||||
|
* `1`: `first`
|
||||||
|
* `2`: `second`
|
||||||
|
* `3`: `third`
|
||||||
|
|
||||||
|
=== `is_electric(make: string, model: string, year: number) -> boolean`
|
||||||
|
* `make`: The make of the vehicle.
|
||||||
|
* `model`: The model of the vehicle.
|
||||||
|
* `year`: The year of the vehicle.
|
||||||
|
|
||||||
|
Returns `true` if the given vehicle is electric, `false` otherwise.
|
||||||
|
|
||||||
|
.Checking an Electric Vehicle
|
||||||
|
====
|
||||||
|
|
||||||
|
[source,lua]
|
||||||
|
----
|
||||||
|
local ev = is_electric("Toyota", "Previa", 1992) -- false
|
||||||
|
----
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Made with https://asciidoctor.org/[AsciiDoctor] | Contribute on {url-docs-repo}[GitHub]
|
||||||
|
Loading…
Reference in New Issue
Block a user