skriptMC/deacoudre.sk

130 lines
5.8 KiB
Text
Raw Normal View History

2021-06-28 21:03:09 +02:00
options:
X1: 103.5
Z1: -312.5
2021-06-29 22:25:25 +02:00
Yeau: 57.5
X2: 99.5
2021-06-28 21:03:09 +02:00
Z2: -304.5
2021-06-28 21:50:46 +02:00
on load:
ScriptList("add", script)
on unload:
ScriptList("remove", script)
2021-06-28 14:39:15 +02:00
command deacoudre [<text>]: # lancement de la partie
executable by: players
description: Lance une partie de dé à coudre.
trigger:
2021-06-28 14:39:15 +02:00
if arg-1 is set:
2021-06-29 08:49:40 +02:00
if arg-1 is "spawn":
if player is op:
2021-06-28 14:39:15 +02:00
set {thimble.location} to location of player
send "&aLe dé à coudre téléportes désormais ici."
stop
2021-06-29 08:49:40 +02:00
else:
send option("errorMessage")
stop
2021-06-28 14:39:15 +02:00
if {thimble.location} is not set:
send "&4Tu n'as pas défini de point de téléportation : &r&l/deacoudre spawn"
stop
if {party.player.%uuid of player%} is set:
if {thimble} is true:
delete {thimble}
loop {party.list::*}:
send "&cPartie de dé à coudre terminée." to loop-value
set gamemode of loop-value to creative
else:
set {thimble} to true
loop {party.list::*}:
send "&aDémarrage de la partie de dé à coudre !" to loop-value
2021-06-28 14:39:15 +02:00
teleport loop-value to {thimble.location}
set gamemode of loop-value to adventure
feed loop-value
heal loop-value
cure loop-value
2021-06-29 23:37:58 +02:00
execute console command "fill 103 57 -313 99 57 -305 water"
# execute console command "fill %{@X1}% %{@Yeau}% %{@Z1}% %{@X2}% %{@Yeau}% %{@Z2}% water"
else:
send "&4Tu n'es pas dans une partie."
2021-06-29 09:18:06 +02:00
function getDifference(arg: text, block: block, comparative: number) :: number:
if {_arg} is "x":
set {_res} to difference between X-location of {_block} and {_comparative}
if {_arg} is "y":
set {_res} to difference between Y-location of {_block} and {_comparative}
if {_arg} is "z":
set {_res} to difference between Z-location of {_block} and {_comparative}
return {_res}
2021-06-28 12:04:45 +02:00
every 0.5 second in "world": # pose du bloc et téléporatation
if {thimble} is not true:
stop
loop {party.list::*}:
set action bar of loop-value to "&dEn partie de &lDé à coudre&r&d."
2021-06-28 21:03:09 +02:00
if block at loop-value is water: # si dans l'eau
# vérification que c'est l'eau du dé à coudre
2021-06-29 09:18:06 +02:00
set {_xLocationBlock1} to getDifference("x", block at loop-value, {@X1})
set {_xLocationBlock2} to getDifference("x", block at loop-value, {@X2})
set {_zLocationBlock1} to getDifference("z", block at loop-value, {@Z1})
set {_zLocationBlock2} to getDifference("z", block at loop-value, {@Z2})
set {_yLocationBlock} to getDifference("y", block at loop-value, {@Yeau})
if {_xLocationBlock1} and {_xLocationBlock2} and {_zLocationBlock1} and {_zLocationBlock2} <= 0:
continue
2021-06-29 22:25:25 +02:00
if {_xLocationBlock1} and {_xLocationBlock2} >= abs({@X1} - {@X2}):
continue
if {_yLocationBlock} != 0:
continue
2021-06-29 22:25:25 +02:00
if {_zLocationBlock1} and {_zLocationBlock2} >= abs({@Z1} - {@Z2}):
continue
2021-06-28 21:03:09 +02:00
# vérification si c'est un jump qui est dur à faire (entre 4 blocs pleins)
set {_niceJump} to true
set {_blockX} to X-location of block at loop-value
set {_blockY} to Y-location of block at loop-value
set {_blockZ} to Z-location of block at loop-value
if block at location ({_blockX} - 1), {_blockY}, {_blockZ} in world "world" is water:
set {_niceJump} to false
if block at location ({_blockX} + 1), {_blockY}, {_blockZ} in world "world" is water:
set {_niceJump} to false
if block at location {_blockX}, {_blockY}, ({_blockZ} - 1) in world "world" is water:
set {_niceJump} to false
if block at location {_blockX}, {_blockY}, ({_blockZ} + 1) in world "world" is water:
set {_niceJump} to false
2021-06-28 21:03:09 +02:00
# pose du bloc (or si jump difficile + message, laine si normal)
2021-06-29 22:25:25 +02:00
set block at loop-value to wool
2021-06-28 15:28:29 +02:00
if {thimble.dead.%uuid of loop-value%} is not set:
if {_niceJump} is true:
set block at loop-value to gold block
2021-06-29 22:09:02 +02:00
set {_player} to userOrNick(loop-value)
2021-06-28 15:28:29 +02:00
loop {party.list::*}:
2021-06-29 22:25:25 +02:00
send "&a&l%{_player}%&r&e a réalisé un dé à coudre !" to loop-value-2
2021-06-28 15:28:29 +02:00
else:
delete {thimble.dead.%uuid of loop-value%}
2021-06-28 21:03:09 +02:00
# téléportation et feed/heal
2021-06-28 14:39:15 +02:00
teleport loop-value to {thimble.location}
feed loop-value
heal loop-value
2021-06-28 14:39:15 +02:00
on death:
if {thimble} is true:
if {party.player.%uuid of player%} is set:
cancel event
set gamemode of player to spectator
2021-06-28 21:03:09 +02:00
set {thimble.dead.%uuid of player%} to true
2021-06-29 09:18:06 +02:00
set {_finPartie} to 0
2021-06-28 14:39:15 +02:00
loop {party.list::*}:
2021-06-29 22:09:02 +02:00
if {thimble.dead.%uuid of loop-value%} is not set:
set {_gagnant} to userOrNick(loop-value)
2021-06-29 09:18:06 +02:00
add 1 to {_finPartie}
2021-06-29 22:09:02 +02:00
else:
set {_player} to userOrNick(loop-value)
send "&c%{_player}%&b a été éliminé !" to loop-value
2021-06-29 09:18:06 +02:00
if {_finPartie} is 1 or 0:
loop {party.list::*}:
if {_gagnant} is set:
send "&a&l%{_gagnant}%&r&l a gagné la partie !!" to loop-value
else:
2021-06-29 22:09:02 +02:00
send "&cTu étais tout seul à jouer... bravo quand même ?" to loop-value
2021-06-28 21:03:09 +02:00
execute player command "deacoudre"