Skip to content

Commit

Permalink
Merge pull request #26 from nea-c/dev
Browse files Browse the repository at this point in the history
update: v3.3
  • Loading branch information
nea-c authored Mar 21, 2023
2 parents b048e05 + ab88dfc commit fe63200
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@

# Y方向接触時、重力合計を反転
execute if score #MarkerMotion.BlockCheck neac_value matches 3..4 store result storage neac: _.MarkerMotion.GravitySum int -1 run scoreboard players get #MarkerMotion.GravitySum neac_value

# スコアリセット
scoreboard players reset #MarkerMotion.Bounce.CG.GSumAtCGPrevBounce
47 changes: 0 additions & 47 deletions MarkerMotion/data/marker_motion/functions/get_move.mcfunction

This file was deleted.

21 changes: 7 additions & 14 deletions MarkerMotion/data/marker_motion/functions/main.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,16 @@
execute unless data storage neac: _.MarkerMotion.speed.loss{type:"*"} store result score #MarkerMotion.SpeedLoss neac_value run data get storage neac: _.MarkerMotion.speed.loss.amount 100
execute if data storage neac: _.MarkerMotion.speed.loss{type:"*"} if data storage neac: _.MarkerMotion.speed.loss.amount store result score #MarkerMotion.SpeedLoss neac_value run data get storage neac: _.MarkerMotion.speed.loss.amount 1000

# 到達目標位置用の取得に使うエンティティセットアップ
# なんか残ってたらkill
execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] run kill @e[type=#marker_motion:selector,tag=MarkerMotion.this]
execute summon marker run function marker_motion:set_arrival_pos

# 1瞬だけつくようにBounce検知用タグの削除。付与は marker_motion:bounce
execute if entity @s[tag=MarkerMotion.bounce] run tag @s remove MarkerMotion.bounce
# 接触したブロックが1tickの間前回と同じのにならないようにする
data modify storage neac: _.BounceDirectionDisable set from storage neac: _.MarkerMotion.BounceDirection
data remove storage neac: _.MarkerMotion.BounceDirection
# 現在位置と到達目標位置の間にブロックがあるかチェック
# function再起で到達目標位置までの間にブロックがあるかチェック
# その際targetタグがいればヒット判定を返す また、stopwith.hitがtrueであればMarkerMotion.stopwith.hitを返す
execute facing entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] feet run function marker_motion:tp/
execute if data storage neac: _.MarkerMotion.BounceDirection run data modify storage neac: _.BounceDirectionDisable set from storage neac: _.MarkerMotion.BounceDirection
execute if data storage neac: _.MarkerMotion.BounceDirection run data remove storage neac: _.MarkerMotion.BounceDirection
# 到達目標位置を取得してそこまでの間にブロックがあるかチェック
# その際targetタグがいればヒット判定も返す
tag @s add MarkerMotion.me
execute summon marker run function marker_motion:tp/
tag @s remove MarkerMotion.me

# スピード減少
# +
Expand All @@ -56,9 +52,6 @@
scoreboard players reset #MarkerMotion.Gravity
scoreboard players reset #MarkerMotion.GravitySum

# 最初の実行位置から移動位置までの距離からMoveを算出 + kill
execute facing entity @s feet as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] run function marker_motion:get_move

# ストレージデータを自身に返して初期化
data modify entity @s data.MarkerMotion set from storage neac: _.MarkerMotion
data remove storage neac: _

This file was deleted.

57 changes: 42 additions & 15 deletions MarkerMotion/data/marker_motion/functions/tp/.mcfunction
Original file line number Diff line number Diff line change
@@ -1,25 +1,52 @@
#> marker_motion:tp/
#
# 移動先目標までの間にブロックがあるか探す処理
# その際にヒットボックスでのヒットを行ったりできる
# 到達目標位置をへ自身を移動させ、その間をチェック
#
# @within
# function marker_motion:main
# @within function marker_motion:main


# プレイヤーの視線をx軸で反転させた角度
execute as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] positioned 0.0 0.0 0.0 positioned ^ ^ ^2 positioned 0.0 ~ ~ positioned ^ ^ ^-1 facing 0.0 0.0 0.0 positioned as @s run tp @s ~ ~ ~ ~ ~
# 相対で移動
scoreboard players operation #MarkerMotion.TMP neac_value = #MarkerMotion.Speed neac_value

# 初期化
data modify storage neac: _.tp set value [[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}]]
execute if score #MarkerMotion.TMP neac_value matches 2048.. positioned as @s run tp @s ^ ^ ^20.48
execute if score #MarkerMotion.TMP neac_value matches 2048.. run scoreboard players remove #MarkerMotion.TMP neac_value 2048
execute if score #MarkerMotion.TMP neac_value matches 1024.. positioned as @s run tp @s ^ ^ ^10.24
execute if score #MarkerMotion.TMP neac_value matches 1024.. run scoreboard players remove #MarkerMotion.TMP neac_value 1024
execute if score #MarkerMotion.TMP neac_value matches 512.. positioned as @s run tp @s ^ ^ ^5.12
execute if score #MarkerMotion.TMP neac_value matches 512.. run scoreboard players remove #MarkerMotion.TMP neac_value 512
execute if score #MarkerMotion.TMP neac_value matches 256.. positioned as @s run tp @s ^ ^ ^2.56
execute if score #MarkerMotion.TMP neac_value matches 256.. run scoreboard players remove #MarkerMotion.TMP neac_value 256
execute if score #MarkerMotion.TMP neac_value matches 128.. positioned as @s run tp @s ^ ^ ^1.28
execute if score #MarkerMotion.TMP neac_value matches 128.. run scoreboard players remove #MarkerMotion.TMP neac_value 128
execute if score #MarkerMotion.TMP neac_value matches 64.. positioned as @s run tp @s ^ ^ ^0.64
execute if score #MarkerMotion.TMP neac_value matches 64.. run scoreboard players remove #MarkerMotion.TMP neac_value 64
execute if score #MarkerMotion.TMP neac_value matches 32.. positioned as @s run tp @s ^ ^ ^0.32
execute if score #MarkerMotion.TMP neac_value matches 32.. run scoreboard players remove #MarkerMotion.TMP neac_value 32
execute if score #MarkerMotion.TMP neac_value matches 16.. positioned as @s run tp @s ^ ^ ^0.16
execute if score #MarkerMotion.TMP neac_value matches 16.. run scoreboard players remove #MarkerMotion.TMP neac_value 16
execute if score #MarkerMotion.TMP neac_value matches 8.. positioned as @s run tp @s ^ ^ ^0.08
execute if score #MarkerMotion.TMP neac_value matches 8.. run scoreboard players remove #MarkerMotion.TMP neac_value 8
execute if score #MarkerMotion.TMP neac_value matches 4.. positioned as @s run tp @s ^ ^ ^0.04
execute if score #MarkerMotion.TMP neac_value matches 4.. run scoreboard players remove #MarkerMotion.TMP neac_value 4
execute if score #MarkerMotion.TMP neac_value matches 2.. positioned as @s run tp @s ^ ^ ^0.02
execute if score #MarkerMotion.TMP neac_value matches 2.. run scoreboard players remove #MarkerMotion.TMP neac_value 2
execute if score #MarkerMotion.TMP neac_value matches 1.. positioned as @s run tp @s ^ ^ ^0.01
execute if score #MarkerMotion.TMP neac_value matches 1.. run scoreboard players remove #MarkerMotion.TMP neac_value 1

# ifに引っかからない対策で少しだけ後ろに移動しておく
execute positioned as @s run tp @s ^ ^ ^-0.0000152587890625

# 到達目標位置が近くてspeedが0以下であれば停止
execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.0078125,limit=1] if score #MarkerMotion.Speed neac_value matches ..0 run tag @s add MarkerMotion.speed.0
# GravitySumが0でなければ移動後のY座標から重力分を引いた座標に移動する
execute unless score #MarkerMotion.GravitySum neac_value matches 0 store result score #MarkerMotion.TMP neac_value run data get entity @s Pos[1] 1000000
execute unless score #MarkerMotion.GravitySum neac_value matches 0 store result entity @s Pos[1] double 0.000001 run scoreboard players operation #MarkerMotion.TMP neac_value -= #MarkerMotion.GravitySum neac_value

# 最大ループ回数指定
scoreboard players set #MarkerMotion.loop neac_value 41
# 到達目標位置が近くになければそこまでの間のブロックをループでチェック
execute unless entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.0078125,limit=1] positioned ^ ^ ^0.5 run function marker_motion:tp/1
# スコアリセット
scoreboard players reset #MarkerMotion.loop
scoreboard players reset #MarkerMotion.TMP


# 自身の方向を見てチェックしていく
execute facing entity @s feet run function marker_motion:tp/0


# kill
kill @s
24 changes: 24 additions & 0 deletions MarkerMotion/data/marker_motion/functions/tp/0.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#> marker_motion:tp/0
#
# 移動先目標までの間にブロックがあるか探す処理
# その際にヒットボックスでのヒットを行ったりできる
#
# @within
# function marker_motion:main


# プレイヤーの視線をx軸で反転させた角度
execute positioned 0.0 0.0 0.0 positioned ^ ^ ^2 positioned 0.0 ~ ~ positioned ^ ^ ^-1 facing 0.0 0.0 0.0 positioned as @s run tp @s ~ ~ ~ ~ ~

# 初期化
data modify storage neac: _.tp set value [[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}],[{success:0b}]]

# 到達目標位置が近くてspeedが0以下であれば停止
execute if entity @s[distance=..0.0078125] if score #MarkerMotion.Speed neac_value matches ..0 run tag @e[type=marker,tag=MarkerMotion.me,limit=1] add MarkerMotion.speed.0

# 最大ループ回数指定
scoreboard players set #MarkerMotion.loop neac_value 41
# 到達目標位置が近くになければそこまでの間のブロックをループでチェック
execute unless entity @s[distance=..0.0078125] positioned ^ ^ ^0.5 run function marker_motion:tp/1
# スコアリセット
scoreboard players reset #MarkerMotion.loop
4 changes: 2 additions & 2 deletions MarkerMotion/data/marker_motion/functions/tp/1.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ data modify storage neac: _.tp[0][].success set value 1b

# ブロック探査
execute if data storage neac: _.MarkerMotion.stopwith{block:0b} run data modify storage neac: _.tp[0][].success set value 0b
execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated as @e[type=#marker_motion:selector,tag=MarkerMotion.this,limit=1] if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[0][].success set value 0b
execute unless data storage neac: _.MarkerMotion.stopwith{block:0b} if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated as @s if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision rotated ~180 ~ if block ^ ^ ^0.5 #marker_motion:no_collision if block ^ ^ ^-0.5 #marker_motion:no_collision if predicate marker_motion:block_check/shape/erosion/check run data modify storage neac: _.tp[0][].success set value 0b

# エンティティ探査
execute if entity @e[tag=MarkerMotion.target,limit=1] positioned ~-0.5 ~-0.5 ~-0.5 if entity @e[tag=MarkerMotion.target,dx=0,dy=0,dz=0,limit=1] run data modify storage neac: _.tp[0][].success set value 1b

# 到達点探査
execute if entity @e[type=#marker_motion:selector,tag=MarkerMotion.this,distance=..0.5,limit=1] run data modify storage neac: _.tp[0][].success set value 1b
execute if entity @s[distance=..0.5] run data modify storage neac: _.tp[0][].success set value 1b


# 上で満たしたらさらに細かくチェック
Expand Down
Loading

0 comments on commit fe63200

Please sign in to comment.