Added sit.sk
This commit is contained in:
parent
c54c581bcf
commit
5b8a95320c
154
scripts/sit.sk
Normal file
154
scripts/sit.sk
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
on join:
|
||||||
|
if {%player%::sit} is not set:
|
||||||
|
set {%player%::sit} to true
|
||||||
|
|
||||||
|
function contains(list: objects, check: object) :: boolean:
|
||||||
|
loop {_list::*}:
|
||||||
|
if loop-value is {_check}:
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
|
command /position:
|
||||||
|
trigger:
|
||||||
|
loop 1000 times:
|
||||||
|
send "%x of velocity of player%"
|
||||||
|
wait 1 tick
|
||||||
|
|
||||||
|
command /sit [<text>]:
|
||||||
|
trigger:
|
||||||
|
player's world is not "world-you-dont-want-sit-working"
|
||||||
|
|
||||||
|
set {_cont} to true
|
||||||
|
|
||||||
|
loop all entities in radius 1.1 around location of block below player:
|
||||||
|
if loop-entity is a pig:
|
||||||
|
send "&6 Система &8| &7Хтось вже сидить на цьому місці (можливо, ви самі)" to player
|
||||||
|
stop
|
||||||
|
|
||||||
|
{_cont} is set
|
||||||
|
|
||||||
|
if x of velocity of player or z of velocity of player is not 0:
|
||||||
|
send "&6 Система &8| &7Не можна сідати під час руху."
|
||||||
|
stop
|
||||||
|
|
||||||
|
if y of velocity of player is less than -0.09:
|
||||||
|
send "&6 Система &8| &7Не можна сідати під час руху."
|
||||||
|
stop
|
||||||
|
else if y of velocity of player is more than -0.07:
|
||||||
|
send "&6 Система &8| &7Не можна сідати під час руху."
|
||||||
|
stop
|
||||||
|
|
||||||
|
if vehicle of player is set:
|
||||||
|
send "&6 Система &8| &7Не можна сісти знову, ви вже сидите." to player
|
||||||
|
stop
|
||||||
|
|
||||||
|
set {_spawnloc} to location of player
|
||||||
|
set y-coordinate of {_spawnloc} to y-coordinate of {_spawnloc}-0.9
|
||||||
|
|
||||||
|
spawn 1 pig at {_spawnloc}
|
||||||
|
|
||||||
|
set name of last spawned pig to "&fСидіння"
|
||||||
|
set {_pig} to spawned pig
|
||||||
|
set health of {_pig} to 1
|
||||||
|
|
||||||
|
Add "{NoAI:1}" to entity nbt of {_pig}
|
||||||
|
Add "{NoGravity:1}" to entity nbt of {_pig}
|
||||||
|
Add "{Invulnerable:1}" to entity nbt of {_pig}
|
||||||
|
Add "{Silent:1}" to entity nbt of {_pig}
|
||||||
|
|
||||||
|
apply potion of invisibility without any particles to {_pig} for 9 days
|
||||||
|
make the player ride {_pig}
|
||||||
|
|
||||||
|
on death:
|
||||||
|
name of victim is "&fСидіння"
|
||||||
|
clear drops
|
||||||
|
|
||||||
|
on vehicle exit:
|
||||||
|
name of vehicle of player is "&fСидіння":
|
||||||
|
delete vehicle of player
|
||||||
|
|
||||||
|
set {_w} to world of player
|
||||||
|
set {_loc} to location of player
|
||||||
|
set y-coordinate of {_loc} to y-coordinate of {_loc}+0.6
|
||||||
|
|
||||||
|
wait a tick
|
||||||
|
|
||||||
|
{_w} is player's world
|
||||||
|
teleport player to {_loc}
|
||||||
|
|
||||||
|
command /togglesit:
|
||||||
|
trigger:
|
||||||
|
if {%player%::sit} is true:
|
||||||
|
set {%player%::sit} to false
|
||||||
|
send "&6 Налаштування &8| &7Сидіння при кліку на сходах &cвимкнено&7."
|
||||||
|
else:
|
||||||
|
set {%player%::sit} to true
|
||||||
|
send "&6 Налаштування &8| &7Сидіння при кліку на сходах &aувімкнено&7."
|
||||||
|
|
||||||
|
on rightclick:
|
||||||
|
if player is not sneaking:
|
||||||
|
if clicked block is set:
|
||||||
|
if minecraft name of clicked block is "minecraft:oak_stairs" or "minecraft:stone_stairs" or "minecraft:brick_stairs" or "minecraft:stone_brick_stairs" or "minecraft:nether_brick_stairs" or "minecraft:sandstone_stairs" or "minecraft:spruce_stairs" or "minecraft:birch_stairs" or "minecraft:jungle_stairs" or "minecraft:quartz_stairs" or "minecraft:acacia_stairs" or "minecraft:dark_oak_stairs" or "minecraft:red_sandstone_stairs" or "minecraft:purpur_stairs":
|
||||||
|
if {%player%::sit} is true:
|
||||||
|
if data value of clicked block is between 0 and 3:
|
||||||
|
if block above event-block is air:
|
||||||
|
set {_cont} to true
|
||||||
|
|
||||||
|
loop all entities in radius 1.1 around location of block below player:
|
||||||
|
if loop-entity is a pig:
|
||||||
|
send "&6 Система &8| &7Хтось вже сидить на цьому місці (можливо, ви самі)" to player
|
||||||
|
stop
|
||||||
|
|
||||||
|
{_cont} is set
|
||||||
|
|
||||||
|
if y of velocity of player is less than -0.09:
|
||||||
|
send "&6 Система &8| &7Не можна сідати під час руху."
|
||||||
|
stop
|
||||||
|
else if y of velocity of player is more than -0.07:
|
||||||
|
send "&6 Система &8| &7Не можна сідати під час руху."
|
||||||
|
stop
|
||||||
|
|
||||||
|
if vehicle of player is set:
|
||||||
|
send "&6 Система &8| &7Не можна сісти знову, ви вже сидите." to player
|
||||||
|
stop
|
||||||
|
|
||||||
|
if "%clicked block%" contains "southward":
|
||||||
|
set {_stairloc} to -180
|
||||||
|
else if "%clicked block%" contains "westward":
|
||||||
|
set {_stairloc} to -90
|
||||||
|
else if "%clicked block%" contains "northward":
|
||||||
|
set {_stairloc} to 0
|
||||||
|
else:
|
||||||
|
set {_stairloc} to 90
|
||||||
|
|
||||||
|
set {_location} to location of the clicked block
|
||||||
|
set {_location}'s pitch to 0
|
||||||
|
set {_location}'s yaw to {_stairloc}
|
||||||
|
|
||||||
|
teleport player to {_location}
|
||||||
|
wait 2 ticks
|
||||||
|
|
||||||
|
set {_spawnloc} to location of player
|
||||||
|
set y-coordinate of {_spawnloc} to y-coordinate of {_spawnloc}-0.9
|
||||||
|
|
||||||
|
spawn 1 pig at {_spawnloc}
|
||||||
|
set name of last spawned pig to "&fСидіння"
|
||||||
|
set {_pig} to spawned pig
|
||||||
|
set health of {_pig} to 1
|
||||||
|
|
||||||
|
Add "{NoAI:1}" to entity nbt of {_pig}
|
||||||
|
Add "{NoGravity:1}" to entity nbt of {_pig}
|
||||||
|
Add "{Invulnerable:1}" to entity nbt of {_pig}
|
||||||
|
Add "{Silent:1}" to entity nbt of {_pig}
|
||||||
|
|
||||||
|
apply potion of invisibility without any particles to {_pig} for 9 days
|
||||||
|
make the player ride {_pig}
|
||||||
|
else:
|
||||||
|
send "&6 Система &8| &7Місце для сидіння заблоковано зверху."
|
||||||
|
stop
|
||||||
|
else:
|
||||||
|
send "&6 Система &8| &7Не можна сісти догори дригом."
|
||||||
|
stop
|
||||||
|
|
||||||
|
on load:
|
||||||
|
send formatted "&6 Система &8| &7Модуль &aсидіння &7завантажено." to console
|
Loading…
Reference in New Issue
Block a user