Switch out l() syntax to [] in docs (#851)
* Switch out l() syntax to [] in docs * Using map syntactic sugar as well. Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
This commit is contained in:
1 parent
451b35b6c5
commit
a343c5d9f2
10 files changed
+59
-60
No files matched your search
@@ -50,7 +50,7 @@ Throws `unknown_particle` if particle doesn't exist.
|
||||
## Markers
|
||||
|
||||
### `draw_shape(shape, duration, key?, value?, ... )`,
|
||||
### `draw_shape(shape, duration, l(key?, value?, ... ))`,
|
||||
### `draw_shape(shape, duration, [key?, value?, ... ])`,
|
||||
### `draw_shape(shape, duration, attribute_map)`
|
||||
### `draw_shape(shape_list)`
|
||||
|
||||
@@ -212,7 +212,7 @@ produce an exception.
|
||||
Displays the result of the expression to the chat. Overrides default `scarpet` behaviour of sending everyting to stderr.
|
||||
Can optionally define player or list of players to send the message to.
|
||||
|
||||
### `format(components, ...)`, `format(l(components, ...))`
|
||||
### `format(components, ...)`, `format([components, ...])`
|
||||
|
||||
Creates a line of formatted text. Each component is either a string indicating formatting and text it corresponds to
|
||||
or a decorator affecting the component preceding it.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Specifying blocks
|
||||
|
||||
### `block(x, y, z)`, `block(l(x,y,z))`, `block(state)`
|
||||
### `block(x, y, z)`, `block([x,y,z])`, `block(state)`
|
||||
|
||||
Returns either a block from specified location, or block with a specific state (as used by `/setblock` command),
|
||||
so allowing for block properties, block entity data etc. Blocks otherwise can be referenced everywhere by its simple
|
||||
@@ -56,7 +56,7 @@ Throws `unknown_block` if provided block to set is not valid
|
||||
|
||||
<pre>
|
||||
set(0,5,0,'bedrock') => bedrock
|
||||
set(l(0,5,0), 'bedrock') => bedrock
|
||||
set([0,5,0], 'bedrock') => bedrock
|
||||
set(block(0,5,0), 'bedrock') => bedrock
|
||||
scan(0,5,0,0,0,0,set(_,'bedrock')) => 1
|
||||
set(pos(player()), 'bedrock') => bedrock
|
||||
@@ -91,7 +91,7 @@ generator. The following code causes a cascading effect as blocks placed on chun
|
||||
loaded to full, thus generated:
|
||||
|
||||
<pre>
|
||||
__config() -> m(l('scope', 'global'));
|
||||
__config() -> {'scope' -> 'global'};
|
||||
__on_chunk_generated(x, z) -> (
|
||||
scan(x,0,z,0,0,0,15,15,15,
|
||||
if (perlin(_x/16, _y/8, _z/16) > _y/16,
|
||||
@@ -104,7 +104,7 @@ __on_chunk_generated(x, z) -> (
|
||||
The following addition resolves this issue, by not allowing block updates past chunk borders:
|
||||
|
||||
<pre>
|
||||
__config() -> m(l('scope', 'global'));
|
||||
__config() -> {'scope' -> 'global'};
|
||||
__on_chunk_generated(x, z) -> (
|
||||
without_updates(
|
||||
scan(x,0,z,0,0,0,15,15,15,
|
||||
@@ -202,7 +202,7 @@ mine(x,y,z) ->
|
||||
slot = p~'selected_slot';
|
||||
item_tuple = inventory_get(p, slot);
|
||||
if (!item_tuple, destroy(x,y,z,'air'); return()); // empty hand, just break with 'air'
|
||||
l(item, count, tag) = item_tuple;
|
||||
[item, count, tag] = item_tuple;
|
||||
tag_back = destroy(x,y,z, item, tag);
|
||||
if (tag_back == false, // failed to break the item
|
||||
return(tag_back)
|
||||
@@ -254,8 +254,8 @@ Returns a triple of coordinates of a specified block or entity. Technically enti
|
||||
and the same can be achieved with `query(entity,'pos')`, but for simplicity `pos` allows to pass all positional objects.
|
||||
|
||||
<pre>
|
||||
pos(block(0,5,0)) => l(0,5,0)
|
||||
pos(player()) => l(12.3, 45.6, 32.05)
|
||||
pos(block(0,5,0)) => [0,5,0]
|
||||
pos(player()) => [12.3, 45.6, 32.05]
|
||||
pos(block('stone')) => Error: Cannot fetch position of an unrealized block
|
||||
</pre>
|
||||
|
||||
@@ -265,8 +265,8 @@ Returns a coords triple that is offset in a specified `direction` by `amount` of
|
||||
1 block. To offset into opposite facing, use negative numbers for the `amount`.
|
||||
|
||||
<pre>
|
||||
pos_offset(block(0,5,0), 'up', 2) => l(0,7,0)
|
||||
pos_offset(l(0,5,0), 'up', -2 ) => l(0,3,0)
|
||||
pos_offset(block(0,5,0), 'up', 2) => [0,7,0]
|
||||
pos_offset([0,5,0], 'up', -2 ) => [0,3,0]
|
||||
</pre>
|
||||
|
||||
### `(Deprecated) block_properties(pos)`
|
||||
@@ -551,7 +551,7 @@ Returns spawn potential at a location (1.16+ only)
|
||||
|
||||
Sends full chunk data to clients. Useful when lots stuff happened and you want to refresh it on the clients.
|
||||
|
||||
### `reset_chunk(pos)`, `reset_chunk(from_pos, to_pos)`, `reset_chunk(l(pos, ...))`
|
||||
### `reset_chunk(pos)`, `reset_chunk(from_pos, to_pos)`, `reset_chunk([pos, ...])`
|
||||
Removes and resets the chunk, all chunks in the specified area or all chunks in a list at once, removing all previous
|
||||
blocks and entities, and replacing it with a new generation. For all currently loaded chunks, they will be brought
|
||||
to their current generation status, and updated to the player. All chunks that are not in the loaded area, will only
|
||||
@@ -822,4 +822,3 @@ with the game and assumed not changing.
|
||||
|
||||
`custom_dimension` is experimental and considered a WIP. More customization options besides the seed will be added in
|
||||
the future.
|
||||
|
||||
@@ -102,7 +102,7 @@ which in this case can be radically simplified:
|
||||
|
||||
<pre>
|
||||
query(p, 'name') <=> p ~ 'name' // much shorter and cleaner
|
||||
query(p, 'holds', 'offhand') <=> p ~ l('holds', 'offhand') // not really but can be done
|
||||
query(p, 'holds', 'offhand') <=> p ~ ['holds', 'offhand'] // not really but can be done
|
||||
</pre>
|
||||
|
||||
### `query(e, 'removed')`
|
||||
@@ -151,7 +151,7 @@ Returns a 3d vector where the entity is looking.
|
||||
|
||||
### `query(e, 'motion')`
|
||||
|
||||
Triple of entity's motion vector, `l(motion_x, motion_y, motion_z)`. Motion represents the velocity from all the forces
|
||||
Triple of entity's motion vector, `[motion_x, motion_y, motion_z]`. Motion represents the velocity from all the forces
|
||||
that exert on the given entity. Things that are not 'forces' like voluntary movement, or reaction from the ground are
|
||||
not part of said forces.
|
||||
|
||||
@@ -573,11 +573,11 @@ Removes (not kills) entity from the game.
|
||||
|
||||
Kills the entity.
|
||||
|
||||
### `modify(e, 'pos', x, y, z), modify(e, 'pos', l(x,y,z) )`
|
||||
### `modify(e, 'pos', x, y, z), modify(e, 'pos', [x,y,z] )`
|
||||
|
||||
Moves the entity to a specified coords.
|
||||
|
||||
### `modify(e, 'location', x, y, z, yaw, pitch), modify(e, 'location', l(x, y, z, yaw, pitch) )`
|
||||
### `modify(e, 'location', x, y, z, yaw, pitch), modify(e, 'location', [x, y, z, yaw, pitch] )`
|
||||
|
||||
Changes full location vector all at once.
|
||||
|
||||
@@ -599,11 +599,11 @@ When pointing straight up or down, yaw will stay the same.
|
||||
|
||||
For living entities, controls their head and body yaw angle.
|
||||
|
||||
### `modify(e, 'move', x, y, z), modify(e, 'move', l(x,y,z) )`
|
||||
### `modify(e, 'move', x, y, z), modify(e, 'move', [x,y,z] )`
|
||||
|
||||
Moves the entity by a vector from its current location.
|
||||
|
||||
### `modify(e, 'motion', x, y, z), modify(e, 'motion', l(x,y,z) )`
|
||||
### `modify(e, 'motion', x, y, z), modify(e, 'motion', [x,y,z] )`
|
||||
|
||||
Sets the motion vector (where and how much entity is moving).
|
||||
|
||||
@@ -611,7 +611,7 @@ Sets the motion vector (where and how much entity is moving).
|
||||
|
||||
Sets the corresponding component of the motion vector.
|
||||
|
||||
### `modify(e, 'accelerate', x, y, z), modify(e, 'accelerate', l(x, y, z) )`
|
||||
### `modify(e, 'accelerate', x, y, z), modify(e, 'accelerate', [x, y, z] )`
|
||||
|
||||
Adds a vector to the motion vector. Most realistic way to apply a force to an entity.
|
||||
|
||||
@@ -662,15 +662,15 @@ Mounts the entity to the `other`.
|
||||
|
||||
Shakes off all passengers.
|
||||
|
||||
### `modify(e, 'mount_passengers', passenger, ? ...), modify(e, 'mount_passengers', l(passengers) )`
|
||||
### `modify(e, 'mount_passengers', passenger, ? ...), modify(e, 'mount_passengers', [passengers] )`
|
||||
|
||||
Mounts on all listed entities on `e`.
|
||||
|
||||
### `modify(e, 'tag', tag, ? ...), modify(e, 'tag', l(tags) )`
|
||||
### `modify(e, 'tag', tag, ? ...), modify(e, 'tag', [tags] )`
|
||||
|
||||
Adds tag(s) to the entity.
|
||||
|
||||
### `modify(e, 'clear_tag', tag, ? ...), modify(e, 'clear_tag', l(tags) )`
|
||||
### `modify(e, 'clear_tag', tag, ? ...), modify(e, 'clear_tag', [tags] )`
|
||||
|
||||
Removes tag(s) from the entity.
|
||||
|
||||
@@ -867,7 +867,7 @@ protect_villager(entity, amount, source, source_entity, healing_player) ->
|
||||
(
|
||||
if(source_entity && source_entity~'type' != 'player',
|
||||
modify(entity, 'health', amount + entity~'health' );
|
||||
particle('end_rod', pos(entity)+l(0,3,0));
|
||||
particle('end_rod', pos(entity)+[0,3,0]);
|
||||
print(str('%s healed thanks to %s', entity, healing_player))
|
||||
)
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user