Skip to content

Commit

Permalink
Fix elevator scan range
Browse files Browse the repository at this point in the history
  • Loading branch information
bill96012 committed Feb 4, 2021
1 parent 33d3961 commit 72d7942
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 59 deletions.
4 changes: 1 addition & 3 deletions data/galaxy/functions/block/elevator/go-down.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
scoreboard players set #1 calcu_temp 0
function galaxy:block/elevator/scan_to_temp-down
execute if score #1 calcu_temp matches 1.. run function galaxy:block/elevator/tp-down
function galaxy:block/elevator/tp-down
tag @a[tag=reqElevatorGoDown] remove reqElevatorGoDown
4 changes: 1 addition & 3 deletions data/galaxy/functions/block/elevator/go-up.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
scoreboard players set #1 calcu_temp 0
function galaxy:block/elevator/scan_to_temp-up
execute if score #1 calcu_temp matches 1.. run function galaxy:block/elevator/tp-up
function galaxy:block/elevator/tp-up
tag @a[tag=reqElevatorGoUp] remove reqElevatorGoUp
9 changes: 5 additions & 4 deletions data/galaxy/functions/block/elevator/scan.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ execute if entity @s[tag=checkUp] run tp @s ~ ~1 ~
execute if entity @s[tag=checkDown] run tp @s ~ ~-1 ~

scoreboard players add #1 calcu_temp 1
execute at @s store success score #2 calcu_temp if entity @e[tag=elevator,distance=..0.05]
execute if entity @s[tag=checkSafe] if score #2 calcu_temp matches 1 at @s store success score #2 calcu_temp if block ~ ~1 ~ #minecraft:passable

execute unless score #2 calcu_temp matches 1 unless score #1 calcu_temp matches 16 at @s run function galaxy:block/elevator/scan
execute if score #1 calcu_temp matches 16 run scoreboard players set #1 calcu_temp -1
execute at @s store success score #2 calcu_temp if entity @e[tag=elevator,distance=..0.05]
execute if score #2 calcu_temp matches 1 at @s store success score #2 calcu_temp if block ~ ~1 ~ #minecraft:passable

execute unless score #1 calcu_temp matches 16 unless score #2 calcu_temp matches 1 at @s run function galaxy:block/elevator/scan
execute if score #1 calcu_temp matches 16 unless score #2 calcu_temp matches 1 run scoreboard players set #1 calcu_temp -1
kill @s

This file was deleted.

This file was deleted.

36 changes: 20 additions & 16 deletions data/galaxy/functions/block/elevator/tp-down.mcfunction
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
execute if score @s elevatorTempDown matches 2 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-2 ~
execute if score @s elevatorTempDown matches 3 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-3 ~
execute if score @s elevatorTempDown matches 4 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-4 ~
execute if score @s elevatorTempDown matches 5 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-5 ~
execute if score @s elevatorTempDown matches 6 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-6 ~
execute if score @s elevatorTempDown matches 7 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-7 ~
execute if score @s elevatorTempDown matches 8 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-8 ~
execute if score @s elevatorTempDown matches 9 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-9 ~
execute if score @s elevatorTempDown matches 10 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-10 ~
execute if score @s elevatorTempDown matches 11 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-11 ~
execute if score @s elevatorTempDown matches 12 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-12 ~
execute if score @s elevatorTempDown matches 13 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-13 ~
execute if score @s elevatorTempDown matches 14 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-14 ~
execute if score @s elevatorTempDown matches 15 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-15 ~
execute if score @s elevatorTempDown matches 16 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-16 ~
function galaxy:block/elevator/scan_init
tag @e[tag=elevatorScanner] add checkDown
execute as @e[tag=elevatorScanner] at @s run function galaxy:block/elevator/scan

execute at @a[tag=reqElevatorGoDown] run function galaxy:block/elevator/sound-teleport
execute if score #1 calcu_temp matches 2 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-2 ~
execute if score #1 calcu_temp matches 3 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-3 ~
execute if score #1 calcu_temp matches 4 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-4 ~
execute if score #1 calcu_temp matches 5 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-5 ~
execute if score #1 calcu_temp matches 6 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-6 ~
execute if score #1 calcu_temp matches 7 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-7 ~
execute if score #1 calcu_temp matches 8 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-8 ~
execute if score #1 calcu_temp matches 9 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-9 ~
execute if score #1 calcu_temp matches 10 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-10 ~
execute if score #1 calcu_temp matches 11 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-11 ~
execute if score #1 calcu_temp matches 12 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-12 ~
execute if score #1 calcu_temp matches 13 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-13 ~
execute if score #1 calcu_temp matches 14 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-14 ~
execute if score #1 calcu_temp matches 15 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-15 ~
execute if score #1 calcu_temp matches 16 as @a[tag=reqElevatorGoDown] at @s run tp @s ~ ~-16 ~

execute if score #1 calcu_temp matches 2..16 at @a[tag=reqElevatorGoDown] run function galaxy:block/elevator/sound-teleport
36 changes: 20 additions & 16 deletions data/galaxy/functions/block/elevator/tp-up.mcfunction
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
execute if score @s elevatorTempUp matches 2 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~2 ~
execute if score @s elevatorTempUp matches 3 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~3 ~
execute if score @s elevatorTempUp matches 4 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~4 ~
execute if score @s elevatorTempUp matches 5 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~5 ~
execute if score @s elevatorTempUp matches 6 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~6 ~
execute if score @s elevatorTempUp matches 7 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~7 ~
execute if score @s elevatorTempUp matches 8 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~8 ~
execute if score @s elevatorTempUp matches 9 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~9 ~
execute if score @s elevatorTempUp matches 10 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~10 ~
execute if score @s elevatorTempUp matches 11 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~11 ~
execute if score @s elevatorTempUp matches 12 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~12 ~
execute if score @s elevatorTempUp matches 13 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~13 ~
execute if score @s elevatorTempUp matches 14 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~14 ~
execute if score @s elevatorTempUp matches 15 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~15 ~
execute if score @s elevatorTempUp matches 16 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~16 ~
function galaxy:block/elevator/scan_init
tag @e[tag=elevatorScanner] add checkUp
execute as @e[tag=elevatorScanner] at @s run function galaxy:block/elevator/scan

execute at @a[tag=reqElevatorGoUp] run function galaxy:block/elevator/sound-teleport
execute if score #1 calcu_temp matches 2 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~2 ~
execute if score #1 calcu_temp matches 3 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~3 ~
execute if score #1 calcu_temp matches 4 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~4 ~
execute if score #1 calcu_temp matches 5 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~5 ~
execute if score #1 calcu_temp matches 6 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~6 ~
execute if score #1 calcu_temp matches 7 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~7 ~
execute if score #1 calcu_temp matches 8 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~8 ~
execute if score #1 calcu_temp matches 9 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~9 ~
execute if score #1 calcu_temp matches 10 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~10 ~
execute if score #1 calcu_temp matches 11 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~11 ~
execute if score #1 calcu_temp matches 12 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~12 ~
execute if score #1 calcu_temp matches 13 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~13 ~
execute if score #1 calcu_temp matches 14 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~14 ~
execute if score #1 calcu_temp matches 15 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~15 ~
execute if score #1 calcu_temp matches 16 as @a[tag=reqElevatorGoUp] at @s run tp @s ~ ~16 ~

execute if score #1 calcu_temp matches 2..16 at @a[tag=reqElevatorGoUp] run function galaxy:block/elevator/sound-teleport
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ scoreboard objectives add workProc1Burn dummy "num-Block work processor1 burn ti
scoreboard objectives add workProc1BurnMax dummy "num-Block work processor1 burn time max"
scoreboard objectives add workProc1Fuel dummy "num-Block work processor1 fuel"
scoreboard objectives add workProc1Prog dummy "num-Block work processor1 progress"

scoreboard objectives add elevatorTempUp dummy "num-Elevator temp up"
scoreboard objectives add elevatorTempDown dummy "num-Elevator temp down"
2 changes: 0 additions & 2 deletions data/galaxy/functions/block/placer/elevator.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ execute unless entity @s[tag=placeFailed] run setblock ~ ~ ~ minecraft:barrel{Cu

execute unless entity @s[tag=placeFailed] run summon minecraft:armor_stand ~ ~1 ~ {CustomNameVisible:0b,NoGravity:1b,Invulnerable:1b,Small:1b,Marker:1b,Invisible:1b,Tags:["fake_block","elevator_fake_block"],ArmorItems:[{},{},{},{id:"minecraft:wooden_sword",Count:1b,tag:{CustomModelData:10500,fakeBlock:1}}]}

execute as @e[tag=elevator,tag=init] at @s run function galaxy:block/elevator/scan_to_temp-up
execute as @e[tag=elevator,tag=init] at @s run function galaxy:block/elevator/scan_to_temp-down
tag @e[tag=elevator,tag=init] remove init

execute if entity @s[tag=placeFailed] as @a[tag=triggerPlaceBlock,gamemode=!creative] run function galaxy:block/give/elevator
Expand Down

0 comments on commit 72d7942

Please sign in to comment.