Date: 2020/01/26 12:57:29 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
takeASit:
type: world
events:
on player right clicks *_slab|*_stairs using off_hand:
# Evitamos que se sienten sobre un slab doble, o top
- if <list[double|top].contains[<context.location.material.slab_type>]>:
- stop
# Prevenimos que spameen el sit, que se sienten en otro lugar estando ya en una silla, y que no estén agachados
- if <player.has_flag[SitDelay]> || <player.has_flag[Essentials.Chair]> || <player.is_sneaking>:
- stop
- flag player SitDelay duration:10t
# las escaleras necesitan parámetros de dirección, orientación y localización
- if <list[stairs].contains[<context.location.material>]>:
- define Direction <context.location.material.direction>
- define Directions <list[EAST/90|SOUTH/180|WEST/270|NORTH/360]>
- define Location <list[NORTH/0.5,-1.25,0.75|SOUTH/0.5,-1.25,0.25|EAST/0.25,-1.25,0.5|WEST/0.75,-1.25,0.5]>
# obtenidos esos parámetros, los incluimos en el armor_stand
- spawn armor_stand[gravity=false;visible=false] <player.location.cursor_on.add[<[Location].map_get[<[Direction]>]>].with_yaw[<[Directions].map_get[<[Direction]>]>]> save:Seat
- else:
# los slabs no tienen los mismo parámetros que una escalera, pero se necesita ajustar la altura del jugador
- spawn armor_stand[gravity=false;visible=false] <player.location.cursor_on.add[0.5,-1.25,0.5]> save:Seat
- define Chair <entry[Seat].spawned_entities.get[1]>
- wait 1t
- mount <player>|<[Chair]>
# esta flag evitará que se teletransporten estando en una silla
- flag <player> sitting
- flag <player> Essentials.Chair:<[Chair]>
# este evento se dispara a cada tick, comprobando si el jugador está sobre una entidad
on player steers entity:
- if <context.dismount>:
- remove <player.flag[Essentials.Chair]>
- flag <player> Essentials.Chair:!
- flag <player> sitting:!
- teleport <player> <player.location.add[0,2,0]>
# controlamos si al hacer teleport están sentados para evitarlo
on player teleports:
- if <player.has_flag[sitting]>:
- narrate "<yellow>No puedes teletransportarte desde una silla..."
- determine passively cancelled