From 1e3e74b3782b0674d778d5c9c4fe3e5c5a46f532 Mon Sep 17 00:00:00 2001 From: TheAfroOfDoom Date: Fri, 12 Jan 2024 23:08:12 -0500 Subject: [PATCH] adjust `bullet` to use bomb logic - falls slow at start, then falls fast and explodes when hits ground --- .../attack/bomb/bullet/initialize.mcfunction | 8 ++---- .../attack/bomb/bullet/loop.mcfunction | 25 ++++++++++++++----- .../attack/bomb/bullet/loop/move.mcfunction | 3 --- .../bomb/bullet/loop/start_falling.mcfunction | 2 ++ .../bomb/bullet/loop/stop_falling.mcfunction | 10 ++++++++ 5 files changed, 33 insertions(+), 15 deletions(-) delete mode 100644 datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/move.mcfunction create mode 100644 datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/start_falling.mcfunction create mode 100644 datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling.mcfunction diff --git a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/initialize.mcfunction b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/initialize.mcfunction index 59c950782..84a2cffd9 100644 --- a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/initialize.mcfunction +++ b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/initialize.mcfunction @@ -2,12 +2,8 @@ scoreboard players set @s attack.clock.i -1 scoreboard players operation @s attack.speed.z = #attack-bomb attack.speed.z -# Play bullet shoot sound -playsound omega-flowey:attack.bomb.shoot hostile @a ~ ~ ~ 5 1 - -# Set pitch and yaw from input -execute store result entity @s Rotation[0] float 0.01 run data get storage attack:bomb yaw -execute store result entity @s Rotation[1] float 0.01 run data get storage attack:bomb pitch +# Play summon animation (scale-in from 0) +function animated_java:bomb/animations/summon/play # Remove tags tag @s remove attack-bullet-new diff --git a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop.mcfunction b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop.mcfunction index 31a9974f9..a461d1bae 100644 --- a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop.mcfunction +++ b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop.mcfunction @@ -1,11 +1,24 @@ scoreboard players add @s attack.clock.i 1 -data merge storage utils:damage { damage: 2, radius: 1 } -execute positioned ~ ~-1.5 ~ run function entity:utils/damage with storage utils:damage +# this is a rect volume, size is 18x(28+36)x18 +# y-bound is -28 to +36 +data merge storage utils:damage { damage: 2, radius: 1.8 } +exeute positioned ~ ~-2 ~ run function entity:utils/damage with storage utils:damage +exeute positioned ~ ~ ~ run function entity:utils/damage with storage utils:damage +exeute positioned ~ ~2 ~ run function entity:utils/damage with storage utils:damage -# Move forward -function entity:hostile/omega-flowey/attack/bomb/bullet/loop/move +# Move down slowly during summon animation +execute if score @s attack.clock.i matches 0..15 run teleport @s ~ ~-0.5 ~ -# TODO(60): validate/determine a value for how long until the bomb bullets terminate +# Play falling sound once when we start falling faster +execute if score @s attack.clock.i matches 20 run function entity:hostile/omega-flowey/attack/bomb/bullet/loop/start_falling + +# Move down faster during actual fall after a delay +execute if score @s attack.clock.i matches 20.. run teleport @s ~ ~-2.2 ~ + +# Stop falling after bomb falls through floor +execute at @s if entity @s[x=-100,dx=200,y=33,dy=-20,z=-100,dz=200] run function entity:hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling + +# TODO(): validate/determine a value for how long until the bomb bullets terminate # Terminate after X seconds -execute if score @s attack.clock.i matches 60.. run function entity:hostile/omega-flowey/attack/bomb/bullet/terminate +execute if score @s attack.clock.i matches 39.. run function entity:hostile/omega-flowey/attack/bomb/bullet/terminate diff --git a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/move.mcfunction b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/move.mcfunction deleted file mode 100644 index c08c9567d..000000000 --- a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/move.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -# Move forward at defined `attack.speed.z` velocity -execute store result storage utils:move z double 0.01 run scoreboard players get @s attack.speed.z -function entity:utils/move_forward with storage utils:move diff --git a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/start_falling.mcfunction b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/start_falling.mcfunction new file mode 100644 index 000000000..36c288e95 --- /dev/null +++ b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/start_falling.mcfunction @@ -0,0 +1,2 @@ +stopsound @a hostile omega-flowey:attack.bomb.fall +playsound omega-flowey:attack.bomb.fall hostile @a ~ ~ ~ 5 1 diff --git a/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling.mcfunction b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling.mcfunction new file mode 100644 index 000000000..9f1422829 --- /dev/null +++ b/datapacks/omega-flowey/data/entity/functions/hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling.mcfunction @@ -0,0 +1,10 @@ +# Keep consistent y-pos +teleport @s ~ 33.0 ~ + +# Play animation if we just stopped falling +execute unless entity @s[tag=is_done_falling] run function animated_java:bomb/animations/explode/play +execute unless entity @s[tag=is_done_falling] run stopsound @a hostile omega-flowey:attack.bomb.explode +execute unless entity @s[tag=is_done_falling] run playsound omega-flowey:attack.bomb.explode hostile @a ~ ~ ~ 5 1 + +# Add tags +tag @s add is_done_falling